cli: parse_region_source's error vocabulary can drift from SourceArg #221

Closed
opened 2026-09-08 02:29:05 +09:00 by natsukium · 0 comments
Owner

#187's plan asked for parse_region_source to be replaced by the SourceArg ValueEnum; the accepted deviation keeps it as a wrapper for the felis bridge path (cli_bridge.rs:1307 and :1997 both call it).

Before #187 its message sat inside the same match that defined the accepted spellings, so the two could not disagree. Now the vocabulary lives in SourceArg (cli_sessions.rs:471-478) while cli_sessions.rs:496 hand-spells expected visible, scrollback, command-output, or last-command in a map_err that never consults SourceArg::value_variants().

Nothing at HEAD pins the wrapper: git grep "unknown source" matches only the literal itself, and the only bridge traffic carrying a source is one happy-path fixture with "scrollback" (crates/felis-cli/tests/schema_fixtures.rs:72).

Failure mechanism: rename or add a SourceArg variant and --help, completions and the man page update automatically while the bridge's refusal keeps naming the old four — a machine client is told to send a spelling the parser now rejects, and the whole suite stays green.

Correction: build the message from SourceArg::value_variants() / to_possible_value() rather than a literal, or add a unit test asserting the four spellings round-trip through parse_region_source and that its error text lists exactly the current variant names.

Deferred from #187 because keeping parse_region_source as a bridge-path wrapper is an already-accepted deviation from the AC's scope; a drift-detection test for it is new hardening the acceptance criteria never asked for.

Split from #187.

#187's plan asked for `parse_region_source` to be replaced by the `SourceArg` `ValueEnum`; the accepted deviation keeps it as a wrapper for the `felis bridge` path (`cli_bridge.rs:1307` and `:1997` both call it). Before #187 its message sat inside the same `match` that defined the accepted spellings, so the two could not disagree. Now the vocabulary lives in `SourceArg` (`cli_sessions.rs:471-478`) while `cli_sessions.rs:496` hand-spells `expected visible, scrollback, command-output, or last-command` in a `map_err` that never consults `SourceArg::value_variants()`. Nothing at HEAD pins the wrapper: `git grep "unknown source"` matches only the literal itself, and the only bridge traffic carrying a source is one happy-path fixture with `"scrollback"` (`crates/felis-cli/tests/schema_fixtures.rs:72`). Failure mechanism: rename or add a `SourceArg` variant and `--help`, completions and the man page update automatically while the bridge's refusal keeps naming the old four — a machine client is told to send a spelling the parser now rejects, and the whole suite stays green. Correction: build the message from `SourceArg::value_variants()` / `to_possible_value()` rather than a literal, or add a unit test asserting the four spellings round-trip through `parse_region_source` and that its error text lists exactly the current variant names. Deferred from #187 because keeping `parse_region_source` as a bridge-path wrapper is an already-accepted deviation from the AC's scope; a drift-detection test for it is new hardening the acceptance criteria never asked for. Split from #187.
Sign in to join this conversation.
No description provided.