darnit audit silently resolves upstream and never prints the audited repo

Aperta Adatta ai principianti
#344 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Inizia da packages/darnit/src/darnit/core/utils.py, in particolare da detect_repo_from_git e detect_owner_repo, poi trova cmd_audit e il relativo log di audit attuale. Mantieni la sorgente remota rilevata durante la risoluzione del repository e includi l’owner/repo risolto e la sorgente nell’output dell’audit. Esegui i test pertinenti della CLI di audit; il lavoro è concluso quando gli utenti possono vedere quale repository e quale sorgente remota sono stati sottoposti ad audit.

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

Descrizione

module-baseline

Description

darnit audit <path> auto-detects owner/repo preferring the upstream remote, and never prints which owner/repo it resolved. On a fork checkout (both origin and upstream present), the live checks target upstream — potentially a different repo than the one the user is working in — with no indication in the output.

Steps to Reproduce

  1. Clone a fork so the checkout has both origin (your fork) and upstream remotes.
  2. Run darnit audit <path> with authenticated gh.
  3. Inspect which owner/repo the live gh api checks target.

Expected Behavior

The audit output states the resolved owner/repo and which remote it came from, so it's obvious which repository was audited.

Actual Behavior

The checks target upstream silently; the CLI logs only Auditing {path} with {N} controls. Details:

  • packages/darnit/src/darnit/core/utils.py:186, :302 — prefer_upstream: bool = True.
  • utils.py:231 — remotes = ["upstream", "origin"] if prefer_upstream else ["origin", "upstream"].
  • cmd_audit calls detect_owner_repo(str(repo_path)) with no override and prints no repo identity.

The information already exists internally: detect_repo_from_git returns a source field (utils.py:263, 275), but the detect_owner_repo wrapper (:299) collapses it to (owner, repo) and the CLI discards it.

Environment

  • darnit version: main @ 86f9cfa
  • Python version: 3.12 (uv-managed)
  • OS: any

Additional Context

Suggested fix (visibility only): print the resolved owner/repo + source remote at the top of audit output. A new --owner/--repo flag is likely unnecessary — the origin-preference path (prefer_upstream=False) already resolves origin correctly.

Lingua principale
Python
Stelle
22
Fork
27
Merge medio
4g 20h
PR unite (30g)
75

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 darnitdevorg/darnit

Tutte le issue di darnitdevorg/darnit

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.