Skip to content

Guard preview migration transaction boundaries - #322

Merged
aRustyDev merged 2 commits into
mainfrom
codex/preview-migration-execution
Nov 19, 2026
Merged

aRustyDev merged 2 commits into
mainfrom
codex/preview-migration-execution

Conversation

@aRustyDev

@aRustyDev aRustyDev commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Run supplied migration SQL inside a PostgreSQL exception-handling subtransaction while holding the transaction-scoped migration lock. SQL is encoded as data before constructing the guard so its contents cannot escape the wrapper. The guard protects the transaction boundary; the caller must still authorize the PR and provide restricted credentials and isolated resources.

Two historical migrations check constraint names across all schemas, causing later previews to miss constraints. For their exact original SQL, a preview-scoped catalog view fixes those checks without changing migration bytes or ledger checksums. The view is removed in the same transaction, and creation fails if an object already occupies its name.

Generated encoding tests and real PostgreSQL models cover transaction escape attempts, four preview roles on one database, checksum preservation, catalog-view collisions, and denial of writes to public. The multi-schema model failed against the uncorrected migrations and passes with this fix. Local checks include 166 hermetic Postgres tests, formatting and clippy. Live Hyperdrive and the eventual authorized caller remain to be validated.

Reference: https://www.postgresql.org/docs/current/plpgsql-transactions.html

@aRustyDev
aRustyDev temporarily deployed to preview-control-plane November 19, 2026 01:31 — with GitHub Actions Inactive
@aRustyDev
aRustyDev temporarily deployed to preview-control-plane November 19, 2026 02:12 — with GitHub Actions Inactive
@aRustyDev
aRustyDev marked this pull request as ready for review November 19, 2026 02:31
@aRustyDev
aRustyDev merged commit 0a617a0 into main Nov 19, 2026
78 of 81 checks passed
@aRustyDev
aRustyDev deleted the codex/preview-migration-execution branch November 19, 2026 02:35

This branch was previously deployed

1 inactive deployment
preview-control-plane — 660733ae Deployed Nov 19, 2026 by aRustyDev via reconcile #205
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