-
Notifications
You must be signed in to change notification settings - Fork 302
Description
Description
Compiler files show inconsistent error wrapping patterns. Some files use fmt.Errorf with %w for proper error chaining (excellent), while others have gaps that make debugging compilation failures more difficult.
Current State
Error wrapping inconsistency across files:
| File | Error Wraps | Coverage | Status |
|---|---|---|---|
compiler_jobs.go |
16/16 | 100% | ✅ Excellent |
compiler_yaml.go |
3/3 | 100% | ✅ Excellent |
compiler_activation_jobs.go |
4/9 | 44% | |
compiler_yaml_main_job.go |
1/2 | 50% |
Examples of issues:
-
compiler_yaml_main_job.go (line 66):
// Current - error only logged, not returned if err != nil { compilerYamlLog.Printf("Warning: failed to marshal repository imports: %v", err) } // Should be if err != nil { return fmt.Errorf("failed to marshal repository imports for merge step: %w", err) }
-
compiler_activation_jobs.go:
- 9
fmt.Errorfcalls total - Only 4 use
%wfor wrapping (44% coverage) - Missing context propagation for debugging
- 9
Impact
Without consistent error wrapping:
- Harder to trace compilation failures through call stack
- Loss of error context at higher levels
- Debugging requires more time and effort
- Reduced error actionability for users
Suggested Changes
-
Audit all compiler files for error handling:
grep -rn "return.*fmt.Errorf" pkg/workflow/compiler*.go | grep -v "%w"
-
Fix missing error wrapping - Ensure all error returns use
%w:return fmt.Errorf("failed to (action): %w", err)
-
Return errors instead of only logging - Don't swallow errors:
// Bad if err != nil { log.Printf("Warning: %v", err) } // Good if err != nil { return fmt.Errorf("context: %w", err) }
Files Affected
Priority order (most gaps to fewest):
pkg/workflow/compiler_activation_jobs.go- 5 missing wrapspkg/workflow/compiler_yaml_main_job.go- 1 missing wrap
Success Criteria
- All
fmt.Errorfcalls with underlying errors use%wwrapper - No errors are logged without being returned (unless explicitly intended)
- Error messages include actionable context
- Grep audit shows 100% error wrap coverage:
grep -rn "return.*fmt.Errorf" pkg/workflow/compiler*.go | grep -v "%w"returns no results - All existing tests still pass after changes
Priority
High - Quick win with high impact on debugging experience
Estimated Effort
30-60 minutes
Source
Extracted from compiler quality analysis discussions:
- Daily Compiler Code Quality Report - Feb 6, 2026 (#14159) - "Standardize error wrapping across all files"
- Daily Compiler Code Quality Report - Feb 5, 2026 (#13934) - "Inconsistent error wrapping (Medium Priority)"
Identified as immediate action in both reports due to impact on debugging.
AI generated by Discussion Task Miner - Code Quality Improvement Agent
- expires on Feb 8, 2026, 5:17 AM UTC