Repository Quality Report: Validation File Size Compliance (2026-03-12) #20676
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-03-13T13:39:34.948Z.
|
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 File Size Compliance
Analysis Date: 2026-03-12
Focus Area: Validation File Size Compliance
Strategy Type: Custom (repository-specific)
Custom Area: Yes — The project's
AGENTS.mdexplicitly documents a hard limit of 300 lines per validator file, with a target of 100–200 lines. A scan reveals 10 validation files currently exceed this hard limit, representing a 24% non-compliance rate across 42 total validation files.Executive Summary
The
gh-awcodebase maintains detailed guidelines inAGENTS.mdabout validator file size: target 100–200 lines, hard limit 300 lines, split when 2+ unrelated validation domains exist. Despite this documentation, 10 of the 42 validation files breach the hard limit. The most egregious isstrict_mode_validation.goat 546 lines — 82% over the limit. In aggregate, these 10 files contain ~3,900 lines of code that should be distributed across ~20+ smaller, more focused files.Splitting these validators will improve: testability (each sub-validator can be tested in isolation), discoverability (clear single-responsibility naming), and contribution friction reduction (smaller files are easier to review and modify). The project already has strong tooling (
make lint,make test-unit) and naming conventions ({domain}_{subdomain}_validation.go) to support this refactoring.Full Analysis Report
Focus Area: Validation File Size Compliance
Current State Assessment
Metrics Collected:
pkg/workflow/strict_mode_validation.gopkg/workflow/expression_validation.gopkg/workflow/safe_output_validation_config.gopkg/workflow/safe_outputs_validation.gopkg/workflow/dispatch_workflow_validation.gopkg/workflow/repository_features_validation.gopkg/workflow/engine_validation.gopkg/workflow/concurrency_validation.gopkg/cli/run_workflow_validation.gopkg/workflow/permissions_validation.goSummary Stats:
mcp_config_validation.go,mcp_validation.go,template_injection_validation.go)Findings
Strengths
AGENTS.md{domain}_{subdomain}_validation.gois well-established and used consistently_test.gofilesAreas for Improvement
strict_mode_validation.go(546 lines) has at least 4 distinct validation domains packed into one file — High severityexpression_validation.go(501 lines) mixes expression safety, syntax checking, and runtime import validation — High severityCandidate Split Plans
strict_mode_validation.go→ 3 files:strict_mode_validation.go—validateStrictMode()orchestrator (~80 lines)strict_network_validation.go—validateStrictNetwork,validateStrictMCPNetwork,validateStrictFirewall(~150 lines)strict_env_secrets_validation.go—validateEnvSecrets,getEngineBaseEnvVarKeys,validateEnvSecretsSection(~130 lines)strict_tools_permissions_validation.go—validateStrictTools,validateStrictPermissions,validateStrictDeprecatedFields(~120 lines)expression_validation.go→ 3 files:expression_safety_validation.go—validateExpressionSafety,validateExpressionForDangerousProps(~200 lines)expression_syntax_validation.go—validateSingleExpression,containsExpression(~150 lines)runtime_import_validation.go—extractRuntimeImportPaths,validateRuntimeImportFiles(~80 lines) — file may already existrepository_features_validation.go→ 2 files:repository_features_validation.go—validateRepositoryFeatures,ClearRepositoryFeaturesCache(~120 lines)repository_api_client.go—getRepositoryFeatures,checkRepositoryHasDiscussions,checkRepositoryHasIssues, helpers (~200 lines)dispatch_workflow_validation.go→ 2 files:dispatch_workflow_validation.go—validateDispatchWorkflowlogic (~150 lines)dispatch_workflow_utils.go—extractWorkflowDispatchInputs,findWorkflowFile,mdHasWorkflowDispatch, helpers (~180 lines)🤖 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 agent to process one at a time.
Improvement Tasks
Task 1: Split
strict_mode_validation.gointo domain-focused filesPriority: High
Estimated Effort: Medium
Focus Area: Validation File Size Compliance
Description:
strict_mode_validation.go(546 lines) contains 4 distinct validation domains: strict mode orchestration, network validation, env-secrets validation, and tools/permissions validation. PerAGENTS.md, files exceeding 300 lines must be refactored. This file is 82% over the hard limit.Acceptance Criteria:
strict_mode_validation.goreduced to ≤200 lines (orchestrator only:validateStrictMode)strict_network_validation.gocreated withvalidateStrictNetwork,validateStrictMCPNetwork,validateStrictFirewallstrict_env_secrets_validation.gocreated withvalidateEnvSecrets,getEngineBaseEnvVarKeys,validateEnvSecretsSectionstrict_tools_permissions_validation.gocreated withvalidateStrictTools,validateStrictPermissions,validateStrictDeprecatedFieldsmake test-unit)make agent-finishpasses with no errorsCode Region:
pkg/workflow/strict_mode_validation.goTask 2: Split
expression_validation.gointo focused concernsPriority: High
Estimated Effort: Medium
Focus Area: Validation File Size Compliance
Description:
expression_validation.go(501 lines) mixes three distinct concerns: expression safety checking, expression syntax validation, and runtime import path validation. The runtime import concern may already have a test file (runtime_import_validation_test.go), suggesting it was intended to be a separate file.Acceptance Criteria:
expression_validation.goor moved toexpression_safety_validation.govalidateSingleExpressionand helpers separated intoexpression_syntax_validation.go(≤200 lines)runtime_import_validation.go(≤100 lines) — verify if file already exists before creatingmake test-unit)make agent-finishpassesCode Region:
pkg/workflow/expression_validation.goTask 3: Split
repository_features_validation.gointo validation and API clientPriority: Medium
Estimated Effort: Small
Focus Area: Validation File Size Compliance
Description:
repository_features_validation.go(367 lines) mixes high-level workflow validation with low-level GitHub API access functions (getRepositoryFeatures,checkRepositoryHasDiscussions, etc.). The API client helpers are a distinct concern and should live in a separate file.Acceptance Criteria:
repository_features_validation.goreduced to ≤200 lines (validation logic + cache clear)repository_features_api.gocreated withgetRepositoryFeatures,checkRepositoryHasDiscussions,checkRepositoryHasIssues, and related uncached helpersmake test-unit)make agent-finishpassesCode Region:
pkg/workflow/repository_features_validation.goTask 4: Split
dispatch_workflow_validation.gointo validation and utility helpersPriority: Medium
Estimated Effort: Small
Focus Area: Validation File Size Compliance
Description:
dispatch_workflow_validation.go(372 lines) contains the mainvalidateDispatchWorkflowfunction alongside many utility/helper functions for finding workflow files and extracting dispatch inputs. The utilities are a distinct, reusable concern.Acceptance Criteria:
dispatch_workflow_validation.goreduced to ≤200 lines (validation logic only)dispatch_workflow_utils.gocreated withextractWorkflowDispatchInputs,findWorkflowFile,getCurrentWorkflowName,isPathWithinDir,mdHasWorkflowDispatch,extractMDWorkflowDispatchInputs,containsWorkflowDispatchmake test-unit)make agent-finishpassesCode Region:
pkg/workflow/dispatch_workflow_validation.goTask 5: Add linting check to catch future validator size violations
Priority: Low
Estimated Effort: Small
Focus Area: Validation File Size Compliance
Description:
To prevent regression, add a CI check (or Makefile target) that alerts when validation files exceed 300 lines. This enforces the documented hard limit automatically rather than relying on manual review.
Acceptance Criteria:
make check-validator-sizestarget added to the Makefile that exits non-zero if any*_validation*.gofile exceeds 300 linesmake agent-finishcontinues to passCode Region:
MakefileNote: Before enabling this as a blocking check, Tasks 1–4 above should be completed to bring the existing violations into compliance.
Beta Was this translation helpful? Give feedback.
All reactions