Repository Quality Report: Validation System Compliance & Test Coverage (2026-03-27) #23243
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-03-28T13:35:42.111Z.
|
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 System Compliance
Analysis Date: 2026-03-27
Focus Area: Validation System Compliance & Test Coverage
Strategy Type: Custom (first run, no history)
Custom Area: Yes — The
pkg/workflow/andpkg/cli/directories contain 54 non-WASM validation files that are core to thegh aw compilepipeline. AGENTS.md explicitly documents a 300-line hard limit for validators. This focus area directly measures compliance with that architectural constraint and identifies critical testing gaps in the validation layer.Executive Summary
The workflow compilation pipeline relies on a large system of 54 validators spread across
pkg/workflow/andpkg/cli/. Analysis reveals 9 validators (17%) exceed the documented 300-line hard limit, and 30 validators (56%) lack dedicated test files, including several of the largest and most critical ones.The two
safe_outputsvalidators are the most severe outliers: both at 407 lines with no test coverage. Thepermissions_validation.go(351 lines) anddispatch_workflow_validation.go(363 lines) also exceed the limit without tests. These files handle security-critical decisions (safe output targeting, permission scopes, tool authorization) and represent the highest risk for undetected regressions.Full Analysis Report
Focus Area: Validation System Compliance & Test Coverage
Current State Assessment
Metrics Collected:
Files Exceeding 300-Line Hard Limit:
pkg/workflow/safe_outputs_validation_config.gopkg/workflow/safe_outputs_validation.gopkg/workflow/dispatch_workflow_validation.gopkg/workflow/tools_validation.gopkg/workflow/permissions_validation.gopkg/cli/run_workflow_validation.gopkg/workflow/repository_features_validation.gopkg/workflow/template_injection_validation.gopkg/workflow/mcp_config_validation.goLarge Validators Without Any Test Coverage (>200 lines):
pkg/workflow/safe_outputs_validation_config.gopkg/workflow/safe_outputs_validation.gopkg/workflow/permissions_validation.gopkg/workflow/expression_safety_validation.gopkg/workflow/runtime_validation.gopkg/workflow/glob_validation.gopkg/workflow/agent_validation.gopkg/cli/compile_validation.gopkg/workflow/expression_syntax_validation.gopkg/workflow/pip_validation.goFindings
Strengths
strict_mode_*.govalidators are 72–190 lines each)tools_validation.go,mcp_config_validation.go) are lower risk{domain}_validation.go) is consistently appliedAreas for Improvement
safe_outputs_validation.goandsafe_outputs_validation_config.go— both 407 lines, no tests. Safe Outputs is a security-critical feature and the absence of unit tests is a high-risk gap.permissions_validation.go— 351 lines, no tests. Permission validation affects all workflows using GitHub toolsets.expression_safety_validation.go— 295 lines, no tests. Template injection prevention depends on this.dispatch_workflow_validation.go— 363 lines, has tests but exceeds the 300-line limit; contains multiple distinct validation domains that could be split.agent_validation.go— 255 lines, no tests. Validates AI engine + tool combinations — important for correctness.Detailed Analysis
The
safe_outputs_validation_config.gois unique: it contains theValidationConfigdata structure (a table of field validation rules), plus theGetValidationConfigJSONfunction that serializes this config for use in shell scripts. This is a data + logic mix that could reasonably be split. The companionsafe_outputs_validation.gohandles domain pattern matching for network allowed-domains and safe-output targets.permissions_validation.godefinesValidatePermissions(),FormatValidationMessage(), andValidateIncludedPermissions()— three distinct concerns that each warrant their own test files. The absence of tests here means permission misconfiguration could silently pass through compilation.The pattern of strict-mode validation being split correctly (5 files, all under 200 lines) shows the team knows how to apply the split architecture — it just hasn't been applied retroactively to older validators.
🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: The following tasks are designed for GitHub Copilot coding agent execution. Each section represents an independent work item that can be assigned separately.
Task 1: Add Test Coverage for
safe_outputs_validation.goPriority: High
Estimated Effort: Medium
Focus Area: Test Coverage — Security-Critical Validation
Description:
pkg/workflow/safe_outputs_validation.go(407 lines) is one of the two largest validators and has zero test coverage. It validates network allowed-domains and safe-output target configurations. These validations are critical to the safe-outputs security model.Acceptance Criteria:
pkg/workflow/safe_outputs_validation_test.gowith//go:build !integrationbuild tagvalidateNetworkAllowedDomains()with valid domains, wildcard patterns, and invalid inputsvalidateSafeOutputsAllowedDomains()with ecosystem identifiers and invalid patternsvalidateSafeOutputsTarget()with all valid target types (empty, "triggering", "*", integer strings, GitHub expressions)validateDomainPattern()with multiple wildcard and malformed inputsmake test-unit(or selective test) to confirm all passmake lintto confirm no linting issuesCode Region:
pkg/workflow/safe_outputs_validation.goTask 2: Add Test Coverage for
permissions_validation.goPriority: High
Estimated Effort: Medium
Focus Area: Test Coverage — Permission Validation
Description:
pkg/workflow/permissions_validation.go(351 lines, no tests) validates GitHub Actions permissions for all workflows using GitHub toolsets. The exportedValidatePermissions()function is used throughout the compilation pipeline to enforce correct permission scopes.Acceptance Criteria:
pkg/workflow/permissions_validation_test.gowith//go:build !integrationbuild tagValidatePermissions()with all supported toolset combinationsFormatValidationMessage()with missing and extra permissionsValidateIncludedPermissions()handles valid and invalid YAML permission blockscheckMissingPermissions()logic viaValidatePermissions()callsgo test -v -run "TestValidatePermissions\|TestFormatValidation" ./pkg/workflow/to confirmmake lintto confirm no linting issuesCode Region:
pkg/workflow/permissions_validation.goTask 3: Add Test Coverage for
expression_safety_validation.goPriority: High
Estimated Effort: Medium
Focus Area: Test Coverage — Template Injection Prevention
Description:
pkg/workflow/expression_safety_validation.go(295 lines, no tests) validates that workflow expressions don't introduce template injection vulnerabilities. This is a security-critical validator with no test coverage.Acceptance Criteria:
pkg/workflow/expression_safety_validation_test.gowith//go:build !integrationbuild taggithub.event.issue.title)go test -v -run "Test.*Expression.*Safety\|Test.*ExpressionSafety" ./pkg/workflow/to confirmmake lintto confirm no issuesCode Region:
pkg/workflow/expression_safety_validation.goTask 4: Refactor
safe_outputs_validation.goto Meet the 300-Line LimitPriority: Medium
Estimated Effort: Medium
Focus Area: Architecture Compliance — 300-Line Hard Limit
Description:
pkg/workflow/safe_outputs_validation.goat 407 lines contains two distinct validation domains: (1) network domain validation (validateNetworkAllowedDomains, domain pattern helpers) and (2) safe-outputs target/domain validation (validateSafeOutputsAllowedDomains,validateSafeOutputsTarget). Per AGENTS.md, files over 300 lines should be split into separate files by domain.Acceptance Criteria:
pkg/workflow/network_domains_validation.go(network.allowed domain logic) and retain safe-outputs-specific logic insafe_outputs_validation.govalidateNetworkAllowedDomains+ helpers →network_domains_validation.go, and move safe-outputs domain validation to existing fileisEcosystemIdentifier,validateDomainPattern) should be in the file where they're primarily used, or invalidation_helpers.goif used by bothmake buildandmake test-unitto confirm no regressionsmake lintandmake fmtbefore committingCode Region:
pkg/workflow/safe_outputs_validation.goTask 5: Add Test Coverage for
agent_validation.goPriority: Medium
Estimated Effort: Small
Focus Area: Test Coverage — Engine/Tool Compatibility Validation
Description:
pkg/workflow/agent_validation.go(255 lines, no tests) validates AI engine and tool combinations — e.g., that Copilot engine doesn't use tools unsupported for that engine, and thatworkflow_runtriggers have appropriate branch restrictions. This is important for preventing silent misconfigurations.Acceptance Criteria:
pkg/workflow/agent_validation_test.gowith//go:build !integrationbuild tagworkflow_runtrigger validation with and without branch filtersgo test -v -run "Test.*Agent\|Test.*Engine" ./pkg/workflow/to confirmmake lintto confirm no issuesCode Region:
pkg/workflow/agent_validation.go📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
safe_outputs_validation.go— Priority: High (407 lines, security-critical, zero coverage)permissions_validation.go— Priority: High (351 lines, permission decisions, zero coverage)expression_safety_validation.go— Priority: High (295 lines, injection prevention, zero coverage)Short-term Actions (This Month)
safe_outputs_validation.goto split network domain validation into its own file — Priority: Mediumagent_validation.go— Priority: Medium (255 lines, engine/tool combos)Long-term Actions (This Quarter)
FrontmatterConfigfixtures for validation tests📈 Success Metrics
Track these metrics to measure improvement in Validation System Compliance:
Next Steps
References:
Beta Was this translation helpful? Give feedback.
All reactions