Skip to content

fix(cli): --project/--schemas global so they work in any position (REQ-209, closes #500)#501

Merged
avrabe merged 1 commit into
mainfrom
fix/req-209-global-path-args
Jun 6, 2026
Merged

fix(cli): --project/--schemas global so they work in any position (REQ-209, closes #500)#501
avrabe merged 1 commit into
mainfrom
fix/req-209-global-path-args

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Jun 6, 2026

Closes #500 (my own from last hour — the gotcha that cost a debug cycle in #488).

--project/-p and --schemas were top-level args without global = true, so they only parsed before the subcommand: rivet -p X validate worked but rivet validate -p X errored — and with --format json produced empty stdout (error on stderr), confusing for tools shelling out to rivet.

Fix

global = true on both → position-independent. Additive (pre-subcommand form still parses); low-risk.

Verification

  • Unit (cli_global_args_tests): --project/--schemas parse after the subcommand; -p before still parses.
  • Live: 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 + Verifies REQ-209.

🤖 Generated with Claude Code

…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
@avrabe avrabe merged commit c6b57d6 into main Jun 6, 2026
18 of 20 checks passed
@avrabe avrabe deleted the fix/req-209-global-path-args branch June 6, 2026 02:21
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2026

📐 Rivet artifact delta

Change Count
Added 1
Removed 0
Modified 0
Downstream impacted (depth ≤ 5) 0

Graph

graph 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
Loading
Added
  • REQ-209

📎 Full HTML dashboard attached as workflow artifact rivet-delta-pr-501download from the workflow run.

Posted by rivet-delta workflow. The graph shows only changed artifacts; open the HTML dashboard (above) for full context.

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
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