Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

CLI: connectivity check prints diagnostics to stdout, breaking piped output

Aperta Adatta ai principianti
#548 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
cli

Direzione di ricerca

Inizia da check_connectivity() e dal suo chiamante @test_connection in collectoss/application/cli/__init__.py; esegui il comando di riproduzione Python dell'issue per osservare la diagnostica su stdout e il traceback. Verifica che i controlli riusciti mantengano stdout pulito, che i controlli falliti riportino la diagnostica su stderr o tramite logging e che i messaggi di errore utilizzino l'eccezione catturata; aggiungi o aggiorna test CLI mirati se la struttura dei test esistente del progetto li prevede.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Python
Stelle
17
Fork
27
Merge medio
3g 10h
PR unite (30g)
10

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di chaoss/CollectOSS

Tutte le issue di chaoss/CollectOSS

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.