Skip to content

[Code Quality] Consolidate ProcessedRun/RunSummary/DownloadResult near-duplicate carrier structs in pkg/cli/logs_models.go #47439

Description

@github-actions

Description

Three structs in pkg/cli/logs_models.go share the same ~16-field analysis core (Run, AwContext, TaskDomain, BehaviorFingerprint, AgenticAssessments, AccessAnalysis, FirewallAnalysis, RedactedDomains, etc.): ProcessedRun (line 97), RunSummary (line 213), and DownloadResult (line 239). This is the largest copy-paste block in pkg/cli according to the Typist analysis.

Suggested Changes

  • Extract a shared embedded base struct (e.g., RunAnalysisBase) containing the common ~16 fields
  • Have ProcessedRun, RunSummary, and DownloadResult embed RunAnalysisBase
  • Update all field access callsites (no behavior change, just restructuring)
  • Add a test asserting the struct composition to prevent future drift

Files Affected

  • pkg/cli/logs_models.go (lines 97, 213, 239)
  • Related test/usage files in pkg/cli/

Success Criteria

  • Single RunAnalysisBase struct contains the shared fields
  • ProcessedRun, RunSummary, DownloadResult embed it
  • No behavioral changes; all existing tests pass
  • Cyclomatic complexity and duplication score improve

Source

Extracted from [typist] Go Type Consistency Analysis #47292

Priority

Medium — removes largest copy-paste block in pkg/cli, reduces drift risk

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · sonnet46 38.9 AIC · ⌖ 8.11 AIC · ⊞ 7.1K ·

  • expires on Jul 23, 2026, 5:19 PM UTC-08:00

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions