Skip to content

[Code Quality] Improve error wrapping in compiler_activation_jobs.go #13730

@github-actions

Description

@github-actions

Description

The compiler_activation_jobs.go file has only 30.8% error wrapping rate (4 out of 13 errors use %w), significantly below the recommended 80%+ threshold. This makes debugging more difficult as error chains are incomplete.

Source: Identified in Daily Compiler Code Quality Report - Feb 3, 2026

Current Issue

While the file has 13 error creation points, only 4 properly wrap errors using %w format specifier. This prevents error chains from being preserved, making it harder to trace the root cause of issues during debugging.

Comparison with other compiler files:

  • compiler_yaml_main_job.go: 100% error wrapping ✅
  • compiler_yaml.go: 100% error wrapping ✅
  • compiler_activation_jobs.go: 30.8% error wrapping ❌

Suggested Changes

Review all fmt.Errorf calls in compiler_activation_jobs.go and add %w wrapping where appropriate:

Example Pattern

Before (No wrapping):

if err != nil {
    return fmt.Errorf("failed to build activation job: %v", err)
}

After (With wrapping):

if err != nil {
    return fmt.Errorf("failed to build activation job: %w", err)
}

When to Wrap

  • DO wrap when the error comes from another function call
  • DO wrap when you want to preserve the error chain for debugging
  • DON'T wrap when creating a new error from scratch (no underlying error)

Files Affected

  • pkg/workflow/compiler_activation_jobs.go (13 error creation points)

Success Criteria

  • Error wrapping rate increases from 30.8% to at least 80% (10+ of 13 errors)
  • All errors from function calls are properly wrapped with %w
  • Error messages remain clear and actionable
  • All existing tests pass
  • Error chains are preserved for debugging

Priority

High - This is a best practice that significantly improves debugging experience. The file is already flagged for refactoring (#13657), so improving error handling now will make future maintenance easier.

Estimated Effort

1-2 hours - Review each error site and add %w where appropriate, then test error chains

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 18, 2026, 1:25 PM UTC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions