CLI: connectivity check prints diagnostics to stdout, breaking piped output
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
check_connectivity() とその呼び出し元である @test_connection を collectoss/application/cli/__init__.py で確認し부터始めます。Issue の Python 再現コマンドを実行して、stdout の診断出力と traceback を観察します。成功したチェックでは stdout がクリーンなままであること、失敗したチェックでは診断出力が stderr または logging 経由で報告されること、エラーメッセージで捕捉した例外が使用されることを確認します。プロジェクトの既存のテスト構造がそれを提供している場合は、対象を絞った CLI テストを追加または更新します。
索引モデルが issue の本文から書いたものです。
説明
Description:
check_connectivity() in collectoss/application/cli/__init__.py (used by @test_connection) reports failures with print(), so they go to stdout. It prints for every failed URL even when a later URL succeeds and the command runs normally, and for network/protocol errors it also prints a full traceback. This puts stray lines at the top of a working command's stdout and breaks piping, e.g. JSON output. The "no way to get connection to the database" error also goes to stdout.
Also, the network/protocol error messages print the exception class ({httpx.NetworkError}) instead of the caught exception ({e}).
Question for maintainers: is CLI output a stable API surface, and should diagnostics go to stderr? Found while working on #547 .
How to reproduce:
Run, with the first URL unreachable and the second reachable: uv run python -c “from collectoss.application.cli import check_connectivity as c; c([‘http://10.255.255.1','http://github.com’])” 2>/dev/null
stdout gets Connectivity test Request 0 Network Error: <class 'httpx.NetworkError'> plus a traceback, even though the function returns True. In normal use this happens when any of chaoss.community, github.com or gitlab.com is slow or unreachable.
Expected behavior:
Diagnostics go to stderr (or logging), and only when the check actually fails, so collectoss <command> > out.json gives valid output. Error messages include the caught exception.
Screenshots
N/A
Log files
Full output (~55 lines):
Software versions:
- CollectOSS: 4027f1212
- OS: macOS 12.6.7 (21G651)
- Browser: N/A
- 主要言語
- Python
- スター
- 17
- フォーク
- 27
- 平均マージ
- 3日 10時間
- マージ済み PR(30日)
- 10
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
chaoss/CollectOSS のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
chaoss/CollectOSS#521 ·
メンテナーはふだん 1 日以内に返信
-
mask keys by default when checking API key expiry対応中かも @iGufrankhan が 111 日前に担当しました。 オープンchallenging first issue CLI
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
chaoss/CollectOSS#414 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
challenging first issue CLI
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
chaoss/CollectOSS#413 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Output current time alongside API key reset time対応中かも @Dipro-cyber が 117 日前に担当しました。 オープンCLI good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
chaoss/CollectOSS#412 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
devops
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
chaoss/CollectOSS#406 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
chaoss/CollectOSS の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
pgvector/pgvector-python#169 ·
-
ChaosEngine: backup-remote doctor row passes while consumer mode hides bot memory from git対応中かも @MohabMohie が今日担当しました。 オープンagentic
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ShaftHQ/SHAFT_ENGINE#7263 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 87/100
huggingface/smolagents#3045 ·
メンテナーはふだん 1 日以内に返信