[repository-quality] Repository Quality Improvement Report – Validation File Size Governance #25651
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-04-11T13:19:10.607Z.
|
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.
-
Analysis Date: 2026-04-10
Focus Area: Validation File Size Governance
Strategy Type: Custom
Custom Area: Yes — gh-aw's
AGENTS.mdexplicitly mandates a 300-line hard limit for validator files, yet 9 validation files currently violate this limit. This focus area targets compliance with the project's own documented standards, which directly impacts maintainability, testability, and cognitive overhead when adding new validations.Executive Summary
gh-aw has a rich validation system comprising 52 dedicated
*_validation.gofiles acrosspkg/workflow/andpkg/cli/. TheAGENTS.mddocument explicitly establishes a hard limit of 300 lines per validator file and a minimum 30% comment coverage target. This analysis finds 9 files exceeding the hard limit (up to 462 lines) and numerous files below the 10% comment coverage threshold — in some cases as low as 5%.The most critical offender is
mcp_config_validation.go(462 lines), which contains two clearly separable domains: tools-section validation and MCP schema/requirements validation. Splitting these files will restore compliance with AGENTS.md, reduce per-file complexity, and improve focused test coverage.Full Analysis Report
Focus Area: Validation File Size Governance
Current State Assessment
Metrics Collected:
mcp_config_validation.go)Files exceeding the 300-line hard limit:
pkg/workflow/mcp_config_validation.gopkg/workflow/tools_validation.gopkg/workflow/dispatch_workflow_validation.gopkg/workflow/permissions_validation.gopkg/cli/run_workflow_validation.gopkg/workflow/repository_features_validation.gopkg/workflow/safe_outputs_validation.gopkg/workflow/template_injection_validation.gopkg/workflow/expression_safety_validation.goFiles with critically low comment coverage (<10%):
call_workflow_validation.godispatch_workflow_validation.goexpression_safety_validation.gotools_validation.godispatch_repository_validation.goexpression_syntax_validation.gostep_order_validation.gostrict_mode_permissions_validation.gopermissions_validation.gosafe_outputs_validation.goFindings
Strengths
mcp_config_validation.go(architecture overview, when-to-add guidance)validation.goandvalidation_helpers.goserve as well-documented anchors for the systemvalidate*for private,Validate*for public functionsAreas for Improvement
mcp_config_validation.gocontains two separable domains (tools-section validation + MCP schema requirements) — HIGH severitytools_validation.gohas no file-level documentation header (unlike other validators) — MEDIUM severityDetailed Analysis
The
mcp_config_validation.gofile's 462 lines include two logically distinct areas:ValidateToolsSection()andbuiltInToolNames— validates thetools:frontmatter keyValidateMCPConfigs()and its helpers — validatesmcp-servers:entries with schema + type requirementsPer the split decision tree in AGENTS.md, files over 300 lines with 2+ distinct domains should split. This applies directly here.
tools_validation.gois an unusual case: it contains GitHub tool guard-policy validation (allowed repos, min-integrity, toolsets) but has no file-level header documenting its scope — inconsistent with all other validators.dispatch_workflow_validation.goat 363 lines contains helper functions (findWorkflowFile,extractWorkflowDispatchInputs,mdHasWorkflowDispatch) that support the corevalidateDispatchWorkflow()function but could reasonably be extracted to adispatch_workflow_helpers.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 work items for Claude to process.
Improvement Tasks
Task 1: Split
mcp_config_validation.gointo Two FilesPriority: High
Estimated Effort: Medium
Focus Area: Validation File Size Governance
Description:
pkg/workflow/mcp_config_validation.gois 462 lines — the largest validation file in the codebase and the most significant violator of the documented 300-line hard limit. It contains two distinct validation domains:ValidateToolsSection(),builtInToolNames,builtInToolNamesForErrorValidateMCPConfigs(),getRawMCPConfig(),inferMCPType(),validateStringProperty(),validateMCPRequirements(),buildSchemaMCPConfig(),validateMCPMountsSyntax()These should be split into:
mcp_tools_section_validation.go— tools section validation (ValidateToolsSection + constants)mcp_config_validation.go— MCP server config validation (ValidateMCPConfigs + helpers)Acceptance Criteria:
mcp_config_validation.gois ≤ 300 lines after splitmcp_tools_section_validation.gois ≤ 300 linespermissions_validation.gofor reference)pkg/workflow/mcp_config_validation_test.gostill passmake agent-finishpasses without errorsCode Region:
pkg/workflow/mcp_config_validation.goTask 2: Add File-Level Documentation Header to
tools_validation.goPriority: High
Estimated Effort: Small
Focus Area: Validation File Size Governance / Documentation Consistency
Description:
pkg/workflow/tools_validation.go(368 lines) is the only large validation file without a file-level documentation comment header. Every other validator of comparable size (mcp_config_validation.go,permissions_validation.go,engine_validation.go, etc.) starts with a structured header documenting:This omission makes the file harder to navigate and inconsistent with project standards.
Acceptance Criteria:
// This file provides...documentation comment// # Validation Functionslisting all exported and key private functions// # When to Add Validation Hereguidancemake lintpasses without errorsCode Region:
pkg/workflow/tools_validation.go(top of file, beforepackage workflow)Task 3: Extract Helper Functions from
dispatch_workflow_validation.goPriority: Medium
Estimated Effort: Medium
Focus Area: Validation File Size Governance
Description:
pkg/workflow/dispatch_workflow_validation.gois 363 lines. The file's core function isvalidateDispatchWorkflow()but it also contains 6 helper functions that handle file discovery and YAML parsing:extractWorkflowDispatchInputs()— parses .lock.yml / .yml filesgetCurrentWorkflowName()— extracts workflow name from pathisPathWithinDir()— path-traversal safety checkfindWorkflowFile()— searches .github/workflows directorymdHasWorkflowDispatch()— reads .md frontmatter for triggersextractMDWorkflowDispatchInputs()— extracts inputs from .md filescontainsWorkflowDispatch()— checks 'on:' section variantsThese file-discovery and extraction helpers belong in a
dispatch_workflow_helpers.gofile, leaving only the core validation logic indispatch_workflow_validation.go.Acceptance Criteria:
dispatch_workflow_validation.gois ≤ 300 lines after refactordispatch_workflow_helpers.gocontains the extracted helpers with proper documentationgo test ./pkg/workflow/... -run TestDispatch)make agent-finishpasses without errorsCode Region:
pkg/workflow/dispatch_workflow_validation.goDo NOT change any function signatures, behavior, or visibility.
📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
mcp_config_validation.go— highest line count (462), two clear domains — Priority: Hightools_validation.go— quick win, consistency fix — Priority: HighShort-term Actions (This Month)
dispatch_workflow_validation.go— brings it under 300 lines — Priority: Mediumexpression_safety_validation.go— security-critical file — Priority: MediumLong-term Actions (This Quarter)
make lintor a dedicated script) that enforces the 300-line hard limit on*_validation.gofiles to prevent future regressions📈 Success Metrics
Track these metrics to measure improvement in Validation File Size Governance:
References:
Beta Was this translation helpful? Give feedback.
All reactions