[repository-quality] Repository Quality Improvement Report - Validator Complexity Compliance #26431
Replies: 1 comment 1 reply
-
|
/plan |
Beta Was this translation helpful? Give feedback.
1 reply
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 Complexity Compliance
Analysis Date: 2026-04-15
Focus Area: Validator Complexity Compliance (Custom)
Strategy Type: Custom
Custom Area: Yes — This area specifically targets the repository's own documented hard limit of 300 lines per validator file (from AGENTS.md), which is currently violated by 7 files. Since gh-aw has an explicit validation architecture guideline and a detailed refactoring guide in
scratchpad/validation-refactoring.md, this is a uniquely actionable area.Executive Summary
The repository's AGENTS.md documents a hard limit of 300 lines per validator file with a target of 100–200 lines. Analysis found 7 validator files that exceed this limit, ranging from 19% to 58% over. The most oversized files are
tools_validation.go(475 lines),mcp_config_validation.go(462 lines), andsafe_outputs_validation_config.go(416 lines). A refactoring guide already exists inscratchpad/validation-refactoring.md, and split patterns can be seen in the existingsafe_outputs_validation.go/safe_outputs_validation_config.gopair.Splitting these files will improve maintainability, make individual validators easier to test in isolation, and bring the codebase into compliance with its own architectural guidelines. Each file has clear function-level seams that make splitting straightforward with no behaviour changes required.
Full Analysis Report
Focus Area: Validator Complexity Compliance
Current State Assessment
Metrics Collected:
scratchpad/validation-refactoring.md)Files exceeding the 300-line hard limit:
pkg/workflow/tools_validation.gopkg/workflow/mcp_config_validation.gopkg/workflow/safe_outputs_validation_config.gopkg/workflow/template_injection_validation.gopkg/workflow/dispatch_workflow_validation.gopkg/workflow/safe_outputs_validation.gopkg/workflow/permissions_validation.goFindings
Strengths
scratchpad/validation-refactoring.mdsafe_outputs_validation.go+safe_outputs_validation_config.goAreas for Improvement
tools_validation.go(475 lines): 9 functions spanning bash tool validation, GitHub tool config, guard policies, integrity reactions, and repo scope validation — clearly 3+ distinct domainsmcp_config_validation.go(462 lines): Core MCP config validation mixed with property validation, type inference, and mount syntax — at least 3 splitworthy groupstemplate_injection_validation.go(384 lines): Detection logic, extraction utilities, and error formatting — 3 distinct responsibilitiesdispatch_workflow_validation.go(363 lines): Dispatch validation mixed with file-resolution utilities (findWorkflowFile,isPathWithinDir)permissions_validation.go(351 lines): Slightly over limit;ValidateIncludedPermissionsis functionally distinct from the othersDetailed Analysis
The AGENTS.md decision tree for splitting is clear: any file over 300 lines containing 2+ distinct domains should be split. All 7 flagged files meet this criterion.
The existing
safe_outputs_validation.go/safe_outputs_validation_config.gosplit demonstrates the pattern — but note thatsafe_outputs_validation_config.goitself is now 416 lines with a single large functionGetValidationConfigJSON, suggesting it may need further extraction of helper logic.For
tools_validation.go, the natural split is:tools_validation_github.go— GitHub tool config, guard policy, integrity reactions, repo scope, tool/toolset validation (8 functions)tools_validation.go— Bash tool config + orchestration (keep small)For
mcp_config_validation.go, the split follows:mcp_config_validation.go— top-levelValidateMCPConfigs,ValidateToolsSectionmcp_property_validation.go—validateStringProperty,validateMCPRequirements,buildSchemaMCPConfigmcp_mount_validation.go—validateMCPMountsSyntax🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: The following 5 tasks are designed for GitHub Copilot coding agent execution. Please split these into individual work items for Claude to process. Each task is self-contained and independently actionable.
Improvement Tasks
Task 1: Split
tools_validation.gointo GitHub-specific and general validationPriority: High
Estimated Effort: Small
Focus Area: Validator Complexity Compliance
Description:
pkg/workflow/tools_validation.gois 475 lines (58% over the 300-line hard limit). It contains 9 functions across at least 3 distinct domains: bash tool validation, GitHub tool config/policy validation, and repo scope/pattern validation. Extract the 8 GitHub-specific functions into a new file.Acceptance Criteria:
pkg/workflow/tools_validation_github.gocreated containing:validateGitHubReadOnly,validateGitHubToolConfig,validateGitHubGuardPolicy,validateIntegrityReactions,validateReposScope,validateRepoPattern,isValidOwnerOrRepo,ValidateGitHubToolsAgainstToolsetspkg/workflow/tools_validation.goretains onlyvalidateBashToolConfigplus any orchestration/dispatcher functions, and is under 300 linesmake test-unit)make fmtandmake lintpass with no new issuesCode Region:
pkg/workflow/tools_validation.goTask 2: Split
mcp_config_validation.gointo focused sub-validatorsPriority: High
Estimated Effort: Small
Focus Area: Validator Complexity Compliance
Description:
pkg/workflow/mcp_config_validation.gois 462 lines (54% over limit). It mixes top-level config validation entry points, property validation helpers, type inference, and mount syntax validation. Split into 3 focused files following the naming convention{domain}_{subdomain}_validation.go.Acceptance Criteria:
pkg/workflow/mcp_config_validation.goretains:ValidateMCPConfigs,ValidateToolsSection,getRawMCPConfig,inferMCPType— under 250 linespkg/workflow/mcp_property_validation.gocreated with:validateStringProperty,validateMCPRequirements,buildSchemaMCPConfigpkg/workflow/mcp_mount_validation.gocreated with:validateMCPMountsSyntaxmake test-unit)make fmtandmake lintpassCode Region:
pkg/workflow/mcp_config_validation.goTask 3: Split
template_injection_validation.goby responsibilityPriority: Medium
Estimated Effort: Small
Focus Area: Validator Complexity Compliance
Description:
pkg/workflow/template_injection_validation.gois 384 lines. It contains 8 functions with 3 distinct responsibilities: detection, extraction utilities, and error formatting. Extract utilities and formatting into a separate file.Acceptance Criteria:
pkg/workflow/template_injection_validation.goretains core validation:hasUnsafeExpressionInRunContent,validateNoTemplateInjection,validateNoTemplateInjectionFromParsed— under 250 linespkg/workflow/template_injection_utils.gocreated with:extractRunBlocks,removeHeredocContent,extractRunSnippet,detectExpressionContext,formatTemplateInjectionErrormake test-unit)make fmtandmake lintpassCode Region:
pkg/workflow/template_injection_validation.goTask 4: Extract file-resolution utilities from
dispatch_workflow_validation.goPriority: Medium
Estimated Effort: Small
Focus Area: Validator Complexity Compliance
Description:
pkg/workflow/dispatch_workflow_validation.gois 363 lines and mixes two clearly distinct concerns: (1) dispatch workflow validation logic and (2) workflow file-resolution utilities (findWorkflowFile,isPathWithinDir, etc.). The file utilities can be extracted independently.Acceptance Criteria:
pkg/workflow/dispatch_workflow_file_resolver.gocreated with:getCurrentWorkflowName,isPathWithinDir,findWorkflowFile,mdHasWorkflowDispatch,extractMDWorkflowDispatchInputspkg/workflow/dispatch_workflow_validation.goretains:validateDispatchWorkflow,extractWorkflowDispatchInputs,containsWorkflowDispatch— under 200 linesmake test-unit)make fmtandmake lintpassCode Region:
pkg/workflow/dispatch_workflow_validation.goTask 5: Bring
safe_outputs_validation.gounder the hard limitPriority: Low
Estimated Effort: Small
Focus Area: Validator Complexity Compliance
Description:
pkg/workflow/safe_outputs_validation.gois 358 lines. The file already has a companionsafe_outputs_validation_config.go(416 lines, itself over the limit). ThevalidateSafeOutputsMaxfunction (lines 222–315) is 93 lines and handles a distinct sub-domain (max value validation) that could be extracted.Acceptance Criteria:
pkg/workflow/safe_outputs_validation.gois under 300 lines after the refactorpkg/workflow/make test-unit)make fmtandmake lintpassCode Region:
pkg/workflow/safe_outputs_validation.go📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
tools_validation.go(Task 1) — Priority: High, most oversized at 475 linesmcp_config_validation.go(Task 2) — Priority: High, 462 lines with 3 clear domainsShort-term Actions (This Month)
template_injection_validation.go(Task 3) — Priority: Mediumdispatch_workflow_validation.go(Task 4) — Priority: MediumLong-term Actions (This Quarter)
safe_outputs_validation.go(Task 5) — Priority: Low, smallest overage*_validation.gofile exceeds 300 lines — prevents regression📈 Success Metrics
Track these metrics to measure improvement:
Next Steps
wc -landmake test-unitReferences:
Beta Was this translation helpful? Give feedback.
All reactions