Repository navigation
Reject unconsumed CLI arguments instead of silently dropping them - #172
Merged
Merged
Conversation
…ng them Adds a shared checkArgs/shadowedFlags check, wired into every subcommand's flag parsing, that fails loudly on two compounding defects behind the 2026-09-24 incident: leftover positional arguments (an unset -change means "sync everything") and flags shadowed by an earlier positional token (Go's flag package stops parsing at the first non-flag argument, so a trailing -dry-run was never even seen). Also adds a pre-flight target/count summary before any real sync write, and a regression test reproducing the incident's exact argument shape end to end against a stub gh.
- shadowedFlags no longer under-counts: the value-token skip only applies before the positional boundary (where flag.Parse genuinely consumes a value), so two shadowed flags in a row (e.g. a value flag immediately followed by a bool flag) are both reported instead of just the first. - checkArgsErr no longer names the same shadowed flag twice (once as "shadowed", once as "unexpected argument") — the unexpected-argument list excludes tokens already reported as shadowed flags. - Added TestEveryRunFuncChecksArgs: an AST-based guard so a future subcommand can't silently reintroduce this incident's failure mode by omitting the checkArgs call.
Deploying specsync with
|
| Latest commit: |
a8ff489
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://37417f0d.specsync.pages.dev |
| Branch Preview URL: | https://feat-170-reject-unconsumed-c.specsync.pages.dev |
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
checkArgs/shadowedFlagscheck, wired into every subcommand's flag parsing, that fails loudly on unconsumed positional arguments and on flags shadowed by an earlier positional token (Go'sflagpackage stops parsing at the first non-flag argument).TestEveryRunFuncChecksArgs) guarding against a future subcommand silently reintroducing the gap.gh.Closes #170
🤖 Generated with Claude Code