Commit 301061a
feat(orchestrate): C5b — wire the real up-saga phases (spec 09) (#9)
Assemble the concrete up phases over the C5a engine (BuildUp → []Phase):
preflight → network → generate → shared(health-gated) →
compose-up(per project) → hooks(postUp, per project)
- preflight: docker daemon reachable (full doctor matrix is X6).
- network: idempotent EnsureNetwork(devstack_shared) under the flock — never
auto-removed (no compensation).
- generate: GenerateAll + writeIfChanged; runs BEFORE the compose phases (the
files must exist to `up`) and re-arms on a config edit (fingerprint = the
on-disk workspace/devstack yaml).
- shared: RegisterUp ref rows + `compose up -d` only the shared services the
requested projects `uses`, then health-gate each (Healthy if it declares a
healthcheck, else Started) via internal/health. Compensation drops the refs.
- compose-up (per project): `compose up -d` (+ optional --build); compensation
`compose down` (never -v — a failed up never drops volumes). Re-armed by a
devstack.yaml edit.
- hooks (per project): postUp via internal/hooks (OSExecer + the DB ledger +
flock).
Engine refinement: a FAILED mutating phase now runs its OWN compensation too
(it may have partially applied — e.g. compose-up created containers), while its
saga_phase row is KEPT failed (so `status` can surface it); succeeded phases
still unwind in reverse with their rows cleared.
Deferred + flagged (slot in as more phases, no engine change): clone (gitx),
provision (needs the shared-Postgres host-port coupling), secrets (M4/S6),
trust (N5), firstRun hooks (need the provisioned-volume scope_key).
Wiring is unit-tested with a mock docker client + a fake compose runner + a real
temp ledger + a real temp workspace over the embedded templates: full happy
path (network ensured, refs added, both stacks up'd, files written, postUp ran),
near-instant re-run (all skips bar AlwaysRun preflight/hooks), and a project
compose-up failure that compensates the shared refs to zero and downs the
project. The real end-to-end daemon test lands with G1's isolation harness
(parameterized devstack-it-<pid> network/prefix — the saga must not touch a real
devstack_shared).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent cb128b4 commit 301061a
3 files changed
Lines changed: 626 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
183 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
184 | 187 | | |
185 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
186 | 192 | | |
187 | 193 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
201 | 212 | | |
202 | 213 | | |
203 | 214 | | |
| |||
0 commit comments