Skip to content

darnit audit silently resolves upstream and never prints the audited repo #344

Description

@justaugustus

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, :302prefer_upstream: bool = True.
  • utils.py:231remotes = ["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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions