Skip to content

[Code Quality] Add error aggregation using errors.Join throughout validation code #12598

@github-actions

Description

@github-actions

Description

Implement error aggregation throughout the codebase so users see all validation errors, configuration issues, and workflow problems in one report instead of discovering them one at a time through multiple re-runs.

Current Behavior

  • First error stops validation/compilation
  • Users fix error, re-run, discover next error
  • Requires multiple iterations to fix all issues
  • Poor developer experience for workflows with multiple problems

Desired Behavior

  • All validation errors collected and reported together
  • Clear indication of total error count and severity
  • Errors grouped by category (validation, configuration, permissions)
  • Users fix all issues in one iteration

Files Affected

  • pkg/workflow/*_validation.go - Core validation files
  • pkg/parser/frontmatter_parser.go - Frontmatter validation
  • pkg/cli/compile_command.go - Compilation error handling

Suggested Changes

  1. Identify validation/compilation code paths for aggregation
  2. Replace early returns with error collection using errors.Join
  3. Update error messages to show "X errors found" with full list
  4. Group errors by category for better readability
  5. Maintain backward compatibility (exit code 1 if any errors)
  6. Add --fail-fast flag to restore old behavior if needed
  7. Update at least 5 high-traffic validation functions

Success Criteria

  • At least 5 validation functions aggregate errors
  • Users see all errors in single run
  • Errors grouped by category (validation, config, permissions)
  • Total error count displayed prominently
  • Exit code 1 maintained when errors exist
  • --fail-fast flag implemented for legacy behavior
  • Unit tests verify error aggregation
  • Validation guide updated
  • All tests pass (make test-unit)

Example Output

❌ Found 3 validation errors in workflow.md:

Validation Errors (2):
  • Line 5: Invalid engine 'copilot-pro' (valid: copilot, claude, codex, custom)
  • Line 12: Required field 'tools.github' missing when using safe-outputs

Configuration Errors (1):
  • MCP server 'playwright' requires network.allowed_domains configuration

Fix all errors above and re-run compilation.

Implementation Strategy

  1. Phase 1: Update pkg/constants/ validation (smallest scope)
  2. Phase 2: Update pkg/cli/ validation
  3. Phase 3: Update pkg/workflow/ validation
  4. Phase 4: Update remaining packages

Run make agent-finish after each phase.

Priority

Medium-High - Significantly improves developer experience, reduces iteration cycles

Source

Extracted from Repository Quality Improvement Report - Workflow Health Monitoring #12540 - Task 3

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 12, 2026, 5:15 PM UTC

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions