Skip to content

feat(orchestrate): X3 firstRun hooks in the up saga (spec 11) - #74

Merged
gustavobertoi merged 1 commit into
mainfrom
nightly/X3-firstrun
Jun 29, 2026
Merged

feat(orchestrate): X3 firstRun hooks in the up saga (spec 11)#74
gustavobertoi merged 1 commit into
mainfrom
nightly/X3-firstrun

Conversation

@gustavobertoi

Copy link
Copy Markdown
Contributor

What

Adds the firstRun lifecycle phase — unblocked by the provision phase. Completes X3.

firstRun hooks run exactly once per project (seed/migrate against the freshly provisioned DB), placed after compose-up (the container + its provisioned database exist) and before postUp.

How

Idempotency is ledger-backed, keyed per hook name via the hook_run table under the flock — each firstRun hook runs once; a re-up skips it. workspace destroy/uninstall clear the hook_run rows so a fresh provision re-runs firstRun. Default onFailure is abort (a failed first-time migration stops the up rather than leaving a half-seeded stack). --no-hooks skips it.

Reuses the existing hooks.Runner (Ledger + Lock already wired in hookPhase).

Tests

firstRun runs once on the first up (marker written once) and is skipped on re-run (count stays 1). make ci + make determinism green.

Milestone

M6 complete: X1–X8 done (X3 = preUp/postUp + postPull + firstRun). Only X9 import remains (needs a real devdock sample to map fields).

🤖 Generated with Claude Code

…MPLETE

Adds the firstRun lifecycle phase, now unblocked by the provision phase. firstRun
hooks run exactly ONCE per project (e.g. seed/migrate against the freshly
provisioned database), placed after compose-up (the container + its provisioned DB
exist) and before postUp.

Idempotency is ledger-backed and keyed per hook NAME via the hook_run table under
the flock, so each firstRun hook runs once and a re-`up` skips it;
`workspace destroy`/`uninstall` clear the hook_run rows so a fresh provision
re-runs firstRun. Default onFailure is abort — a failed first-time migration stops
the up rather than leaving a half-seeded stack. `--no-hooks` skips it.

Tested: firstRun runs once on the first up (marker written once) and is skipped on
re-run (count stays 1), via the existing ledger-backed Runner. `make ci` +
`make determinism` green.

With this, M6 (saga completion + glue) is complete: X1–X8 done (X3 preUp/postUp +
postPull + firstRun all in); only X9 `import` remains (needs a devdock sample).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gustavobertoi
gustavobertoi merged commit 44112db into main Jun 29, 2026
3 checks passed
@gustavobertoi
gustavobertoi deleted the nightly/X3-firstrun branch June 29, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant