Skip to content

[Code Quality] Standardize error wrapping across compiler files #14233

@github-actions

Description

@github-actions

Description

Compiler files have inconsistent error wrapping patterns. Some files properly wrap errors with %w (89% in compiler_jobs.go) while others only wrap 50% of errors (compiler_yaml_main_job.go). Standardizing error wrapping improves error traceability and debugging.

Current State

  • compiler_yaml_main_job.go: 1/2 errors wrapped (50%)
  • compiler_activation_jobs.go: 4/4 errors wrapped (100%) ✅
  • Issue: Line 66 in compiler_yaml_main_job.go - error only logged, not returned

Example Issues

Before (Line 66):

if err != nil {
    compilerYamlLog.Printf("Warning: failed to marshal repository imports: %v", err)
}

After:

if err != nil {
    return fmt.Errorf("failed to marshal repository imports for merge step: %w", err)
}

Suggested Changes

  1. Audit all fmt.Errorf calls in compiler files
  2. Ensure consistent %w usage when wrapping errors
  3. Fix line 66 in compiler_yaml_main_job.go - return error instead of just logging
  4. Add error context where missing

Files Affected

  • pkg/workflow/compiler_yaml_main_job.go (1 error needs fixing)
  • pkg/workflow/compiler_activation_jobs.go (9 missing %w - if not already fixed)
  • Other compiler files in pkg/workflow/compiler_*.go (audit needed)

Success Criteria

  • All fmt.Errorf calls use %w when wrapping errors
  • No errors are only logged without being returned
  • All existing tests continue to pass
  • Error messages include helpful context

Priority

High - Improves error traceability and debugging experience

Estimated Effort

30-60 minutes

Source

Extracted from:

Listed as "Immediate Action" in both compiler quality reports.

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 7, 2026, 9:07 PM UTC

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions