-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Labels
automationcode-qualitycookieIssue Monster Loves Cookies!Issue Monster Loves Cookies!error-handlingtask-mining
Description
Description
Error wrapping practices are inconsistent across compiler files, with some files having excellent coverage (16 instances in compiler_jobs.go) while others have none (compiler.go). This breaks error chains and makes debugging compilation failures significantly harder.
Current State
Error Wrapping by File:
compiler.go: 0 instances offmt.Errorf(..., %w)❌compiler_yaml.go: 3 instances⚠️ compiler_activation_jobs.go: 4 out of 13 (9 missing%w)⚠️ compiler_orchestrator_workflow.go: 5 instances ✅compiler_jobs.go: 16 instances ✅ (exemplary)
Why This Matters (Release Mode Priority)
- Debugging Difficulty: Without error wrapping, root causes are lost in error chains
- Production Support: Harder to diagnose compilation failures in workflows
- Error Context: Missing context makes troubleshooting time-consuming
- Consistency: Codebase should follow uniform error handling patterns
Problem Examples
❌ Current Pattern (compiler.go)
func formatCompilerError(filePath, errType, message string) error {
formatted := console.FormatError(...)
return errors.New(formatted) // Creates new error, loses cause
}✅ Should Be (with wrapping)
func formatCompilerError(filePath, errType, message string, cause error) error {
formatted := console.FormatError(...)
if cause != nil {
return fmt.Errorf("%s: %w", formatted, cause)
}
return errors.New(formatted)
}Suggested Changes
1. Update compiler.go (Priority: High)
- Enhance
formatCompilerError()to support error wrapping - Add
%wto all error returns throughout file - Estimated: 1-2 hours
2. Update compiler_yaml.go (Priority: Medium)
- Add error wrapping to remaining error paths (job building, validation)
- Current 3 instances → Target: 8-10 instances
- Estimated: 1 hour
3. Update compiler_activation_jobs.go (Priority: Medium)
- Audit all 13
fmt.Errorfcalls - Add
%wto 9 missing instances - Estimated: 1 hour
Files Affected
pkg/workflow/compiler.go(~10-15 error returns to update)pkg/workflow/compiler_yaml.go(~5-7 error returns to update)pkg/workflow/compiler_activation_jobs.go(~9 error returns to update)
Success Criteria
- All compiler files consistently use
fmt.Errorf(..., %w)for error wrapping -
formatCompilerError()enhanced to support cause wrapping - Error messages maintain clarity and console formatting
- All existing tests pass (
make test-unit) - Manual testing confirms improved error messages
- Quality scores improve across all files
Estimated Effort
Total: 3-4 hours (1-2h per file, phased approach)
Implementation Strategy
Phase 1 (High Priority - compiler.go):
- Enhance
formatCompilerError()with cause parameter - Update all error returns in
compiler.go - Test compilation error scenarios
Phase 2 (Medium Priority - other files):
- Update
compiler_yaml.goerror paths - Update
compiler_activation_jobs.goerror paths - Final validation across all files
Priority
Medium - Improves debugging and error diagnostics, supporting release stability indirectly.
Source
Extracted from:
- Daily Compiler Code Quality Report - 2026-02-07 #14370
- Daily Compiler Code Quality Report - 2026-02-06 #14159
References:
AI generated by Discussion Task Miner - Code Quality Improvement Agent
- expires on Feb 8, 2026, 5:06 PM UTC
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
automationcode-qualitycookieIssue Monster Loves Cookies!Issue Monster Loves Cookies!error-handlingtask-mining