feat(cli): --only accepts a set of check ids (CD-307) - #199
Merged
Conversation
`--only` took exactly one id, so a project gating on several named checks ran the whole pipeline once per check — discovery, parse loop and graph build repeated for findings that could have shared one pass. Migrating Projektor's CI onto it needed two steps for that reason. The flag is now repeatable and comma-separated; `--only A --only B` and `--only A,B` mean the same thing. Everything downstream already operated on the filtered set rather than a single id, so run scope, baseline, budgets and the exit gate generalise without further change. An unknown id still exits 2, and the error now names every offending id rather than the first. Resolving the valid ones and dropping a typo would silently narrow the gate — the exact false-green this flag exists to prevent, and a set of four ids makes a typo more likely, not less. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019afugU2bTYCtXn6Vy9dn1v
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.
Closes CD-307.
cofferdam check --onlytook exactly one check id. A project gating on several named checks therefore ran the full pipeline once per check — discovery, parse loop and graph build repeated for findings that could have shared one pass. Migrating Projektor's CI onto--only(projektor#242) needed two steps for exactly this reason.The flag is now repeatable and comma-separated, via clap's
value_delimiter = ','plus the default append behaviour:--only A --only Band--only A,Bare equivalent. Everything downstream of the filter already worked on the retained set rather than a single id, so run scope, baseline, budgets and the exit-code gate generalise with no further change.Exit 2 on any unknown id
The single-id behaviour was "unknown id exits 2". For a set, the safe reading is any unknown id fails the run, and that is what this does. Accepting the valid ids and dropping the typo would silently narrow the gate — the false-green
--onlyexists to prevent — and a set of four ids makes a typo likelier, not less. The error names every offending id and only the offending ids, so the fix is obvious from the message.Verification
cargo test --workspace— 1325 passed (3 new)cargo clippy --workspace --all-targets -- -D warnings— cleancargo fmt --all -- --check— cleangen-docs --check— clean (the clap doc comment change regenerateddocs/reference/cli.md)New tests in
crates/cofferdam-cli/tests/only_flag.rscover the comma-separated form, the repeated-flag form, and one bad id among good ones. The multi-id fixture fires both named checks, so seeing both proves the filter is a union rather than last-one-wins.Note
docs/ci-recipes.md§9 documents--onlyin the single-id voice, but that section lives on #197 rather than main. It will be updated in whichever of the two merges second.🤖 Generated with Claude Code
https://claude.ai/code/session_019afugU2bTYCtXn6Vy9dn1v