Skip to content

[Code Quality] Increase test coverage for compiler_jobs.go #14232

@github-actions

Description

@github-actions

Description

The compiler_jobs.go file has a test/source ratio of 0.47:1 (215 test lines for 460 source lines), below the recommended 0.8:1 threshold. Complex job orchestration logic may have untested edge cases that could lead to runtime failures.

Current State

  • File: pkg/workflow/compiler_jobs.go (460 lines)
  • Test File: pkg/workflow/compiler_jobs_test.go (215 lines)
  • Test/Source Ratio: 0.47:1 (target: 0.8:1 = ~370 test lines)
  • Gap: Need ~155 additional test lines

Suggested Changes

Add comprehensive table-driven tests focusing on:

  1. Custom job dependency resolution

    • Test jobs depending on pre-activation
    • Test jobs with multiple dependencies
    • Test circular dependency detection (if implemented)
  2. Job ordering scenarios

    • Test correct ordering with complex dependency graphs
    • Test jobs that depend on main job
    • Test jobs that depend on detection job
  3. Edge cases in special jobs

    • Test push_repo_memory job with various configurations
    • Test cache_memory job generation
    • Test custom job output references
  4. Job manager state validation

    • Validate job manager state after complex builds
    • Test job manager with conflicting requirements

Example Test Structure

func TestCustomJobDependencyResolution(t *testing.T) {
    tests := []struct {
        name           string
        jobConfig      map[string]any
        expectedDeps   []string
        shouldHaveError bool
    }{
        {
            name: "job depends on pre-activation",
            jobConfig: map[string]any{
                "needs": "pre-activation",
            },
            expectedDeps: []string{"pre-activation"},
        },
        // Add more test cases
    }
    
    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            // Test implementation
        })
    }
}

Files Affected

  • pkg/workflow/compiler_jobs_test.go (add ~155 lines)

Success Criteria

  • Test/source ratio ≥0.8:1 (~370 total test lines)
  • At least 3-5 new test functions added
  • All edge cases covered with table-driven tests
  • All existing tests continue to pass
  • Tests include both success and error paths

Priority

Medium - Complex orchestration needs comprehensive tests to catch edge cases

Estimated Effort

2-4 hours

Source

Extracted from:

Listed as "Short-term Improvement" (Medium Priority) in compiler quality report.

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