Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#6,945 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@olympusbuildz がすでに取り組んでいます。

2026年8月28日 から。

  • #6992 @olympusbuildz による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
cli

調査の方向性

crates/buzz-cli/src/commands/messages.rs の cmd_get_messages、372-377 行付近から始め、issue にある --kinds の再現コマンドを実行します。すべての値が無効な場合も含め、不正な値によって無効な値を示す usage error が発生し、有効なカンマ区切りの kinds はデフォルトにフォールバックせずに渡されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug

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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

block/buzz のほかの issue

block/buzz の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。