feat(orchestrate): X3 firstRun hooks in the up saga (spec 11) - #74
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_runtable under the flock — each firstRun hook runs once; a re-upskips it.workspace destroy/uninstallclear thehook_runrows so a fresh provision re-runs firstRun. DefaultonFailureis abort (a failed first-time migration stops the up rather than leaving a half-seeded stack).--no-hooksskips it.Reuses the existing
hooks.Runner(Ledger + Lock already wired inhookPhase).Tests
firstRun runs once on the first up (marker written once) and is skipped on re-run (count stays 1).
make ci+make determinismgreen.Milestone
M6 complete: X1–X8 done (X3 = preUp/postUp + postPull + firstRun). Only X9
importremains (needs a realdevdocksample to map fields).🤖 Generated with Claude Code