Repository navigation
[repository-quality] 🎯 Quality Improvement: Validator File Complexity & Documentation (2026-04-29) #29116
Closed
Replies: 1 comment
|
This discussion was automatically closed because it expired on 2026-04-30T13:22:57.884Z.
|
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 - Validator File Complexity
Analysis Date: 2026-04-29
Focus Area: Validator File Complexity & Documentation
Strategy Type: Custom
Custom Area: Yes — gh-aw has 70+ validation files with AGENTS.md-defined size guidelines (100-300 lines, hard limit 300 lines, 30% comment coverage). This run audits adherence.
Executive Summary
A review of the 70+ validation files in
pkg/workflow/andpkg/cli/reveals that 9 files exceed the 300-line hard limit documented in AGENTS.md. Additionally, all sampled files fall below the mandated 30% comment coverage minimum, ranging from 15–22%. These violations make validators harder to navigate, test, and maintain.The most severe case is
compiler_validators.go(465 lines, 4 functions) wherevalidatePermissionsspans over 100 lines and mixes multiple concerns. The project already has excellent patterns for splitting — dozens of focused validator files exist — but several key files have grown beyond those boundaries over time.Full Analysis Report
Focus Area: Validator File Complexity & Documentation
Current State Assessment
Metrics Collected:
compiler_validators.go(465 lines)Files Exceeding Hard Limit (300 lines)
pkg/workflow/compiler_validators.govalidatePermissions~100 linespkg/workflow/safe_outputs_validation_config.gopkg/workflow/permissions_validation.gopkg/cli/run_workflow_validation.gopkg/workflow/repository_features_validation.gopkg/cli/mcp_validation.gopkg/workflow/engine_validation.gopkg/workflow/network_firewall_validation.gopkg/workflow/expression_safety_validation.goComment Coverage (sampled files)
compiler_validators.goengine_validation.gopermissions_validation.gonetwork_firewall_validation.goAll fall below the 30% minimum defined in AGENTS.md validation guidelines.
Findings
Strengths
*_validation.go) make navigation easyAreas for Improvement
compiler_validators.gomixes 4 validation concerns instead of delegating to separate files [HIGH severity]repository_features_validation.gomixes caching infrastructure with validation logic [MEDIUM severity]🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: The following tasks are designed for GitHub Copilot coding agent execution. Please split these into individual work items for the coding agent to process.
Improvement Tasks
Task 1: Split
compiler_validators.go— Extract Permissions ValidationPriority: High
Estimated Effort: Small
Focus Area: Validator File Complexity
Description:
pkg/workflow/compiler_validators.gois 465 lines and containsvalidatePermissions(~100 lines),validateExpressions,validateFeatureConfig, andvalidateToolConfiguration. Per AGENTS.md, validators should be 100-300 lines. ExtractvalidatePermissions(and helpers) into a new filecompiler_permissions_validation.go.Acceptance Criteria:
compiler_validators.gois under 300 lines after the splitpkg/workflow/compiler_permissions_validation.gofile exists with the extracted function(s)go test ./pkg/workflow/)make fmtandmake lintpassCode Region:
pkg/workflow/compiler_validators.go(functionvalidatePermissions, line ~71–171)Task 2: Split
engine_validation.go— Extract Auth & Harness ValidationPriority: High
Estimated Effort: Small
Focus Area: Validator File Complexity
Description:
pkg/workflow/engine_validation.gois 316 lines with 6 functions covering three distinct concerns: version validation, harness script validation, and auth/inline definition validation. Split auth/inline validation intoengine_auth_validation.go.Acceptance Criteria:
engine_validation.godrops to under 300 linespkg/workflow/engine_auth_validation.gocreated withvalidateEngineAuthDefinition,validateEngineInlineDefinition,registerInlineEngineDefinition,validateSingleEngineSpecificationmake fmtandmake lintpassCode Region:
pkg/workflow/engine_validation.goTask 3: Extract Repository Caching from
repository_features_validation.goPriority: Medium
Estimated Effort: Small
Focus Area: Validator File Complexity / Single Responsibility
Description:
pkg/workflow/repository_features_validation.go(333 lines) mixes two concerns: (1) validating repository features like discussions/issues availability, and (2) implementing a caching layer (currentRepositoryCacheState). The caching infrastructure should live in a separate file.Acceptance Criteria:
repository_features_validation.godrops to under 300 linescurrentRepositoryCacheStateand related unexported cache vars) moved to a new filemake fmtandmake lintpassCode Region:
pkg/workflow/repository_features_validation.goTask 4: Add Comment Documentation to
permissions_validation.goPriority: Medium
Estimated Effort: Small
Focus Area: Validator Documentation Coverage
Description:
pkg/workflow/permissions_validation.gohas only ~15% comment coverage, well below the 30% minimum in AGENTS.md. The exported types (PermissionsValidationResult,ValidatePermissions,FormatValidationMessage) need doc comments, and key private helpers need inline explanations.Acceptance Criteria:
checkMissingPermissions,formatMissingPermissionsMessage) have explanatory commentsmake lintpasses (no new lint issues)Code Region:
pkg/workflow/permissions_validation.goTask 5: Improve Comment Coverage in
compiler_validators.goPriority: Low
Estimated Effort: Small
Focus Area: Validator Documentation Coverage
Description:
pkg/workflow/compiler_validators.gohas ~20% comment coverage (97 comment lines out of 465). Key orchestration functions likevalidateToolConfigurationlack explanatory comments for their internal steps.Acceptance Criteria:
validateToolConfigurationandvalidatePermissionshave section comments explaining major stepsmake lintpassesCode Region:
pkg/workflow/compiler_validators.go📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
compiler_validators.go(Task 1) - Priority: Highengine_validation.go(Task 2) - Priority: HighShort-term Actions (This Month)
permissions_validation.go(Task 4) - Priority: MediumLong-term Actions (This Quarter)
compiler_validators.go(Task 5) - Priority: Low📈 Success Metrics
Track these metrics to measure improvement in Validator File Complexity:
compiler_validators.gosize: 465 → <300 linesNext Steps
Generated by Repository Quality Improvement Agent
Next analysis: 2026-04-30 — Focus area will be selected based on diversity algorithm
All reactions