Repository navigation
[repository-quality] Repository Quality: Large Source File Decomposition #68439
Closed
Replies: 1 comment
|
This discussion has been marked as outdated by Repository Quality Improvement Agent. A newer discussion is available at Discussion #68700. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
🎯 Repository Quality Improvement Report - Large Source File Decomposition
Analysis Date: 2026-10-13
Focus Area: Large Source File Decomposition
Strategy Type: Custom
Custom Area: Yes — the repo has many 800+ LOC non-test Go files, and the pre-computed metrics show this is the most visible maintainability risk.
Executive Summary
50 non-test Go files under
pkg/exceed 800 lines. The largest,pkg/cli/token_usage_subagent_session.go, is 1427 lines with 45 functions. Several others are over 1000 lines with 36–57 functions each. Test coverage is strong (647K test LOC vs 350K source LOC), so splitting is low-risk. Other metrics are healthy: 38 TODO/FIXME markers and a 462-line README.Recommendation: split the largest files along their cohesive function groups, with no behavior changes. Guard against regrowth with a lint or CI check.
Full Analysis Report
Current State Assessment
Metrics Collected:
Strengths
Areas for Improvement
import_field_extractor.go57,compiler_experiments.go51,token_usage_subagent_session.go45,logs_run_processor.go43.add_workflow_resolution.go(1214 LOC, 38 funcs) andaudit_report.go(1173 LOC, 36 funcs) mix several concerns.🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Split token_usage_subagent_session.go
Priority: High
Estimated Effort: Medium
Focus Area: Code Organization
Description: Break the 1427-line file into cohesive files (parsing, aggregation, reporting).
Acceptance Criteria:
make fmtandmake test-unitpassCode Region:
pkg/cli/token_usage_subagent_session.goTask 2: Split import_field_extractor.go and compiler_experiments.go
Priority: Medium
Estimated Effort: Medium
Focus Area: Code Organization
Description: These have the highest function counts (57 and 51). Group by concern.
Acceptance Criteria:
Code Region:
pkg/parser/import_field_extractor.go,pkg/workflow/compiler_experiments.goTask 3: Split add_workflow_resolution.go and audit_report.go
Priority: Medium
Estimated Effort: Medium
Focus Area: Code Organization
Description: Separate resolution/fetching from validation, and report building from rendering.
Acceptance Criteria:
Code Region:
pkg/cli/add_workflow_resolution.go,pkg/cli/audit_report.goTask 4: Add file-size regression guard
Priority: Low
Estimated Effort: Small
Focus Area: CI/CD
Description: Add a check (script or custom linter) that fails when a new non-test Go file exceeds 1000 LOC. Allowlist existing offenders.
Acceptance Criteria:
make lintor an equivalent targetCode Region:
Makefile,pkg/linters/📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
Short-term Actions (This Month)
Long-term Actions (This Quarter)
📈 Success Metrics
Next Steps
Generated by Repository Quality Improvement Agent
Next analysis: 2026-10-14 — Focus area selected by diversity algorithm
All reactions