fix(cli): --project/--schemas global so they work in any position (REQ-209, closes #500)#501
Merged
Merged
Conversation
…n (REQ-209, closes #500) These top-level path args lacked `global = true`, so `rivet validate --project X` errored (only `rivet --project X validate` parsed) — and with `--format json` produced empty stdout, a confusing failure for tools shelling out to rivet (it cost a debug cycle in the #488 `--new-since` subprocess). Marking both `global = true` makes them position-independent; additive (pre-subcommand form still parses). Test (cli_global_args_tests): both args parse after the subcommand, and `-p` before the subcommand still parses. Confirmed with: cargo test -p rivet-cli --bin rivet cli_global_args_tests (pass); `rivet validate --project .` / `-p . --format json` / `--schemas ./schemas` all succeed (previously errored); cargo fmt --check + clippy --all-targets -- -D warnings (exit 0); rivet validate PASS. Implements: REQ-209 Verifies: REQ-209 Refs: REQ-007
📐 Rivet artifact delta
Graphgraph LR
REQ_209["REQ-209"]:::added
classDef added fill:#d4edda,stroke:#28a745,color:#155724
classDef removed fill:#f8d7da,stroke:#dc3545,color:#721c24
classDef modified fill:#fff3cd,stroke:#ffc107,color:#856404
classDef overflow fill:#e2e3e5,stroke:#6c757d,color:#495057,stroke-dasharray: 3 3
Added
Posted by |
avrabe
added a commit
that referenced
this pull request
Jun 6, 2026
… positional subcommands (reverts REQ-209/#501) (#502) REQ-209 / #501 marked --project/--schemas `global = true` to fix #500, but that broke main: 3 cli_commands integration tests (next_id_json, next_id_positional_shorthand, all_json_outputs_are_valid) panicked in clap's debug_asserts — clap does NOT allow a `global` arg to coexist with subcommands that take positionals (next-id <type>, link <src> <tgt>, snapshot diff <baseline>, …). My pre-merge check only exercised `validate` (no positional), so it passed; the full suite would have caught it. Reverts the `global = true` on both args, removes the now-invalid cli_global_args_tests and the REQ-209 artifact. #500's premise (args after the subcommand) is therefore a clap limitation, not fixable this way — the workaround is the standard convention: put --project before the subcommand (`rivet -p X validate`). Documented on the arg + reopening #500. Confirmed with: cargo test -p rivet-cli --test cli_commands (127 passed, 0 failed — the 3 regressions fixed); cargo fmt --check + clippy --all-targets -- -D warnings (exit 0); rivet validate PASS. Refs: REQ-007
This was referenced Jun 6, 2026
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 #500 (my own from last hour — the gotcha that cost a debug cycle in #488).
--project/-pand--schemaswere top-level args withoutglobal = true, so they only parsed before the subcommand:rivet -p X validateworked butrivet validate -p Xerrored — and with--format jsonproduced empty stdout (error on stderr), confusing for tools shelling out to rivet.Fix
global = trueon both → position-independent. Additive (pre-subcommand form still parses); low-risk.Verification
cli_global_args_tests):--project/--schemasparse after the subcommand;-pbefore still parses.rivet validate --project .,-p . --format json,--schemas ./schemasall succeed (previously errored).cargo fmt --check+clippy --all-targets -- -D warningsexit 0 ·rivet validatePASS.Implements + Verifies REQ-209.
🤖 Generated with Claude Code