[repository-quality] 🎯 Repository Quality Improvement Report - Test File Bloat & Organization #53697
Closed
Replies: 1 comment
|
This discussion was automatically closed because it expired on 2026-08-19T13:14:08.108Z.
|
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.
Analysis Date: 2026-08-18
Focus Area: Test File Bloat (custom, refining the "Code Organization" standard category)
Strategy Type: Custom
Custom Area: Yes — the repo's own
developer-code-organizationskill mandates files of 100–500 lines (800+ only for "core infrastructure"), yet 30 test files exceed 1,500 lines and 17 exceed 2,000 lines, withcompiler_jobs_test.goat 4,511 lines. This is a self-inflicted violation of the project's own documented convention, worth surfacing explicitly rather than a generic "Testing" pass.Executive Summary
gh-awhas an unusually high test-to-source ratio (539,581 test LOC vs 275,701 source LOC, ~2:1), which is generally healthy, but a large share of that test code has accumulated into a small number of monolithic files. Eight test files exceed 2,400 lines each, led bypkg/workflow/compiler_jobs_test.go(4,511 lines / 84 test functions),compiler_safe_outputs_config_test.go(3,836 lines / 48 funcs), andthreat_detection_test.go(3,420 lines / 61 funcs). These sizes far exceed the repo's own file-size guideline ("Large files: 500-800 lines... Very large files: 800+ core infrastructure only"), and none of this is core infrastructure — it's flat test-case enumeration that could be split along natural feature/scenario boundaries the same wayfrontmatter.gowas previously refactored (documented as a case study in thedeveloper-code-organizationskill).Splitting these files by functional area (e.g. by job type, safe-output kind, or threat category) would reduce merge-conflict risk on high-traffic files, speed up editor/LSP responsiveness, and make it far easier for both humans and Copilot coding agents to locate the right test when fixing a bug. Non-test source files are in comparatively good shape (only 15 files over 1,000 lines, and most of those —
compiler.go,workflow_builder.go, etc. — are legitimately core infrastructure), so this report focuses tasks on the highest-impact test-file splits.Full Analysis Report
Focus Area: Test File Bloat & Organization
Current State Assessment
Ran line-count and function-count analysis across all
*_test.gofiles (excluding vendor) plus a comparison against the repo's own file-size guidance in.github/skills/developer-code-organization/SKILL.md.Metrics Collected:
pkg/workflow/compiler_jobs_test.go(4,511 lines, 84 funcs)Findings
Strengths
frontmatter.go→ 5 focused files), which can be directly reused for test files.Areas for Improvement
pkg/workflow/compiler_jobs_test.go(4,511 lines / 84 test funcs) is 5.6× the "large file" ceiling (800 lines) and has no sub-file organization by job type.pkg/workflow/compiler_safe_outputs_config_test.go(3,836 lines / 48 funcs) mixes config validation tests for many unrelated safe-output types in one file.pkg/workflow/threat_detection_test.go(3,420 lines / 61 funcs),pkg/workflow/copilot_engine_test.go(3,311 lines / 57 funcs), andpkg/workflow/maintenance_workflow_test.go(3,076 lines / 31 funcs) all show the same monolithic pattern.pkg/parser/schema_test.go(2,892 lines),pkg/cli/remote_workflow_test.go(2,707 lines), andpkg/workflow/safe_outputs_import_test.go(2,411 lines) are close behind and will keep growing without a splitting convention.feature_a_test.go,feature_b_test.go), so future contributors may default back to appending to the existing large file rather than creating a new one.Detailed Analysis
Using
wc -landgrep -c '^func Test'across all*_test.gofiles (vendor excluded), the eight largest test files account for over 26,000 lines and 393 test functions combined — roughly 5% of the repo's total test LOC concentrated in 8 files out of thousands. Each of these files groups tests by broad subsystem (all compiler job tests, all safe-outputs config tests, all threat-detection tests) rather than by narrower feature boundary, which is exactly the anti-pattern the repo's owndeveloper-code-organizationskill warns against ("Avoid: models.go / logic.go / tests.go — all business logic in one file"). Splitting along sub-feature boundaries (e.g., one file per job type withincompiler_jobs_test.go, one file per safe-output kind withincompiler_safe_outputs_config_test.go) mirrors the existing "Create Functions Pattern" already used for non-test code (create_issue.go,create_pull_request.go, etc.) and would bring these files back under the 800-line guideline without changing any test semantics or reducing coverage.🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Split
compiler_jobs_test.goby job typePriority: High
Estimated Effort: Large
Focus Area: Test File Bloat
Description:
pkg/workflow/compiler_jobs_test.gois 4,511 lines with 84 test functions covering many distinct job types (activation jobs, safe-output jobs, pre-activation jobs, etc.). Split it into multiple files grouped by job type/feature, following the naming conventioncompiler_jobs_<subfeature>_test.go, mirroring the existing "Create Functions Pattern" used for non-test files.Acceptance Criteria:
go test ./pkg/workflow/...passes with no regressionscompiler_jobs_test_helpers.goif duplicated across new filesCode Region:
pkg/workflow/compiler_jobs_test.goTask 2: Split
compiler_safe_outputs_config_test.goby safe-output typePriority: High
Estimated Effort: Large
Focus Area: Test File Bloat
Description:
pkg/workflow/compiler_safe_outputs_config_test.go(3,836 lines, 48 test functions) validates configuration for many different safe-output types in a single file. Split by safe-output kind (e.g., create-issue config tests, create-pull-request config tests, add-comment config tests) into separate files.Acceptance Criteria:
go test ./pkg/workflow/...passes with no regressionscompiler_safe_outputs_config_<type>_test.goconventionCode Region:
pkg/workflow/compiler_safe_outputs_config_test.goTask 3: Split
threat_detection_test.goby detection categoryPriority: Medium
Estimated Effort: Medium
Focus Area: Test File Bloat
Description:
pkg/workflow/threat_detection_test.go(3,420 lines, 61 test functions) covers many distinct threat/detection categories. Split into files by detection category (e.g., prompt injection detection, secret leakage detection, malicious tool-call detection).Acceptance Criteria:
go test ./pkg/workflow/...passes with no regressionsCode Region:
pkg/workflow/threat_detection_test.goTask 4: Split
copilot_engine_test.goandmaintenance_workflow_test.goPriority: Medium
Estimated Effort: Medium
Focus Area: Test File Bloat
Description:
pkg/workflow/copilot_engine_test.go(3,311 lines, 57 funcs) andpkg/workflow/maintenance_workflow_test.go(3,076 lines, 31 funcs) are both well over the "very large" 800-line threshold reserved for core infrastructure only — these are test files, not infra. Split each by sub-feature (e.g., copilot engine: prompt building, tool config, MCP wiring; maintenance workflow: scheduling, cleanup, reporting).Acceptance Criteria:
go test ./pkg/workflow/...passes with no regressionsCode Region:
pkg/workflow/copilot_engine_test.go,pkg/workflow/maintenance_workflow_test.goTask 5: Document a test-file-splitting convention in the code organization skill
Priority: Low
Estimated Effort: Small
Focus Area: Test File Bloat / Process
Description: Add explicit guidance to
.github/skills/developer-code-organization/SKILL.mddescribing when and how to split large*_test.gofiles (naming convention, shared-helper extraction pattern), so future contributors have a documented pattern to follow instead of appending to already-oversized files.Acceptance Criteria:
<feature>_<subfeature>_test.gonaming convention<feature>_test_helpers.goCode Region:
.github/skills/developer-code-organization/SKILL.md📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
compiler_jobs_test.goandcompiler_safe_outputs_config_test.go(the two largest offenders) — Priority: HighShort-term Actions (This Month)
threat_detection_test.go,copilot_engine_test.go, andmaintenance_workflow_test.go— Priority: MediumLong-term Actions (This Quarter)
📈 Success Metrics
Next Steps
Generated by Repository Quality Improvement Agent
Next analysis: 2026-08-19 — Focus area selected by diversity algorithm
All reactions