Skip to content

feat(cli): --only accepts a set of check ids (CD-307) - #199

Merged
TAJD merged 1 commit into
mainfrom
feat/only-multi-id
Aug 9, 2026
Merged

feat(cli): --only accepts a set of check ids (CD-307)#199
TAJD merged 1 commit into
mainfrom
feat/only-multi-id

Conversation

@TAJD

@TAJD TAJD commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Closes CD-307.

cofferdam check --only took 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 B and --only A,B are 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 --only exists 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 — clean
  • cargo fmt --all -- --check — clean
  • gen-docs --check — clean (the clap doc comment change regenerated docs/reference/cli.md)

New tests in crates/cofferdam-cli/tests/only_flag.rs cover 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 --only in 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

`--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
@TAJD
TAJD merged commit 62033c9 into main Aug 9, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant