CLI: --kinds silently drops invalid values and falls through to defaults
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
crates/buzz-cli/src/commands/messages.rs の cmd_get_messages、372-377 行付近から始め、issue にある --kinds の再現コマンドを実行します。すべての値が無効な場合も含め、不正な値によって無効な値を示す usage error が発生し、有効なカンマ区切りの kinds はデフォルトにフォールバックせずに渡されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
markdown
buzz messages get --kinds "abc,9" silently drops invalid kind values and returns results only for the valid ones. A user who types --kinds "9,abc" (typo, or unfamiliar kind string) gets kind-9 results with no warning that "abc" was ignored. The same applies when ALL values are invalid — the empty parsed list falls through and the default kinds are used instead, which is the opposite of what the user asked for.
Steps to reproduce
1. Run buzz messages get --channel <uuid> --kinds "abc,9" --format json
2. Observe: results are returned (only kind 9), no error or warning about "abc"
3. Run buzz messages get --channel <uuid> --kinds "abc" --format json
4. Observe: returns ALL default kinds (9, 40002, 40008, 45001, 45003) because the parsed list is empty and the if !kind_list.is_empty() guard falls through, leaving the original default kinds in place
Expected behavior
- If any value in --kinds fails to parse as a number, the command should return an error (exit code 1) naming the invalid value: invalid kind value in --kinds: "abc".
- Alternatively, a warning on stderr for each dropped value, though an error is safer — silent data loss from malformed input violates the CLI's agent-first contract where agents cannot inspect stderr interactively.
Actual behavior
Invalid kind values are silently dropped by filter_map(|s| s.trim().parse().ok()). If ALL values are invalid, the empty list falls through and the default kinds are used instead — the user asked for specific kinds and got the default instead, with no indication.
Version and platform
- Buzz CLI: current main as of 2026-08-27
- OS: any
Logs / additional context
The relevant code is in crates/buzz-cli/src/commands/messages.rs, cmd_get_messages, lines 372-377:
rust
if let Some(k) = kinds {
let kind_list: Vec<u64> = k.split(',').filter_map(|s| s.trim().parse().ok()).collect();
if !kind_list.is_empty() {
filter["kinds"] = serde_json::json!(kind_list);
}
}
The filter_map(... .ok()) silently discards parse failures. The if !kind_list.is_empty() guard means an entirely-invalid --kinds value reverts to the default kind set — the user asked for specific kinds and got the default instead, with no indication.
Suggested fix
Replace filter_map with a fallible parse that returns CliError::Usage on the first invalid value:
rust
if let Some(k) = kinds {
let kind_list: Vec<u64> = k.split(',')
.map(|s| s.trim().parse::<u64>()
.map_err(|_| CliError::Usage(format!("invalid kind value in --kinds: {:?}", s.trim()))))
.collect::<Result<, >>()?;
filter["kinds"] = serde_json::json!(kind_list);
}
- 主要言語
- Rust
- スター
- 35.3k
- フォーク
- 4.7k
- 平均マージ
- 2日 23時間
- マージ済み PR(30日)
- 176
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
block/buzz のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
Mobile: opening an attachment names the file after the link text instead of the imeta filename対応中かも @wenhaoone が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
Desktop: private project home channels show no lock icon in the sidebar対応中かも @Bartok9 が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
buzz-pair: panics on wss:// relays — rustls CryptoProvider never installed対応中かも @Bartok9 が 4 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
review-drift
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
oxidecomputer/hansei#14 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
rubys/roundhouse#444 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
install: root SSH tmpfiles.d drop-in is labeled etc_runtime_t instead of etc_t対応中かも @andrewdunndev が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信