Skip to content

fix(id): validate find/search --format values (CLI value_parser + REPL) — #2773 - #3492

Merged
dezren39 merged 1 commit into
mainfrom
queue/5445-2773-format-validation
Nov 1, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/5445-2773-format-validation

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

What

Implements the pinned fix for #2773 (triage task 4008, CONFIRMED at main df3b63d1f): id find/id search --format was a bare String with no validation, so any typo (gorup, yaml, GROUP, empty) silently rendered the tag format with exit 0 via the printers' fallthrough arm.

  • pkgs/id/src/cli.rs — value_parser = ["tag", "group", "union"] on the --format arg of both Find (~890) and Search (~957), matching the file's existing value_parser list pattern (e.g. role at :1412). Invalid values now fail at clap parse time naming the accepted values.
  • pkgs/id/src/repl/runner.rs — parse_find_args validates the --format value: an unknown value is recorded as FindArgs.format_error and is never stored as the format; the find/search/show handlers surface error: invalid --format "...": expected tag, group, or union before any printing, so an unknown value cannot reach the printers.
  • pkgs/id/src/commands/find.rs — module doc corrected: tag is the default format, not union.

Printers' fallthrough arms in helpers.rs are unchanged (packet scope): with both entry points validated, unknown values are unreachable.

Tests

  • New CLI parse tests alongside test_cli_parse_find_with_format: Cli::try_parse_from rejects gorup/yaml/GROUP/"" and accepts tag/group/union for BOTH find and search.
  • New REPL parse tests: unknown --format yields format_error and leaves the default format stored; valid values are stored with no error.
  • Targeted runs (cargo test test_cli_parse, cargo test test_parse_find_args) executing on the laptop against this branch; full pkgs/id suite runs in CI per repo workflow.

Queue task 5445 · Issue #2773


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…L) and correct find.rs default doc

Closes the silent-typo hole in #2773: --format was a bare String on both
the CLI and the REPL path, so gorup/yaml/GROUP/empty rendered the tag
format with exit 0 via the printers fallthrough arm.

- cli.rs: value_parser = [tag, group, union] on Find and Search --format;
  invalid values now fail at clap parse time naming the accepted values.
- repl/runner.rs: parse_find_args records format_error for an unknown
  --format value (never stored as the format); find/search/show handlers
  surface the error before any printing.
- commands/find.rs: module doc now names tag as the default format.
- Tests: CLI try_parse rejection/acceptance for both commands; REPL
  parse tests for invalid and valid --format values.
@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 10:27
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 30 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1e465e60-d0f9-4118-b386-8888fc848bbd
Commits

Reviewing files that changed from the base of the PR and between d212087 and 3488a51.

Files selected for processing: 3
  • pkgs/id/src/cli.rs
  • pkgs/id/src/commands/find.rs
  • pkgs/id/src/repl/runner.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T10:28:42.810144Z 3488a51 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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