Objective
Enhance error messages in pkg/workflow/compiler.go to include actionable examples. The file contains 23 error messages without examples and is critical for user experience as compilation errors are frequently encountered.
Context
Related to #4085 - Repository Quality Improvement Report on Workflow Compilation Error Messages.
The compiler.go file (1617 lines) is the core compilation logic. Currently only 17.28% of errors across the codebase include examples, and compiler errors have significant impact on developer productivity.
Approach
Improve error messages to include actionable examples focusing on:
- Schema validation errors - Show valid field names and example configurations
- Frontmatter parsing errors - Provide example YAML frontmatter
- Import resolution errors - Suggest valid import paths and formats
- Workflow structure validation - Include complete workflow examples
- Tool configuration errors - Show valid tool setups
Use console formatting functions for consistency:
console.FormatError() for structured compiler errors
console.FormatErrorWithSuggestions() for errors with actionable hints
Files to Modify
- Update:
pkg/workflow/compiler.go
- Update:
pkg/workflow/compiler_test.go (verify error message quality)
Example Transformations
Schema validation before:
return fmt.Errorf("unknown field: %s", fieldName)
Schema validation after:
return fmt.Errorf("unknown field: %s. Valid fields are: on, permissions, engine, tools, safe-outputs. Example:\n---\non: issues\npermissions:\n contents: read\n---", fieldName)
Import resolution before:
return fmt.Errorf("failed to resolve import: %s", path)
Import resolution after:
return fmt.Errorf("failed to resolve import: %s. Import paths must start with 'shared/' or '.github/workflows/shared/'. Example: imports:\n - shared/security-notice.md", path)
Acceptance Criteria
Priority
High - Core compilation errors directly impact all users.
Related to #4085
AI generated by Plan Command for discussion #4085
Objective
Enhance error messages in
pkg/workflow/compiler.goto include actionable examples. The file contains 23 error messages without examples and is critical for user experience as compilation errors are frequently encountered.Context
Related to #4085 - Repository Quality Improvement Report on Workflow Compilation Error Messages.
The compiler.go file (1617 lines) is the core compilation logic. Currently only 17.28% of errors across the codebase include examples, and compiler errors have significant impact on developer productivity.
Approach
Improve error messages to include actionable examples focusing on:
Use console formatting functions for consistency:
console.FormatError()for structured compiler errorsconsole.FormatErrorWithSuggestions()for errors with actionable hintsFiles to Modify
pkg/workflow/compiler.gopkg/workflow/compiler_test.go(verify error message quality)Example Transformations
Schema validation before:
Schema validation after:
Import resolution before:
Import resolution after:
Acceptance Criteria
Priority
High - Core compilation errors directly impact all users.
Related to #4085