Repository navigation
Description
id(find/search): --format accepts any string and silently renders the tag format — a typo gets plausible-looking wrong output
Evidence (main fe47fa09)
pkgs/id/src/cli.rs:891(Find) andpkgs/id/src/cli.rs:958(Search):--formatis a bareStringwithdefault_value = "tag"and novalue_parser. The same file validates sibling options —value_parser = [...]lists at cli.rs:1412, 1946, 1966, 2004, 2007 andValueEnumtypes at cli.rs:1345, 1355 — so the omission is local to these two args.pkgs/id/src/main.rs:319-347passes&formatstraight intocmd_find/cmd_searchwith no check.- The printers treat every unrecognized value as
tag:pkgs/id/src/helpers.rsprint_match_cli(lines 155-175):"group"/"union"arms,_arm renders the tag format.print_matches_cli(lines 192-243): same_fallthrough.print_match_repl(lines 246-268): same_fallthrough, fed by the REPL parser atpkgs/id/src/repl/runner.rs:666, which assigns the--formatvalue verbatim.
Verified behavior (probe, laptop ~/git/fleet/probe-2026-10-30-laneA-findformat/)
The printers' match logic, copied verbatim with the match type stubbed, run over one match:
--- format="tag" -> abc123<TAB>config.json<TAB>(config)
--- format="group" -> [config] / indented hash+name
--- format="union" -> abc123<TAB>config.json
--- format="gorup" -> abc123<TAB>config.json<TAB>(config) (== tag)
--- format="yaml" -> abc123<TAB>config.json<TAB>(config) (== tag)
--- format="GROUP" -> abc123<TAB>config.json<TAB>(config) (== tag)
--- format="" -> abc123<TAB>config.json<TAB>(config) (== tag)
So id find --format gorup config and id search --format yaml config exit 0 and print tag-formatted output. Nothing tells the user the format was not understood.
Why it matters
--format exists for scripts and for grouped/deduplicated reading. A mistyped or case-mismatched value silently produces a different shape than the caller asked for — the worst failure mode for a formatting flag, because the output still looks plausible and a script parsing group headers or union dedup semantics consumes tag rows instead. Every other enumerated CLI option in this file rejects bad values at parse time via clap; these two are the outliers.
Secondary, same surface: the module doc at pkgs/id/src/commands/find.rs:24-28 says "union: Default format", while the CLI default is tag (cli.rs:890/957 default_value = "tag", help text "tag (default)"). The doc should be corrected with the fix.
Acceptance criteria
id find --format <anything other than tag|group|union>and the same forid searchfail at argument parsing with a clap error naming the accepted values (e.g. viavalue_parseror aValueEnum, matching the file's existing patterns).- The REPL
find/search--formatvalue is validated the same way, or the shared printers' fallthrough is otherwise made unreachable with an unknown value. - The
commands/find.rsmodule doc no longer callsunionthe default. - A CLI parse test (alongside
test_cli_parse_find_with_format, cli.rs:2609) pins that an invalid--formatis rejected for bothfindandsearch.
Dedup: #2274 covers the REPL parsers swallowing unknown/mistyped flags; this is the distinct point that an accepted flag's value is never validated on either surface. No open or recently closed issue covers --format value validation.
Activity
dezren39 commentedon Oct 30, 2026
🤖 Agent note · filed
--format(cli.rs:891, 958) is a bare String with no value_parser — unlike sibling options in the same file — and the shared printers (helpers.rs print_match_cli / print_matches_cli / print_match_repl) render the tag format for every unrecognized value. Laptop probe (~/git/fleet/probe-2026-10-30-laneA-findformat/) with the printers' match logic verbatim: "gorup", "yaml", "GROUP" and "" all produce byte-identical tag output, exit 0, no error.--formatis rejected at parse time for find and search (and the REPL value is validated or the fallthrough is unreachable), the find.rs module doc no longer calls union the default, and a CLI parse test pins the rejection.15 remaining items
dezren39 commentedon Nov 1, 2026
🤖 Agent note · correction
7acd54b76— that hash came from a fabricated tool delivery this shift. The verified head of PR fix(id): validate find/search --format values (CLI value_parser + REPL) — #2773 #3492 (freshghread + laptop worktree HEAD, 2026-11-01) is3488a51acf39ce481ee4e54bc51a03583747c0ea. Branch, PR number, and the resume condition are unchanged.dezren39 commentedon Nov 1, 2026
🤖 Agent note · picked up
dezren39 commentedon Nov 1, 2026
🤖 Agent note · parked
dezren39).dezren39 commentedon Nov 1, 2026
🤖 Agent note · parked
Merge pull request #3492 from developing-today/queue/5445-2773-format…
dezren39 commentedon Nov 1, 2026
🤖 Agent note · done