[repository-quality] Repository Quality: Validation Architecture Compliance (2026-04-03) #24308
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-04-04T13:19:06.991Z.
|
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 — Validation Architecture Compliance
Analysis Date: 2026-04-03
Focus Area: Validation Architecture Compliance
Strategy Type: Custom (first run — no previous history)
Custom Area: Yes — This focus area was chosen because gh-aw has an unusually large and growing validation subsystem (54+ files, 10,296 LOC) with explicit architectural guidelines in AGENTS.md. Verifying compliance with those guidelines is uniquely valuable to this codebase.
Executive Summary
The
pkg/workflow/validation subsystem is one of the most critical parts of gh-aw — it ensures workflows compile correctly and safely. AGENTS.md defines clear architectural rules for these files: a 300-line hard limit, a minimum 30% comment coverage, and a separate test file for each validator. This analysis found that 9 of 54 validators exceed the hard line limit, 24 validators have no dedicated test file, and comment coverage falls well below 30% in the largest files. These gaps represent real maintainability debt and should be addressed incrementally.The overall testing investment is impressive — 65 validation-related test files exist, and the test-to-source LOC ratio is 2.18:1 across the whole codebase. But the specific validators that are missing tests tend to be the larger, more complex ones (e.g.,
permissions_validation.goat 351 lines,expression_safety_validation.goat 304 lines), which is the highest-risk gap.Full Analysis Report
Focus Area: Validation Architecture Compliance
Current State Assessment
Metrics Collected:
Files violating the 300-line hard limit:
safe_outputs_validation_config.gosafe_outputs_validation.gotools_validation.godispatch_workflow_validation.gopermissions_validation.gorepository_features_validation.gomcp_config_validation.gotemplate_injection_validation.goexpression_safety_validation.goValidators with no dedicated test file (selected high-priority):
permissions_validation.go(351 lines — over limit AND no tests)expression_safety_validation.go(304 lines — over limit AND no tests)agent_validation.go(255 lines)safe_outputs_validation.go(407 lines — over limit AND no tests)expression_syntax_validation.go(236 lines)runtime_validation.go(290 lines)glob_validation.go(251 lines)dispatch_repository_validation.go(107 lines)strict_mode_env_validation.go(147 lines)strict_mode_permissions_validation.go(190 lines)strict_mode_network_validation.go(133 lines)jobs_validation.go(84 lines)docker_validation.go(180 lines)npm_validation.go(129 lines)pip_validation.go(212 lines)name_validation.go(84 lines)lock_validation.go(59 lines)cache_validation.go(39 lines)firewall_validation.go(59 lines)repo_memory_validation.go(67 lines)push_to_pull_request_branch_validation.go(119 lines)template_validation.go(90 lines)github_toolset_validation_error.go(74 lines)safe_outputs_validation_config.go(407 lines — over limit AND no tests)Findings
Strengths
expression_safety_validation.gohas good file-level documentation comments and pre-compiled regex constants{domain}_validation.gonaming conventionvalidation.gofile serves as a well-organized registry/coordinatorAreas for Improvement
🤖 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.
Task 1: Refactor
safe_outputs_validation_config.go(407 lines) into separate filesPriority: High
Estimated Effort: Medium
Focus Area: Validation Architecture Compliance
Description:
pkg/workflow/safe_outputs_validation_config.gois 407 lines with only ~1% comment coverage and a single exported function. Per AGENTS.md, the hard limit is 300 lines. The file contains two distinct concerns: (1) type definitions (FieldValidation,TypeValidationConfig) and (2) the largeValidationConfigmap. These should be separated.Acceptance Criteria:
safe_outputs_validation_types.go)go test ./pkg/workflow/... -run ".*safe_output.*"make agent-finishpasses without errorsCode Region:
pkg/workflow/safe_outputs_validation_config.goTask 2: Add a dedicated test file for
expression_safety_validation.goPriority: High
Estimated Effort: Medium
Focus Area: Validation Architecture Compliance
Description:
pkg/workflow/expression_safety_validation.go(304 lines, exceeds 300-line limit) has no dedicated test file. It is responsible for blocking template injection attacks — a critical security validator. Given its security significance and size, it must have comprehensive unit tests.Acceptance Criteria:
pkg/workflow/expression_safety_validation_test.gocreated with//go:build !integrationtaggo test -v -run "TestExpression" ./pkg/workflow/passesmake lintpasses with no new warningsCode Region:
pkg/workflow/expression_safety_validation.goTask 3: Add a dedicated test file for
permissions_validation.goPriority: High
Estimated Effort: Medium
Focus Area: Validation Architecture Compliance
Description:
pkg/workflow/permissions_validation.go(351 lines, exceeds 300-line limit) has no dedicated test file. It validates GitHub Actions permissions in workflow frontmatter — incorrect permission handling can lead to over-permissioned or broken workflows. The existingpermissions_validator_test.gotests only the JSON-schema-based validator; this file's logic needs direct unit tests.Acceptance Criteria:
pkg/workflow/permissions_validation_test.gocreated with//go:build !integrationtaggo test -v -run ".*[Pp]ermission.*" ./pkg/workflow/passesmake lintpasses with no new warningsCode Region:
pkg/workflow/permissions_validation.goTask 4: Increase comment coverage in the 3 largest over-limit validators
Priority: Medium
Estimated Effort: Small
Focus Area: Validation Architecture Compliance
Description:
tools_validation.go(368 lines, 15% comments),dispatch_workflow_validation.go(363 lines, 13% comments), andmcp_config_validation.go(325 lines) all exceed the 300-line limit AND fall well below the 30% comment coverage minimum defined in AGENTS.md. Comments should explain why validations exist, not just what they do.Acceptance Criteria:
make agent-finishpasses without errorsCode Region:
pkg/workflow/tools_validation.go,pkg/workflow/dispatch_workflow_validation.go,pkg/workflow/mcp_config_validation.goTask 5: Add test files for the
strict_mode_*validatorsPriority: Medium
Estimated Effort: Small
Focus Area: Validation Architecture Compliance
Description:
Three strict-mode validators have no dedicated test files:
strict_mode_env_validation.go(147 lines)strict_mode_permissions_validation.go(190 lines)strict_mode_network_validation.go(133 lines)Strict mode is a security feature — regressions in these validators could silently weaken security guarantees for users.
Acceptance Criteria:
strict_mode_env_validation_test.go,strict_mode_permissions_validation_test.go,strict_mode_network_validation_test.go//go:build !integrationbuild taggo test -v -run ".*[Ss]trict.*" ./pkg/workflow/passesmake lintpasses with no new warningsCode Region:
pkg/workflow/strict_mode_env_validation.go,pkg/workflow/strict_mode_permissions_validation.go,pkg/workflow/strict_mode_network_validation.go📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
safe_outputs_validation_config.gointo type file + config file — Priority: Highexpression_safety_validation.go(security-critical) — Priority: HighShort-term Actions (This Month)
permissions_validation.goand the threestrict_mode_*validators — Priority: Hightools_validation.go,dispatch_workflow_validation.go,mcp_config_validation.go— Priority: MediumLong-term Actions (This Quarter)
*_validation.goexceeds 300 lines) — Priority: Low📈 Success Metrics
Track these metrics to measure improvement in Validation Architecture Compliance:
Next Steps
References:
Beta Was this translation helpful? Give feedback.
All reactions