Repository navigation
[repository-quality] 🎯 Repository Quality Improvement Report - Large File Decomposition in pkg/workflow #53391
Closed
Replies: 1 comment
|
This discussion has been marked as outdated by Repository Quality Improvement Agent. A newer discussion is available at Discussion #53697. |
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 File Decomposition in
pkg/workflowAnalysis Date: 2026-08-17
Focus Area: Large File Decomposition (Code Organization, custom variant)
Strategy Type: Custom
Custom Area: Yes —
pkg/workflowis the compiler's core package (479 non-test Go files, 275,630 source LOC) and is the most actively evolved part of gh-aw. The repo's owndeveloper-code-organizationskill emphasizes splitting large files by responsibility, but no automated check enforces this, so several files have grown past a size where they're easy to review or safely modify. Targeting this now reduces future review friction and merge-conflict risk as the compiler keeps growing.Executive Summary
pkg/workflowcontains 14 files over 800 lines, several combining multiple responsibilities (parsing, validation, string/YAML generation, and compiler orchestration) in one file. The three largest —compiler_custom_jobs.go(1142 lines, 37 funcs),cache.go(1118 lines, 36 funcs), anddependabot.go(1072 lines, 33 funcs) — each mix distinct sub-domains: for example,cache.gocombines cache-memory config parsing, generic cache step YAML generation, and cache-memory step/job generation;dependabot.gocombines npm/pip/go manifest generation with dependabot.yml reconciliation logic.Splitting these files along their existing functional seams (which are already visible from function naming, e.g.
parseCacheMemory*vswriteCacheStep*vsgenerateCacheMemory*) would let contributors and Copilot review/modify one concern without wading through unrelated code, and reduces the blast radius of future changes. This is a mechanical, low-risk refactor: pure code movement with no behavior change, verified bymake test-unitandmake build.We recommend prioritizing
cache.goanddependabot.gofirst since their internal seams are the cleanest (parsing vs YAML-writing vs job-building), followed bycompiler_custom_jobs.go, and finally addressing the other 11 files >800 lines as a follow-up sweep.Full Analysis Report
Focus Area: Large File Decomposition in
pkg/workflowCurrent State Assessment
pkg/workflowis the largest and most frequently modified package in gh-aw, holding the markdown-to-YAML compiler core. As the compiler has grown feature-by-feature (custom jobs, cache memory, dependabot manifests, safe-outputs handlers, triggers, etc.), several files have accreted multiple unrelated responsibilities rather than being split when they crossed common size thresholds (500–800 lines).Metrics Collected:
Findings
Strengths
pkg/workflow(260 lines) is healthy; the problem is concentrated in a small number of outlier files (14 of 479, ~3%).parseCacheMemory*,writeCacheStep*,generateCacheMemory*,generate*Manifests,reconcile*) already reveals natural split boundaries — this is a low-risk, mechanical refactor.Areas for Improvement
pkg/workflow/cache.go(1118 lines, 36 funcs) mixes three concerns: cache-memory config parsing (parseCacheMemory*, lines 134–297), genericcache:step YAML generation (generateCacheSteps,writeCacheStep*, lines 384–521), and cache-memory-specific step/job generation (generateCacheMemory*,buildUpdateCacheMemoryJob, lines 530–1010+).pkg/workflow/dependabot.go(1072 lines, 33 funcs) mixes ecosystem-specific manifest generation (npm/pip/go, lines 137–1044) withdependabot.ymlreconciliation logic (ReconcileManagedDependabotIgnores*, lines 493–719) — two largely independent concerns sharing one file.pkg/workflow/compiler_custom_jobs.go(1142 lines, 37 funcs) mixes custom-job property extraction (extractCustomJob*, lines 173–433), built-in job augmentation (applyBuiltinJob*,extractBuiltinJob*, lines 598–984), and pinned-step/checkout helpers (lines 1068–1142).safe_outputs_handler_registry.go,compiler_safe_outputs_job.go,workflow_builder.go,trigger_parser.go,awf_config.go,domains.go,behavior_defined_engine.go,compiler_pre_activation_job.go,observability_otlp.go,tools_parser.go,markdown_security_scanner.go) also exceed 800 lines but weren't deep-dived in this pass; worth a follow-up sweep.Detailed Analysis
No automated lint currently flags file size or single-responsibility violations in this codebase (only
go vet/custom linters pergo-lintersskill are wired up). Becausepkg/workflowchanges weekly (compiler is under active development), oversized files compound: every new feature has an incentive to append to the nearest existing file rather than create a new one, since the existing large files already "own" the relevant struct/helper. Splitting the three worst offenders now, along their pre-existing functional seams, arrests this trend before the files grow further and makes room for a lightweight follow-up convention (e.g., a soft file-size guideline indeveloper-code-organizationskill or a CI warning).🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Split
pkg/workflow/cache.gointo config-parsing, generic-cache, and cache-memory filesPriority: High
Estimated Effort: Medium
Focus Area: Code Organization
Description:
cache.go(1118 lines) mixes cache-memory config parsing, genericcache:step generation, and cache-memory job/step generation. Split into three files:cache_memory_config.go(config parsing, lines ~42–382),cache_steps.go(generic cache step YAML generation, lines ~384–530), andcache_memory_steps.go(cache-memory-specific step/job generation, lines ~530 end). Keep packageworkflow; move code verbatim withgit mv-style extraction (no logic changes).Acceptance Criteria:
cache.gosplit into 3 new files with no behavior changepkg/workflow/cache_test.go(and related) pass unchangedmake buildandmake test-unitsucceedCode Region:
pkg/workflow/cache.goTask 2: Split
pkg/workflow/dependabot.gointo manifest-generation and ignore-reconciliation filesPriority: High
Estimated Effort: Medium
Focus Area: Code Organization
Description:
dependabot.go(1072 lines) mixes npm/pip/go manifest generation withdependabot.yml"ignore" reconciliation logic. Split intodependabot_manifests.go(ecosystem manifest generation) anddependabot_ignores.go(reconciliation of managed ignore entries), keeping shared types (DependabotConfig,DependabotUpdateEntry) in whichever file is imported by both, or a small shareddependabot_types.go.Acceptance Criteria:
dependabot.gosplit into 2–3 new files with no behavior changepkg/workflow/dependabot_test.goetc.) pass unchangedmake buildandmake test-unitsucceedCode Region:
pkg/workflow/dependabot.goTask 3: Split
pkg/workflow/compiler_custom_jobs.goby extraction / augmentation / pinned-steps concernsPriority: Medium
Estimated Effort: Medium
Focus Area: Code Organization
Description:
compiler_custom_jobs.go(1142 lines) mixes custom-job property extraction, built-in job augmentation, and pinned-step/checkout helpers. Split intocompiler_custom_job_extraction.go,compiler_builtin_job_augmentation.go, andcompiler_pinned_steps.go.Acceptance Criteria:
make buildandmake test-unitsucceedCode Region:
pkg/workflow/compiler_custom_jobs.goTask 4: Audit and split remaining 11 files over 800 lines in
pkg/workflowPriority: Medium
Estimated Effort: Large
Focus Area: Code Organization
Description: Beyond the top 3 files, 11 more files exceed 800 lines:
safe_outputs_handler_registry.go(1082),compiler_safe_outputs_job.go(1065),workflow_builder.go(1059),trigger_parser.go(1023),awf_config.go(1017),domains.go(1014),behavior_defined_engine.go(1002),compiler_pre_activation_job.go(962),observability_otlp.go(942),tools_parser.go(818),markdown_security_scanner.go(804). Each needs its own responsibility audit before splitting.Acceptance Criteria:
make buildandmake test-unitsucceed after any splitsCode Region:
pkg/workflow/{safe_outputs_handler_registry,compiler_safe_outputs_job,workflow_builder,trigger_parser,awf_config,domains,behavior_defined_engine,compiler_pre_activation_job,observability_otlp,tools_parser,markdown_security_scanner}.go📊 Historical Context
Previous Focus Areas
pkg/workflow🎯 Recommendations
Immediate Actions (This Week)
pkg/workflow/cache.gointo 3 responsibility-focused files — Priority: Highpkg/workflow/dependabot.gointo manifest vs. ignore-reconciliation files — Priority: HighShort-term Actions (This Month)
pkg/workflow/compiler_custom_jobs.goalong extraction/augmentation/pinned-steps seams — Priority: MediumLong-term Actions (This Quarter)
developer-code-organizationskill and consider a CI advisory check — Priority: Low📈 Success Metrics
Next Steps
Generated by Repository Quality Improvement Agent
Next analysis: 2026-08-18 — Focus area selected by diversity algorithm
All reactions