Skip to content

[Code Quality] Add error wrapping to compiler activation job builders #11664

@github-actions

Description

@github-actions

Description

The compiler_activation_jobs.go file has only 1 instance of proper error wrapping (fmt.Errorf with %w) despite multiple error returns. This makes debugging activation job generation issues significantly harder.

Current State

File: pkg/workflow/compiler_activation_jobs.go
Size: 799 lines
Error Wrapping: 1 instance
Quality Score: 80/100

Comparison: compiler_orchestrator.go has 19 properly wrapped errors

Impact

  • Harder to debug activation job generation failures
  • Error messages lack contextual information
  • Stack traces don't show error propagation clearly

Suggested Changes

Add fmt.Errorf with %w for error returns:

Before:

func extractPreActivationCustomFields(...) error {
    if err := validateInput(); err != nil {
        return err  // ❌ No context
    }
    return nil
}

After:

func extractPreActivationCustomFields(...) error {
    if err := validateInput(); err != nil {
        return fmt.Errorf("failed to validate activation input: %w", err)  // ✅ Context
    }
    return nil
}

Files Affected

  • pkg/workflow/compiler_activation_jobs.go (multiple functions)
  • Functions to update:
    • extractPreActivationCustomFields()
    • buildPreActivationJob() (error paths)
    • Helper functions returning errors

Success Criteria

  • All error returns use fmt.Errorf with %w
  • Error messages provide context about which activation check failed
  • Consistent error wrapping pattern across file
  • Error messages actionable (explain what went wrong and where)
  • All tests pass
  • make agent-finish passes

Benefits

  • Better debugging: Clear error context shows exactly where failures occur
  • Consistent patterns: Matches error handling quality of compiler_orchestrator.go
  • Easier troubleshooting: Users get actionable error messages

Priority

Medium - Improves debugging and error handling consistency

Estimated effort: 1-2 hours

Source

Extracted from Daily Compiler Code Quality Report discussion #11591

Analysis quote:

"Limited Error Wrapping (Medium Priority) - Only 1 instance of fmt.Errorf with %w. Most error returns lack contextual information. Impact: Harder to debug issues in activation job generation"

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 7, 2026, 2:02 PM UTC

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions