Skip to content

[file-diet] Refactor pkg/cli/audit_report.go (1201 lines) #76514

Done

Description

@github-actions

Overview

pkg/cli/audit_report.go has grown to 1201 lines (threshold: 800), mixing data types, audit data assembly, file/manifest extraction, and step-log error scanning.

Current State

  • File: pkg/cli/audit_report.go, 1201 lines, 58 top-level funcs/types
  • Test file: pkg/cli/audit_report_test.go (1930 lines, ratio ~1.6)
Full File Analysis
  • Lines 32-316: ~25 type definitions (AuditData, MetricsData, MCP tool types, display types)
  • Lines 318-634: build* / assembleAuditData pipeline
  • Lines 636-832: downloaded-file and created-item extraction, describeFile, parseDurationString
  • Lines 834-1201: pre-agent step-error scanning (scanWorkflowStepLogs, scanFlatStepLog, scanNestedStepLogs, extractAgentStdioFailureExcerpt, classifyAgentStdioLines, parseStepFilename, stripGHALogTimestamps)

Refactoring Strategy

  1. audit_report_types.go (~290 LOC): all type declarations plus MCPToolSummary sync methods
  2. audit_report.go (~320 LOC): buildAuditData, buildLocalAuditData, buildAudit*, assembleAuditData, logAssembledAuditData, auditEngineConfigWarnings, extractAuditErrors
  3. audit_report_files.go (~200 LOC): extractDownloadedFiles, extractCreatedItemsFromManifest, resolveCreatedItems, describeFile, parseDurationString
  4. audit_step_errors.go (~370 LOC): extractPreAgentStepErrors through stripGHALogTimestamps, including stepLog
Test Coverage Plan

Split audit_report_test.go to mirror new files, then add cases for describeFile unknown names, parseDurationString invalid input, parseStepFilename malformed names, classifyAgentStdioLines edge cases. Target >80% per file.

Implementation Guidelines

  1. Preserve behavior and API (pure moves within package cli).
  2. Move one cluster at a time; run make test-unit after each.
  3. Run make fmt and make lint.

Acceptance Criteria

  • Split into 4 files, each under 500 lines
  • make test-unit, make lint, make build pass
  • Coverage >=80% for new files
  • No public API changes

Priority: Medium. Effort: Small (mostly mechanical).

Generated by 🧹 Daily File Diet · copilot · auto (Claude Sonnet 5.5) · ~20 AIC · ⌖ ~2 AIC · ⊞ 13.3K · ◷

  • expires on Nov 12, 2026, 4:45 AM UTC-08:00

Activity

  1. github-actions commented on Nov 10, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, Copilot will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · pi · gpt50 · ~1 AIC · ⌖ ~2 AIC · ⊞ 11.4K · ◷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions