Skip to content

Add error wrapping to compiler activation job builders#11670

Merged
pelikhan merged 2 commits intomainfrom
copilot/add-error-wrapping-to-jobs
Jan 24, 2026
Merged

Add error wrapping to compiler activation job builders#11670
pelikhan merged 2 commits intomainfrom
copilot/add-error-wrapping-to-jobs

Conversation

Copy link
Contributor

Copilot AI commented Jan 24, 2026

The compiler_activation_jobs.go file had only 1 of 4 error returns using proper error wrapping with %w, making activation job failures harder to debug. This adds wrapping to the remaining unwrapped errors.

Changes

  • Wrap error in buildPreActivationJob when custom field extraction fails
  • Wrap error in buildMainJob when main job step generation fails

Example

Before:

customSteps, customOutputs, err := c.extractPreActivationCustomFields(data.Jobs)
if err != nil {
    return nil, err  // No context
}

After:

customSteps, customOutputs, err := c.extractPreActivationCustomFields(data.Jobs)
if err != nil {
    return nil, fmt.Errorf("failed to extract pre-activation custom fields: %w", err)
}

Error messages now clearly indicate which activation operation failed, matching the error handling pattern in compiler_orchestrator.go (19 wrapped errors).

Original prompt

This section details on the original issue you should resolve

<issue_title>[Code Quality] Add error wrapping to compiler activation job builders</issue_title>
<issue_description>### 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 githubnext/gh-aw#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

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Wrap error in buildPreActivationJob when extracting custom fields
- Wrap error in buildMainJob when generating main job steps
- Improves debugging by providing context about where failures occur
- Increases error wrapping from 1 to 3 instances in file
- All activation tests pass

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add error wrapping to compiler activation job builders Add error wrapping to compiler activation job builders Jan 24, 2026
Copilot AI requested a review from pelikhan January 24, 2026 15:11
@pelikhan pelikhan marked this pull request as ready for review January 24, 2026 15:42
@pelikhan pelikhan merged commit 03efa30 into main Jan 24, 2026
@pelikhan pelikhan deleted the copilot/add-error-wrapping-to-jobs branch January 24, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants