A --help flag must never execute a command; reject unknown flags across subcommands #439
Labels
No labels
agent-ready
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
needs-input
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#439
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
./iw phase-merge --helpmerged a pull request.What happened
While shipping Phase 1 of IW-423,
./iw phase-merge --max-retries 0refused withTimed out waiting for CI checks after 30m.../iw phase-merge --helpwas then run to look for a flag to raise the budget. It printed no help. It merged PR 434:The merge happened to be wanted, so nothing was lost — but the command that performed it was a request for documentation.
Why
phase-merge(core/commands/PhaseMerge.scala) has no required argument, so an unrecognised help flag falls through to the action.phase-prbehaves correctly by contrast: it fails withMissing required argument: --titleand prints a usage line, because its required-argument check runs before anything else. That is accidental correctness, not a design.Lesson: a command that acts by default and ignores unknown flags will perform its action when asked for its usage.
Fix
iwsubcommand, not per command.The second half matters beyond help: today any misspelled flag on any subcommand is silently discarded and the command runs with defaults.
Note for whoever fixes this:
./iw issue createhas a related parsing weakness — a--titlewhose value begins with two dashes is swallowed by the arg parser and the API rejects the request with a bare 422. That is the same "unknown flags are not rejected" family.Recorded during IW-423; see
project-management/issues/IW-423/LESSONS.mdentry 11.Superseded by #463, which carries both halves of this issue in full — help must never execute, and unknown flags must be rejected — and adds the content requirement: the help text itself must be instructive enough to guide an agent. Closing in favour of #463.