Description
The compiler_jobs.go file has solid error handling (16/16 proper wraps) but below-target test coverage. With a test-to-source ratio of 0.47:1 (target: 0.8:1+), complex orchestration logic may have untested edge cases.
Current State
- File:
pkg/workflow/compiler_jobs.go (460 lines)
- Test File:
compiler_jobs_test.go (215 lines, 7 test functions)
- Current Ratio: 0.47:1 (215 test lines / 460 source lines)
- Target Ratio: 0.8:1+ (recommended for complex orchestration)
- Quality Score: 84/100 (good, but test coverage could improve)
Suggested Changes
Add table-driven tests focusing on:
-
Custom Job Dependency Resolution
- Test jobs depending on pre-activation
- Test jobs with multiple dependencies
- Test circular dependency prevention
-
Job Ordering Scenarios
- Test job execution order with various dependency chains
- Test push_repo_memory job dependency on detection
- Test cache_memory job positioning
-
Edge Cases
- Empty custom jobs array
- Jobs referencing custom job outputs
- Jobs with invalid dependencies
- Jobs with missing required fields
-
Job Manager State Validation
- Verify job manager state after complex builds
- Validate job.Needs relationships are correct
- Test permission calculations for different job types
Files Affected
pkg/workflow/compiler_jobs_test.go (expand from 215 to ~350-400 lines)
Success Criteria
Test Example Pattern
func TestCustomJobDependencyResolution(t *testing.T) {
tests := []struct {
name string
customJobs map[string]any
expectedOrder []string
expectedDeps map[string][]string
}{
{
name: "job depending on pre-activation",
customJobs: map[string]any{
"custom-job": map[string]any{
"needs": "pre-activation",
"steps": []any{...},
},
},
expectedOrder: []string{"pre-activation", "custom-job"},
expectedDeps: map[string][]string{
"custom-job": {"pre-activation"},
},
},
// More test cases...
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Test implementation
})
}
}
Source
Extracted from Daily Compiler Code Quality Report:
Priority
Medium - Complex orchestration logic benefits from comprehensive tests. Estimated 2-4 hours of work.
AI generated by Discussion Task Miner - Code Quality Improvement Agent
Description
The
compiler_jobs.gofile has solid error handling (16/16 proper wraps) but below-target test coverage. With a test-to-source ratio of 0.47:1 (target: 0.8:1+), complex orchestration logic may have untested edge cases.Current State
pkg/workflow/compiler_jobs.go(460 lines)compiler_jobs_test.go(215 lines, 7 test functions)Suggested Changes
Add table-driven tests focusing on:
Custom Job Dependency Resolution
Job Ordering Scenarios
Edge Cases
Job Manager State Validation
Files Affected
pkg/workflow/compiler_jobs_test.go(expand from 215 to ~350-400 lines)Success Criteria
t.Run()make test-unitsuccessfullyTest Example Pattern
Source
Extracted from Daily Compiler Code Quality Report:
Priority
Medium - Complex orchestration logic benefits from comprehensive tests. Estimated 2-4 hours of work.