Repository navigation
feat(cli): migration ingest stores local bundles without planning - #77
Merged
Merged
Conversation
A verify.sql corrected after a migration was applied could not be stored:
migration plan ingests inside the planning transaction and then refuses an
applied migration with MIGRATION_ALREADY_APPLIED, so nothing is kept, and no
command called the existing ingestBundles route.
migration ingest submits the exact bytes of the named local bundles (default:
all) to POST /projects/{projectId}/bundles (migration.bundle.ingest, scope
migrations.plan), prints each migration's status and revision, and names the
migration verify --revision command to run next for a verify_revision. It
plans, applies and reads no target.
davdxpx
marked this pull request as ready for review
November 11, 2026 21:02
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
exponetdb migration ingest [migration…]: it submits the exact bytes of the named local bundles (default: every local bundle) to the existingPOST /projects/{projectId}/bundles(migration.bundle.ingest, scopemigrations.plan) and prints each migration's id, name, revision, status and apply checksum. For averify_revisionit names the next command,exponetdb migration verify <id> --revision <n> --target <target>. It makes no plan, applies nothing and reads no target.Why
A
verify.sqlcorrected after its migration was applied could not be stored anywhere:migration planingests inside the planning transaction and then refuses an applied migration withMIGRATION_ALREADY_APPLIED; the refusal rolls the ingestion back, so no revision exists (checked on REOSA staging with the same checksum:migration verify --revision 2stayedNOT_FOUND).MIGRATION_DEPENDENCY_UNKNOWN).ingestBundlesinpackages/migrations-engine/src/store.ts, statusverify_revision) were complete, but neither the CLI nor the MCP called it.On REOSA this left two migrations applied on staging with
verification failedonly because of averify.sqlbug, and production refuses them without break-glass.exponetdb-docs/04-migrations/verification.mdalready described step 2 ("the new bundle revision is ingested") without a way to do it.Changes
apps/cli/src/commands/migration.ts: the new command, the project id resolved from the project path likeproject linkdoes (projectRef, now exported fromregistry.ts).exponetdb-docs/04-migrations/verification.md: how a verify revision is stored, with the observedmigration planbehavior marked[OBSERVED].exponetdb-docs/15-cli/reference.md: regenerated (bun run reference).apps/cli/test/migration-ingest.test.ts: seven tests against the fake API.No server, contract or Control Store change; no constitution exception.
Checked
bun run check,tscofapps/cli, the whole CLI test suite (231 tests, 7 new),bun run boundaries,bun run secrets,bun run verify:generated: all green (Node 24.22.1; the WSL default Node is 18).migration verifyhint forstored/unchanged, no request other thanGET /projectsand the ingestPOST, an unknown id refused before anything is sent, a server refusal shown with a non-zero exit, and the help text naming the scope and action.Not checked
db.exponet.cloud. The first real use needs a sign-in withmigrations.plan:verify.sqlof an already applied checksum asverify_revisionis read fromingestBundles(an existing revision with the same apply checksum), not yet observed end to end.vendor/exponetdb/exponetdb-cli-0.6.0.tgzthere) is not rebuilt here, and the CLI version is not changed.