Sandbox Creation Saga
Convert sandbox creation to use saga framework, replacing manual defer-based cleanup with crash-recoverable saga pattern.
Scope
Extract Actions from SandboxController.createSandbox:
NetworkAllocatorAction- allocate network, compensate by deallocatingSpecBuilderAction- build container spec (pure, no compensation)VolumeConfiguratorAction- configure volumesContainerCreatorAction- create pause containerTaskBooterAction- boot initial taskContainersBooterAction- boot all containersMetricsAdderAction- add metricsEntitySaverAction- save final sandbox entity
Action Factories:
- Create factories for each action type
- Inject SandboxController dependencies at boot
- Register factories in SagaRegistry
Definition Registration:
- Register "create-sandbox" definition with DAG structure
- Define dependencies between actions
Entry Point:
- Add
CreateSandboxSaga()method alongside existingcreateSandbox() - Feature flag to control which path is used
- Pass sandbox ID and metadata via InitialInputs
Testing:
- Integration tests with MockStore
- Success path verification
- Failure injection at each step, verify compensation
- Crash recovery simulation
- Verify no regressions vs existing implementation
Observability:
- Logging for saga execution
- Metrics on saga duration and success rate
Why One Issue
This is a complete end-to-end saga that proves the framework works in production. Splitting it would leave partial, non-functional code.
Dependencies
Requires: MIR-439 (Saga Framework Foundation)
Reference
RFD 0035: Saga Pattern for Distributed Operations Phase 2 from Migration Strategy