Skip to content

[Code Quality] Refactor pass on files exceeding 500 LOC (up 44% over 30 days, 525 -> 756) #49019

Description

@github-actions

Description

The Daily Code Metrics Report - 2026-07-29 flagged that files over 500 LOC grew 44% over the last 30 days (525 -> 756 files), signalling growing complexity/size in a subset of files. This is called out as the top actionable recommendation in that report. A related but narrower issue (#48621, still open) covers pkg/workflow/awf_helpers.go specifically; this issue is for a broader triage/refactor pass across the top offenders repo-wide.

Suggested Changes

  • Run a repo-wide scan (e.g. find pkg -name *.go | xargs wc -l | sort -rn | head -30, restricted to non-generated/non-test Go source) to identify the largest files by LOC
  • Cross-check against already-tracked large-file issues (e.g. [file-diet] Refactor: pkg/workflow/awf_helpers.go exceeds 800 lines (1131 LOC) #48621) to avoid duplicate work
  • Pick the top 3-5 largest, actively-churned pkg/ files not already covered by an open issue and split them into smaller, single-responsibility files/functions
  • Add or update unit tests for extracted units to preserve behavior

Files Affected

  • Top offenders in pkg/ per the LOC scan above (exact file list to be determined by the scan since the report only gives aggregate counts)

Success Criteria

  • At least 3 of the largest non-generated Go files are split into smaller, cohesive units (<500 LOC each) or their growth justified/documented
  • All existing tests pass; new tests added for extracted units
  • No behavior change (verified via existing test suite)

Source

Extracted from Daily Code Metrics Report - 2026-07-29 (discussion #48968)

Priority

Medium - Addresses a clear negative trend (44% growth in large files) called out as the report's top recommendation.

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · aut00 · 53.4 AIC · ⌖ 7.34 AIC · ⊞ 10.2K ·

  • expires on Jul 30, 2026, 5:15 PM UTC-08:00

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