cog
7c2fbbe6 - Implement operation input resolution for cross-phase file operations

Commit
248 days ago
Implement operation input resolution for cross-phase file operations Adds support for blocks to reference outputs from other phases in their Copy, Add, and Mount operations. This enables the UV block to copy files from the build phase to the export phase without knowing specific stage IDs. ## Key Changes **New Phase Resolution Methods:** - `resolvePhaseInputStage()`: Gets the last stage before a phase starts - `resolvePhaseOutputStage()`: Gets the accumulated result through a phase - Both methods handle empty phases by walking backwards to find actual stages **Operation Input Resolution:** - `resolveOperationInputs()`: Resolves phase/stage references in Copy, Add, and Mount operations - `resolveInputForOperation()`: Handles operation-level input resolution - Integrated into `convertStage()` during plan composition **Phase Pre-registration:** - `NewPlanComposer()` now pre-registers all standard phases in order - `newPlanComposerWithPhases()`: Private constructor for custom phase lists - `DefaultPhases()`: Returns standard phase list for consistency - Prevents "phase does not exist" errors when referencing empty phases **New Phase Constant:** - `PhaseBuildComplete`: Represents final build output for cross-phase references **Comprehensive Testing:** - Tests for both phase resolution methods with empty phase handling - Tests for operation input resolution with various input types - Test helper `newTestComposer()` for simplified test setup - Edge case coverage for nil phases and invalid references ## Design Rationale This implementation allows blocks to use semantic phase references like `Input{Phase: PhaseBuildComplete}` in Copy operations, which resolve to the actual final build stage regardless of what other blocks add stages later. The separate input/output resolution methods provide clear semantics: - Input resolution: "What would be the input TO this phase?" - Output resolution: "What is the accumulated result FROM this phase?" Phase pre-registration ensures robust resolution even when phases are empty, enabling reliable cross-phase references in complex build scenarios. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Author
Parents
Loading