-
Notifications
You must be signed in to change notification settings - Fork 43
Closed
Description
Objective
Reduce the complexity of compiler.go (1600+ lines) by extracting detection and validation methods into more focused files.
Context
The main compiler.go file contains a mix of core compilation logic, validation logic, parsing logic, and configuration detection. This is Issue #2 from the semantic function clustering analysis (Priority 2: Medium Impact, Medium Effort). Extracting non-core logic will improve maintainability and separation of concerns.
Related to #3478
Approach
- Review
compiler.goand identify methods suitable for extraction - Extract
detectTextOutputUsageto a detection-focused file (e.g.,detection.goortext_output_detection.go) - Extract
computeAllowedDomainsForSanitizationto a domain-related file (e.g.,domain_sanitization.goor integrate into existing validation) - Extract
parseBaseSafeOutputConfigif it's primarily validation-focused - Ensure all methods maintain their current functionality
- Update tests and imports
- Verify full test suite passes
Files to Modify
- Update:
pkg/workflow/compiler.go(remove extracted methods) - Create:
pkg/workflow/detection.goor similar (for detection methods) - Create/Update: Domain-related file for sanitization logic
- Update: Test files that reference these methods
Acceptance Criteria
-
compiler.goreduced in size by extracting non-core logic -
detectTextOutputUsagemoved to appropriate file -
computeAllowedDomainsForSanitizationmoved to appropriate file -
parseBaseSafeOutputConfigreviewed and potentially extracted - All extracted methods maintain current functionality
- All tests pass
- Better separation of concerns achieved
- Compiler file focused on core compilation logic
Estimated Effort
3-4 hours
Benefits
- Smaller, more focused compiler.go
- Better separation of concerns
- Improved testability of extracted components
- Easier to navigate and understand the compilation process
- Reduced complexity in the main compiler file
Note
This is a larger refactoring task. Consider breaking it down further if needed, starting with the most straightforward extraction (detectTextOutputUsage) and then proceeding to others.
Related to #3478
AI generated by Plan Command for #3478
Copilot