Skip to content

fix(cli): suppress library warning noise in tracker audit / run listing / tracker diagnose#121

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/fix-suppress-library-stderr-warnings
Closed

fix(cli): suppress library warning noise in tracker audit / run listing / tracker diagnose#121
Copilot wants to merge 2 commits intomainfrom
copilot/fix-suppress-library-stderr-warnings

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

Phase 2 library extraction introduced new non-fatal stderr warnings from library internals that now leak into user-facing CLI commands (tracker audit/listing and tracker diagnose) on stale or corrupted run artifacts. This restores prior CLI UX while keeping library-level warning surfacing configurable for non-CLI consumers.

  • Library API: configurable warning sink

    • Added ListRunsWithConfig(workdir, ListRunsConfig) with ListRunsConfig.LogWriter.
    • Added DiagnoseWithConfig(runDir, DiagnoseConfig) and DiagnoseMostRecentWithConfig(workdir, DiagnoseConfig) with DiagnoseConfig.LogWriter.
    • Existing entry points (ListRuns, Diagnose, DiagnoseMostRecent) remain, defaulting nil writer to os.Stderr to preserve library behavior.
  • CLI: explicit suppression for user-facing commands

    • cmd/tracker/audit.go now calls ListRunsWithConfig(..., LogWriter: io.Discard).
    • cmd/tracker/diagnose.go now calls DiagnoseWithConfig / DiagnoseMostRecentWithConfig with LogWriter: io.Discard.
    • Result: non-fatal parsing/read warnings no longer appear as CLI stderr noise.
  • Regression coverage

    • Added focused tests to verify:
      • library warning emission through custom writers
      • CLI stderr suppression when artifact files are unreadable/malformed but processing continues
  • Docs

    • Updated CHANGELOG.md (Unreleased / Fixed) to reflect CLI warning suppression and new configurable log-writer behavior.
// CLI path: suppress non-fatal library warnings for end users.
report, err := tracker.DiagnoseWithConfig(runDir, tracker.DiagnoseConfig{
    LogWriter: io.Discard,
})

Copilot AI changed the title [WIP] Fix CLI to suppress library stderr warnings in tracker audit/list/diagnose fix(cli): suppress library warning noise in tracker audit / run listing / tracker diagnose Apr 20, 2026
Copilot AI requested a review from clintecker April 20, 2026 15:58
@clintecker clintecker requested a review from Copilot April 20, 2026 16:25
@clintecker clintecker marked this pull request as ready for review April 20, 2026 16:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores prior CLI UX by suppressing non-fatal library-originated warning output on stderr for user-facing commands (tracker audit run listing and tracker diagnose), while keeping the library’s default warning behavior and making the warning sink configurable for non-CLI consumers.

Changes:

  • Added ListRunsWithConfig/ListRunsConfig{LogWriter} and DiagnoseWithConfig/DiagnoseMostRecentWithConfig/DiagnoseConfig{LogWriter} to route non-fatal warnings to a configurable io.Writer (defaulting to os.Stderr).
  • Updated CLI commands to pass io.Discard so library warnings don’t leak into CLI stderr.
  • Added regression tests covering library warning routing and CLI stderr suppression; updated changelog.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tracker_audit.go Introduces ListRunsWithConfig + ListRunsConfig.LogWriter and routes listing warnings through the configured writer.
tracker_diagnose.go Introduces DiagnoseWithConfig/DiagnoseMostRecentWithConfig + DiagnoseConfig.LogWriter and routes malformed status.json warnings through the configured writer.
tracker_audit_test.go Adds a focused unit test verifying warnings are emitted via a custom writer when activity log is unreadable.
tracker_diagnose_test.go Adds a focused unit test verifying warnings are emitted via a custom writer when status.json is malformed.
cmd/tracker/audit.go Switches run listing to ListRunsWithConfig(..., LogWriter: io.Discard) to suppress stderr noise.
cmd/tracker/diagnose.go Switches diagnose paths to DiagnoseWithConfig / DiagnoseMostRecentWithConfig with io.Discard.
cmd/tracker/audit_test.go Adds an integration-style test ensuring listing still works and library warnings are suppressed on stderr.
cmd/tracker/diagnose_test.go Adds an integration-style test ensuring diagnose still prints output and suppresses library warnings on stderr.
CHANGELOG.md Documents the CLI warning suppression and new configurable log-writer behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@clintecker
Copy link
Copy Markdown
Collaborator

Superseded by merged #113, which added AuditConfig.LogWriter and DiagnoseConfig.LogWriter (nil → io.Discard), and the CLI (cmd/tracker/audit.go, cmd/tracker/diagnose.go) now passes io.Discard to silence library warnings for user-facing commands. Closes issue #104 via #113.

@clintecker clintecker closed this Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): suppress library stderr warnings in tracker audit/list/diagnose

3 participants