cli: prompt before destructive commands, add idempotent flags, and fail fast

オープン
#4,452 コメント 2 件 リアクション 0 件 担当者 1 名 GitHub で見る

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

@xue-ding-e がすでに取り組んでいます。

2026年10月14日 から。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
40/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
cli

調査の方向性

Start with the CLI entry point at core/cli/src/main.rs:359 and the client retry defaults at core/common/src/types/args/mod.rs:384, then trace the listed command handlers and their error handling. Check existing CLI tests for prompts, flags, timeouts, and exit codes; done means the proposed behaviors work across the named commands and transports, with regression tests covering the distinctions and non-TTY behavior.

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

説明

enhancement tui

Problem

  • stream delete, stream purge, topic delete, topic purge, partition delete, segment delete, consumer-group delete, user delete, pat delete and context delete run at once, with no prompt.
  • A provisioning script cannot run twice. If a stream exists, stream create fails. If it does not exist, stream delete fails.
  • iggy ping against a stopped server returns after 10.06 s with Error: IggyClient(SdkError(CannotEstablishConnection)), a Rust debug value. The wait comes from the CLI client defaults (core/common/src/types/args/mod.rs:384): 10 retries, 1 s apart (#3903). Over WebSocket the CLI waits 60 s, and over QUIC it waits about 100 s per attempt.
  • Server down, wrong password, "not found" and "already exists" all exit with code 1, so a script cannot tell them apart.

Proposal

  • On a TTY, show what a destructive command will delete, and ask for y. Add -y, --yes to each of these commands. If stdin is not a TTY, keep the current behavior.
  • Add --if-not-exists to stream create, topic create, consumer-group create and user create. Add --if-exists to the matching delete commands and to pat delete. Treat the "already exists" or "not found" error of the server as success. A check before the call can race with another client.
  • Add --connect-timeout (for example 5s) for the connection and the login on every transport. The retries then run inside this time. The timeout also covers a login that gets no reply (#4262).
  • Print the error and its cause chain instead of the Debug value (core/cli/src/main.rs:359). The top-level Display is only a label, for example "Iggy client error".
  • Add distinct exit codes for connection, authentication, "not found" and "already exists" errors. Do not use 2 (clap usage errors) or 101 (panics).

Notes

  • A script that starts from a terminal also has a TTY on stdin, so the prompt is a breaking change for it.
  • With --if-not-exists, user create keeps the old password of an existing user. pat create gets no such flag, because it cannot print the token of an existing PAT.
  • The partition and segment commands take a count, so the new flags do not apply to them.
  • While #3735 is open, the error details stay empty. For example, the CLI prints "Stream with ID: 0 was not found." for a missing stream.
主要言語
Rust
スター
5.3k
フォーク
548
平均マージ
2日 20時間
マージ済み PR(30日)
194

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

apache/iggy のほかの issue

apache/iggy の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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