cli: build the bridge's source refusal from SourceArg #228

Merged
natsukium merged 1 commit from issue-221 into main 2026-09-08 21:57:51 +09:00
Owner

SourceArg is the single source vocabulary for --source, the completions, the man page and the published bridge schema, but parse_region_source (the wrapper the felis bridge path keeps) hand-spelled its refusal as expected visible, scrollback, command-output, or last-command. Renaming or adding a variant would update every other consumer automatically while the bridge's refusal kept naming the old four, telling a machine client to send a spelling the parser now rejects, with the whole suite still green. The refusal now builds its list from SourceArg::value_variants() through a new source_names() helper, which cli_schema reads too, so the published enum, the parser and the refusal share one source. The message text is byte-identical for today's vocabulary.

Tests: every_source_spelling_round_trips_through_parse_region_source pins that every advertised spelling parses into its own RegionSource (and that no variant is hidden from the advertised list); the_source_refusal_names_exactly_the_current_vocabulary pins the refusal's exact text plus the presence of every current variant name, so a rename that the message could not follow trips a test.

just check passes in full (3429 tests, clippy, fmt, deny, proto-compat, release self-test).

Fixes #221

`SourceArg` is the single `source` vocabulary for `--source`, the completions, the man page and the published bridge schema, but `parse_region_source` (the wrapper the `felis bridge` path keeps) hand-spelled its refusal as `expected visible, scrollback, command-output, or last-command`. Renaming or adding a variant would update every other consumer automatically while the bridge's refusal kept naming the old four, telling a machine client to send a spelling the parser now rejects, with the whole suite still green. The refusal now builds its list from `SourceArg::value_variants()` through a new `source_names()` helper, which `cli_schema` reads too, so the published enum, the parser and the refusal share one source. The message text is byte-identical for today's vocabulary. Tests: `every_source_spelling_round_trips_through_parse_region_source` pins that every advertised spelling parses into its own `RegionSource` (and that no variant is hidden from the advertised list); `the_source_refusal_names_exactly_the_current_vocabulary` pins the refusal's exact text plus the presence of every current variant name, so a rename that the message could not follow trips a test. `just check` passes in full (3429 tests, clippy, fmt, deny, proto-compat, release self-test). Fixes #221
cli: build the bridge's source refusal from SourceArg
Some checks failed
bench / Criterion full-suite snapshot (pull_request) Has been skipped
fuzz / cargo fuzz nightly long-run (pull_request) Has been skipped
bench / Criterion regression gate (pull_request) Failing after 2m25s
darwin / build felis (aarch64-darwin) (pull_request) Successful in 50s
fuzz / cargo fuzz smoke (per target) (pull_request) Successful in 1m51s
darwin / detect relevant changes (pull_request) Successful in 4s
darwin / darwin docs-only no-op (pull_request) Has been skipped
pr / nix flake check (pull_request) Successful in 36s
pr / cargo build / clippy / test / deny (pull_request) Failing after 1m20s
pr / wire schema is compatible with the base (pull_request) Successful in 10s
pr / frontend smoke (x86_64-linux) (pull_request) Successful in 1m48s
pr / publish felis (x86_64-linux) (pull_request) Has been skipped
windows / detect relevant changes (pull_request) Successful in 3s
windows / windows docs-only no-op (pull_request) Has been skipped
windows / cargo nextest (Windows) (pull_request) Successful in 6m37s
windows / frontend smoke (Windows) (pull_request) Successful in 2m15s
windows / package felis (x86_64-pc-windows-msvc) (pull_request) Has been skipped
windows / cargo clippy (Windows cross) (pull_request) Has been cancelled
dd06d0c079
`SourceArg` is the one `source` vocabulary, but the bridge path's
`parse_region_source` hand-spelled its refusal. Renaming or adding a
variant updated `--help`, the completions, the man page and the
published bridge schema while the refusal kept naming the old four,
telling a machine client to send a spelling the parser now rejects,
and no test at HEAD covered the wrapper, so the suite stayed green.

The names now come off `value_variants()` through `source_names()`,
which the bridge schema also reads, so the three consumers cannot
disagree. The message text is unchanged for today's vocabulary.

Assisted-by: Claude Code
natsukium force-pushed issue-221 from dd06d0c079
Some checks failed
bench / Criterion full-suite snapshot (pull_request) Has been skipped
fuzz / cargo fuzz nightly long-run (pull_request) Has been skipped
bench / Criterion regression gate (pull_request) Failing after 2m25s
darwin / build felis (aarch64-darwin) (pull_request) Successful in 50s
fuzz / cargo fuzz smoke (per target) (pull_request) Successful in 1m51s
darwin / detect relevant changes (pull_request) Successful in 4s
darwin / darwin docs-only no-op (pull_request) Has been skipped
pr / nix flake check (pull_request) Successful in 36s
pr / cargo build / clippy / test / deny (pull_request) Failing after 1m20s
pr / wire schema is compatible with the base (pull_request) Successful in 10s
pr / frontend smoke (x86_64-linux) (pull_request) Successful in 1m48s
pr / publish felis (x86_64-linux) (pull_request) Has been skipped
windows / detect relevant changes (pull_request) Successful in 3s
windows / windows docs-only no-op (pull_request) Has been skipped
windows / cargo nextest (Windows) (pull_request) Successful in 6m37s
windows / frontend smoke (Windows) (pull_request) Successful in 2m15s
windows / package felis (x86_64-pc-windows-msvc) (pull_request) Has been skipped
windows / cargo clippy (Windows cross) (pull_request) Has been cancelled
to 7a017a6df8
All checks were successful
bench / Criterion full-suite snapshot (pull_request) Has been skipped
fuzz / cargo fuzz nightly long-run (pull_request) Has been skipped
bench / Criterion regression gate (pull_request) Successful in 2m1s
darwin / detect relevant changes (pull_request) Successful in 3s
darwin / darwin docs-only no-op (pull_request) Has been skipped
darwin / build felis (aarch64-darwin) (pull_request) Successful in 50s
fuzz / cargo fuzz smoke (per target) (pull_request) Successful in 1m10s
pr / nix flake check (pull_request) Successful in 6s
pr / cargo build / clippy / test / deny (pull_request) Successful in 1m45s
pr / wire schema is compatible with the base (pull_request) Successful in 8s
pr / frontend smoke (x86_64-linux) (pull_request) Successful in 56s
pr / publish felis (x86_64-linux) (pull_request) Has been skipped
windows / detect relevant changes (pull_request) Successful in 3s
windows / windows docs-only no-op (pull_request) Has been skipped
windows / cargo nextest (Windows) (pull_request) Successful in 4m36s
windows / frontend smoke (Windows) (pull_request) Successful in 2m3s
windows / package felis (x86_64-pc-windows-msvc) (pull_request) Has been skipped
windows / cargo clippy (Windows cross) (pull_request) Successful in 15s
2026-09-08 20:55:20 +09:00
Compare
natsukium deleted branch issue-221 2026-09-08 21:57:51 +09:00
Sign in to join this conversation.
No description provided.