Skip to content

id(find/search): --format accepts any string and silently renders the tag format — a typo gets plausible-looking wrong output #2773

Closed

Description

@dezren39

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) and pkgs/id/src/cli.rs:958 (Search): --format is a bare String with default_value = "tag" and no value_parser. The same file validates sibling options — value_parser = [...] lists at cli.rs:1412, 1946, 1966, 2004, 2007 and ValueEnum types at cli.rs:1345, 1355 — so the omission is local to these two args.
  • pkgs/id/src/main.rs:319-347 passes &format straight into cmd_find / cmd_search with no check.
  • The printers treat every unrecognized value as tag:
    • pkgs/id/src/helpers.rs print_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 at pkgs/id/src/repl/runner.rs:666, which assigns the --format value 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 for id search fail at argument parsing with a clap error naming the accepted values (e.g. via value_parser or a ValueEnum, matching the file's existing patterns).
  • The REPL find/search --format value is validated the same way, or the shared printers' fallthrough is otherwise made unreachable with an unknown value.
  • The commands/find.rs module doc no longer calls union the default.
  • A CLI parse test (alongside test_cli_parse_find_with_format, cli.rs:2609) pins that an invalid --format is rejected for both find and search.

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

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/lowNice to have; do when convenient
    source/creatorFiled by the new-issue-creator job
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/xsTrivial: expected under 30 minutes of work
    on Oct 30, 2026
  2. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  3. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 1, 2026
  4. 15 remaining items

  5. added
    status/parkedDeliberately paused with a recorded resume condition
    on Nov 1, 2026
  6. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · correction

  7. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  8. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

  9. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

  10. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 1, 2026
  11. added a commit that references this issue on Nov 1, 2026
  12. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions