Skip to content

fix(cli): reject invalid --kinds values instead of silent fallback - #6992

Draft
olympusbuildz wants to merge 1 commit into
block:mainfrom
olympusbuildz:fix/cli-reject-invalid-kinds-6945
Draft

fix(cli): reject invalid --kinds values instead of silent fallback#6992
olympusbuildz wants to merge 1 commit into
block:mainfrom
olympusbuildz:fix/cli-reject-invalid-kinds-6945

Conversation

@olympusbuildz

Copy link
Copy Markdown

Summary

buzz messages get --kinds "abc,9" silently dropped "abc" and returned kind-9 results with no warning. When all values were invalid, the parsed list was empty and the command fell through to the default kind set — the opposite of what the user asked for.

Root cause

cmd_get_messages parsed --kinds with filter_map(|s| s.trim().parse().ok()), discarding parse failures, and only overrode the default kinds when the resulting list was non-empty.

Fix

Replace the silent filter_map with a fallible parse that returns CliError::Usage on the first invalid value, naming the bad token. This removes the empty-list guard entirely — an all-invalid input now errors instead of reverting to defaults.

Why it matters

Silent data loss from malformed CLI input violates the agent-first contract: agents cannot inspect stderr interactively, so the CLI must fail loudly on bad input.

Test plan

cargo test -p buzz-cli --lib commands::messages::tests
# 34 passed (includes 2 new regression tests)

Risk / blast radius

CLI argument parsing only. No runtime behavior changes for valid --kinds inputs. Build-metadata only.

Closest work

none found

Fixes #6945


Reviewed by Hermes Agent · Olympusbuildz · 2026-08-28

Fail closed on parse error with CliError::Usage naming the invalid
value, and remove the empty-list guard so an all-invalid --kinds
string no longer reverts to the default kinds without warning.

Regression tests cover fully invalid and partially invalid inputs.

Co-authored-by: Olympusbuildz <Olympus.roots@outlook.com>
Signed-off-by: Olympusbuildz <Olympus.roots@outlook.com>
@github-actions

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is 58cc4b7e9be71223f7898ea5f930a4248830ccfb...b1e87baa6f4dca690bdf6ac209243193c4976e9a.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review b1e87baa6f4dca690bdf6ac209243193c4976e9a to authorize a new review.
Any previous review applies only to its recorded range.

@fatima-n09

Copy link
Copy Markdown

@olympusbuildz Thanks for picking this up this matches the intended fail-closed behavior from #6945.
Invalid tokens should error (exit 1) instead of being dropped, and an all-invalid --kinds should not fall through to the default kind set. Happy to see the regression tests for both cases.

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.

CLI: --kinds silently drops invalid values and falls through to defaults

2 participants