-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Description
The ParseWorkflowFile() function in compiler_orchestrator.go is approximately 500+ lines and handles multiple concerns: parsing, validation, engine configuration, imports, and network permissions. This high complexity makes it difficult to test individual concerns and increases maintenance burden.
Current State
File: pkg/workflow/compiler_orchestrator.go
Size: 869 lines total
Function: ParseWorkflowFile() ~500 lines
Quality Score: 81/100
Suggested Changes
Split ParseWorkflowFile() into focused functions:
parseAndValidateFrontmatter()- Extract frontmatter parsing and basic validationprocessImportsAndIncludes()- Extract import processing logicvalidateAndConfigureEngine()- Extract engine configuration and validationextractNetworkPermissions()- Extract network permission handling
Files Affected
pkg/workflow/compiler_orchestrator.go(lines ~200-700)pkg/workflow/compiler_orchestrator_test.go(update tests for new functions)
Success Criteria
-
ParseWorkflowFile()reduced to < 200 lines - Each extracted function has single responsibility
- Unit tests added for each new function
- All existing tests pass
- Error handling preserved with proper wrapping
-
make agent-finishpasses
Benefits
- Improved testability: Each concern can be tested independently
- Reduced complexity: Easier to understand and modify
- Better error handling: Clearer error context for each phase
- Maintainability: Changes to one concern don't affect others
Priority
High - Function complexity directly impacts maintainability
Estimated effort: 4-6 hours
Source
Extracted from Daily Compiler Code Quality Report discussion #11591
Analysis quote:
"Very Long Function (High Priority) -
ParseWorkflowFile()is approximately 500+ lines. Issue: Handles parsing, validation, engine config, imports, network permissions, and more. Impact: Difficult to test individual concerns, high complexity"
AI generated by Discussion Task Miner - Code Quality Improvement Agent
- expires on Feb 7, 2026, 2:02 PM UTC