Repository Quality Report: Test Classification & Build Tag Hygiene (2026-03-16) #21237
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Repository Quality Improvement Agent. A newer discussion is available at Discussion #21398. |
Beta Was this translation helpful? Give feedback.
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 — Test Classification & Build Tag Hygiene
Analysis Date: 2026-03-16
Focus Area: Test Classification & Build Tag Hygiene
Strategy Type: Custom (first run — no prior history)
Custom Area: Yes —
gh-awenforces a mandatory//go:buildtag convention for all test files. The AGENTS.md explicitly documents this requirement and notes it has caused CI failures. This analysis quantifies compliance and identifies the remaining violations.Executive Summary
Of 942 test files in
pkg/andcmd/, 5 files (0.5%) are missing required build tags. While the compliance rate is strong, these 5 files can cause subtle CI failures: tests may run in the wrong environment (unit vs integration), or the build tag enforcement script may silently mis-classify shared helpers. Two of the missing-tag files are shared test helpers whose comment documentation claims they are "used by both unit and integration tests" — yet without a tag they are excluded from integration test builds under the current convention.Overall test investment is excellent: 304,295 lines of test code vs 133,672 lines of source code (2.27× test-to-source ratio). The
anymigration is complete (0 remaininginterface{}occurrences), and only 9 TODO/FIXME comments remain in production code. The focus area for immediate action is the missing build tags.Full Analysis Report
Focus Area: Test Classification & Build Tag Hygiene
Current State Assessment
*.go, non-test)interface{}occurrencesFindings
Strengths
anymigration — zero remaininginterface{}occurrencesAreas for Improvement
//go:buildtags — these violate the mandatory project convention and can silently include/exclude tests from wrong test runstest_helpers_shared_test.go(workflow) andtest_helpers_git_test.go(cli) both self-describe as "shared between unit and integration tests" but naming convention routes them to//go:build !integration, making them inaccessible to integration testspkg/constants/constants.gois 1,031 lines — significantly exceeds the 300-line refactoring guideline; may benefit from domain-based splittingplugin_installation.go— validate CLI plugin install command syntax for Claude and Codex enginesDetailed Analysis
Missing Build Tags — File List:
pkg/workflow/enable_api_proxy_test.goTestEngineAWFEnableApiProxy)//go:build !integrationpkg/workflow/docker_api_proxy_test.goTestCollectDockerImages_APIProxyForEnginesWithLLMGateway)//go:build !integrationpkg/workflow/test_helpers_shared_test.goboolPtr()— "shared by unit and integration"pkg/cli/test_helpers_git_test.goinitTestGitRepo()— "shared by unit and integration"pkg/cli/codemod_activation_outputs_test.goTestActivationOutputsCodemod)//go:build !integrationShared Helper Conflict:
The comments in
test_helpers_shared_test.goandtest_helpers_git_test.goboth state they are "shared helper[s] used by both unit and integration tests." Under the current naming convention, they would receive//go:build !integration, which would exclude them from integration test builds — contradicting their stated intent. These files either need://go:build !integration || integration(no-op, equivalent to no tag — but satisfies the "must have a tag" rule visually), orintegrationin their filename (making them integration-only, but then unit tests can't use them), ortestutilpackageLarge File Analysis (top 5):
pkg/constants/constants.gopkg/cli/trial_command.gopkg/cli/gateway_logs.gopkg/workflow/checkout_manager.gopkg/cli/logs_report.go🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: The following tasks are designed for GitHub Copilot coding agent execution. Please split these into individual GitHub issues for Claude to process one at a time.
Improvement Tasks
Task 1: Add Missing Build Tags to Pure Unit Test Files
Priority: High
Estimated Effort: Small
Focus Area: Test Classification & Build Tag Hygiene
Description:
Three test files that contain actual test functions (not shared helpers) are missing the mandatory
//go:build !integrationtag required by the project convention. These files contain pure unit tests with no integration dependencies.Files to fix:
pkg/workflow/enable_api_proxy_test.gopkg/workflow/docker_api_proxy_test.gopkg/cli/codemod_activation_outputs_test.goAcceptance Criteria:
//go:build !integrationfollowed by a blank linemake test-unitstill passes for all three filesmake lintpasses with no new issuesmake agent-finishcompletes without errorsCode Region:
pkg/workflow/enable_api_proxy_test.go,pkg/workflow/docker_api_proxy_test.go,pkg/cli/codemod_activation_outputs_test.goTask 2: Resolve Shared Test Helper Build Tag Ambiguity
Priority: Medium
Estimated Effort: Medium
Focus Area: Test Classification & Build Tag Hygiene
Description:
Two test helper files describe themselves as "shared by both unit and integration tests" but lack any build tag. The current naming convention would assign
//go:build !integration(since their names don't contain "integration"), which would exclude them from integration test builds — contradicting their purpose.Files involved:
pkg/workflow/test_helpers_shared_test.go— providesboolPtr()helperpkg/cli/test_helpers_git_test.go— providesinitTestGitRepo()helperAcceptance Criteria:
make test-unitmake testmake agent-finishcompletes without errorsRecommended approach:
If these helpers are genuinely needed by both unit and integration tests, use
//go:build !integration || integrationwhich satisfies the "must have a tag" convention while compiling under both modes. If they are only used by unit tests, use//go:build !integration.Code Region:
pkg/workflow/test_helpers_shared_test.go,pkg/cli/test_helpers_git_test.goTask 3: Split
pkg/constants/constants.goby DomainPriority: Medium
Estimated Effort: Large
Focus Area: Code Organization
Description:
pkg/constants/constants.gois 1,031 lines — more than 3× the 300-line refactoring guideline documented in AGENTS.md. All constants are in a single file, making navigation and comprehension difficult as the project grows. The file contains multiple distinct semantic type groups:LineLength,Version,FeatureFlag,URL,ModelName,JobName,StepID,CommandPrefix,WorkflowID,EngineName, and more.Acceptance Criteria:
constants.gois split into multiple domain-specific files withinpkg/constants/make test-unitpassesmake lintpassesmake agent-finishcompletes without errorsSuggested split:
constants_engine.go—EngineNametype and engine constantsconstants_workflow.go—WorkflowID,JobName,StepID,CommandPrefixconstants_versions.go—Version,ModelName, runtime version constantsconstants_features.go—FeatureFlagtype and feature flag constantsconstants_network.go—URLtype and URL/network constantsconstants_limits.go—LineLengthand numeric limit constantsCode Region:
pkg/constants/constants.goTask 4: Resolve TODO Comments in Plugin Installation Validation
Priority: Low
Estimated Effort: Small
Focus Area: Code Quality / Technical Debt
Description:
pkg/workflow/plugin_installation.gocontains two TODO comments (lines 69 and 72) for validating the correct CLI plugin install command syntax for Claude and Codex engines. These represent incomplete validation logic that could allow incorrect plugin install configurations to pass validation silently.Acceptance Criteria:
make agent-finishcompletes without errorsCode Region:
pkg/workflow/plugin_installation.golines 69-72📊 Historical Context
Previous Focus Areas
This is the first run. History will grow over subsequent analyses.
🎯 Recommendations
Immediate Actions (This Week)
//go:build !integrationtags — Task 1 — Priority: Hightest_helpers_shared_test.goandtest_helpers_git_test.go— Task 2 — Priority: MediumShort-term Actions (This Month)
pkg/constants/constants.gointo domain-specific files — Task 3 — Priority: Mediumplugin_installation.go— Task 4 — Priority: LowLong-term Actions (This Quarter)
trial_command.go,gateway_logs.go,checkout_manager.go) for decomposition opportunities📈 Success Metrics
Track these metrics to measure improvement in Test Classification & Build Tag Hygiene:
pkg/constants/constants.goline count: 1,031 → ≤300 per fileNext Steps
References:
§23146230957
Beta Was this translation helpful? Give feedback.
All reactions