Skip to content

[deep-report] Add io.Writer parameter to renderLogs* formatters in pkg/cli/ (kill captureOutput OS-swap) #47343

Description

@github-actions

Description

The six core renderLogs* formatters in pkg/cli/ (renderLogsTSV, renderLogsTSVVerbose, renderLogsCompact, renderLogsCompactVerbose, renderLogsJSON, renderLogsConsole) write directly to os.Stdout with no io.Writer parameter. Tests work around this via a captureOutput helper that swaps os.Stdout at the OS level and is annotated as unsafe for t.Parallel(). The correct pattern already exists in audit_cross_run_render.go (renderCrossRunReportMarkdownToWriter(w io.Writer, ...)) — extend it to the log formatters.

Expected Impact

Eliminates the captureOutput OS-pipe mutex, enables t.Parallel() across 5 formatter test files, allows callers to redirect output (cmd.OutOrStdout()), and aligns the log-rendering subsystem with the existing ...ToWriter convention. ~167 hardcoded os.Stdout refs in the package, concentrated in logs_format_compact.go (39) and logs_format_tsv.go (12).

Suggested Agent

Repository Quality Improvement / Code Simplifier, or a Copilot SWE Agent PR.

Estimated Effort

Medium (1-4 hours)

Data Source

DeepReport 2026-07-22 analysis of Repository Quality report #47310.

Generated by 🔬 Deep Report · age00 213.6 AIC · ⌖ 11 AIC · ⊞ 10.3K ·

  • expires on Jul 24, 2026, 7:26 AM UTC-08:00

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions