-
Notifications
You must be signed in to change notification settings - Fork 268
Description
Description
The buildAllJobs() function in pkg/workflow/compiler_jobs.go is 140+ lines and handles multiple responsibilities: activation, main, safe outputs, repo-memory, and cache-memory jobs. This violates the Single Responsibility Principle and makes the code harder to test and maintain.
Suggested Changes
Extract job-specific logic into smaller helper functions:
// Current: buildAllJobs() - 140 lines
// Proposed:
func buildAllJobs() error {
c.buildPreActivationAndActivationJobs()
c.buildMainJob()
c.buildSafeOutputsJobs()
c.buildMemoryManagementJobs()
}Each extracted function should be 30-40 lines focused on one job type.
Files Affected
pkg/workflow/compiler_jobs.go(lines 133-277)- New helper functions in same file
Success Criteria
buildAllJobs()orchestrates without implementation details (<20 lines)- Each extracted function is 30-40 lines
- All existing tests continue to pass
- Test coverage remains at 1.17:1 ratio or higher
- Function complexity is reduced (easier to read and understand)
Benefits
- Improved readability and maintainability
- Easier to test individual job types
- Better adherence to Single Responsibility Principle
- Consistent with project style (avg function length ~45 lines)
Priority
Medium - The current implementation works but violates best practices. Refactoring will improve long-term maintainability.
Source
Extracted from Daily Compiler Code Quality Report - 2026-02-01 #13034 - marked as "Short-term Improvements (Medium Priority)"
Estimated Effort: 2-3 hours
AI generated by Discussion Task Miner - Code Quality Improvement Agent
- expires on Feb 15, 2026, 5:30 AM UTC