fix(stack-prisma): reclassify EQL install as additive so fresh-database db init passes, and pin eql-3.0.4 - #820
Conversation
📝 WalkthroughWalkthroughThe PR updates EQL to 3.0.4, re-emits the baseline install migration as additive with invariant carriers, adds a data-classed 3.0.4 upgrade self-edge, wires migration metadata, and updates tests and documentation. ChangesEQL 3.0.4 migration flow
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🦋 Changeset detectedLatest commit: 9ad92c4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Addresses review on #820: the install baseline must target the latest EQL release, not 3.0.2. - @cipherstash/eql pinned 3.0.2 -> 3.0.4 in prisma-next, cli, and stack (lockfile updated via the one-off cooldown bypass; @cipherstash/eql is already in minimumReleaseAgeExclude as a first-party package) - the re-emitted install baseline now bakes the eql-3.0.4 bundle and carries BOTH upgrade invariants (3.0.2 + 3.0.4) via no-SQL additive carrier ops, so fresh-database `db init` still satisfies the head ref from the single all-additive genesis edge - new `data`-classed 3.0.4 upgrade self-edge (20260728T0000_upgrade_eql_v3_3_0_4) for databases installed at an older bundle, walked via `migrate` only - head ref gains the 3.0.4 invariant; descriptor wires the new edge; example vendored space synced; changeset added Tests: prisma-next 345 passed (frozen-hash pins re-pinned for the re-emitted baseline, new edge pinned); stack 1107; cli 947. Verified live against a consumer app: fresh-database `db init` applies the cipherstash space additively and `eql_v3.version()` reports 3.0.4.
There was a problem hiding this comment.
Pull request overview
This PR updates the @cipherstash/prisma-next contract-space migration graph so fresh-database prisma-next db init can succeed under an additive-only policy, while still preserving data-classed self-edge upgrades for already-installed databases. It also bumps the pinned @cipherstash/eql bundle to 3.0.4 across the repo and re-pins the frozen migration artefact assertions accordingly.
Changes:
- Reclassify the v3 baseline install op as
additiveand add additive, no-SQL “invariant carrier” ops so a fresh database satisfies head invariants without traversingdataself-edges. - Add a new
data-classed 3.0.4 upgrade self-edge migration and extend head invariants to include the 3.0.4 invariant. - Bump pinned
@cipherstash/eqlto 3.0.4 (cli/stack/prisma-next) and sync the example’s vendored cipherstash migration refs; add a changeset.
Reviewed changes
Copilot reviewed 16 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Updates lockfile entries for @cipherstash/eql@3.0.4. |
| packages/stack/package.json | Pins devDependency @cipherstash/eql to 3.0.4. |
| packages/cli/package.json | Pins dependency @cipherstash/eql to 3.0.4. |
| packages/prisma-next/package.json | Pins dependency @cipherstash/eql to 3.0.4. |
| packages/prisma-next/src/extension-metadata/constants-v3.ts | Adds 3.0.4 upgrade migration name and invariant constant. |
| packages/prisma-next/src/exports/control.ts | Publishes the new 3.0.4 upgrade migration edge in the descriptor. |
| packages/prisma-next/migrations/refs/head.json | Extends head invariants to include the 3.0.4 upgrade invariant. |
| packages/prisma-next/migrations/20260601T0100_install_eql_v3_bundle/migration.ts | Reclassifies baseline install op to additive and adds invariant-carrier ops. |
| packages/prisma-next/migrations/20260601T0100_install_eql_v3_bundle/migration.json | Updates baseline provided invariants and migrationHash. |
| packages/prisma-next/migrations/20260728T0000_upgrade_eql_v3_3_0_4/migration.ts | Adds a new 3.0.4 upgrade self-edge migration (data-classed). |
| packages/prisma-next/migrations/20260728T0000_upgrade_eql_v3_3_0_4/migration.json | Records the 3.0.4 upgrade edge metadata and migrationHash. |
| packages/prisma-next/test/v3/migration-v3.test.ts | Re-pins frozen migration artefact hashes/digests and adds assertions for the 3.0.4 upgrade edge + carriers. |
| packages/prisma-next/test/descriptor.test.ts | Updates descriptor expectations for three migrations and deduped invariant coverage. |
| examples/prisma/migrations/cipherstash/refs/head.json | Syncs example vendored head ref invariants (adds 3.0.4). |
| examples/prisma/migrations/cipherstash/20260601T0100_install_eql_v3_bundle/migration.json | Syncs example vendored baseline migration metadata to match re-emit. |
| examples/prisma/migrations/cipherstash/20260728T0000_upgrade_eql_v3_3_0_4/migration.json | Adds example vendored 3.0.4 upgrade migration metadata. |
| .changeset/eql-additive-install-304.md | Adds a changeset describing the db init fix and EQL 3.0.4 bump. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (1)
packages/prisma-next/test/v3/migration-v3.test.ts:141
- The test title/comment says there are "two" additive ops, but the baseline migration now contains three ops (install + two invariant carriers). This mismatch makes the test misleading for future maintainers reading failures or grepping for expected behavior.
it('installs under the v3 invariants with two additive rawSql ops', () => {
// Two ops, both `additive`, so fresh-database `db init` (additive-only
// policy) can walk this genesis edge: the bundle install itself, plus a
// no-SQL carrier op that declares the 3.0.2 upgrade invariant (the baked
// bundle IS the pinned release, so a fresh install lands at 3.0.2 and
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Addresses review on #820: the install baseline must target the latest EQL release, not 3.0.2. - @cipherstash/eql pinned 3.0.2 -> 3.0.4 in prisma-next, cli, and stack (lockfile updated via the one-off cooldown bypass; @cipherstash/eql is already in minimumReleaseAgeExclude as a first-party package) - the re-emitted install baseline now bakes the eql-3.0.4 bundle and carries BOTH upgrade invariants (3.0.2 + 3.0.4) via no-SQL additive carrier ops, so fresh-database `db init` still satisfies the head ref from the single all-additive genesis edge - new `data`-classed 3.0.4 upgrade self-edge (20260728T0000_upgrade_eql_v3_3_0_4) for databases installed at an older bundle, walked via `migrate` only - head ref gains the 3.0.4 invariant; descriptor wires the new edge; example vendored space synced; changeset added Tests: prisma-next 345 passed (frozen-hash pins re-pinned for the re-emitted baseline, new edge pinned); stack 1107; cli 947. Verified live against a consumer app: fresh-database `db init` applies the cipherstash space additively and `eql_v3.version()` reports 3.0.4.
b22cc69 to
053441f
Compare
Addresses review on #820: the install baseline must target the latest EQL release, not 3.0.2. - @cipherstash/eql pinned 3.0.2 -> 3.0.4 in prisma-next, cli, and stack (lockfile updated via the one-off cooldown bypass; @cipherstash/eql is already in minimumReleaseAgeExclude as a first-party package) - the re-emitted install baseline now bakes the eql-3.0.4 bundle and carries BOTH upgrade invariants (3.0.2 + 3.0.4) via no-SQL additive carrier ops, so fresh-database `db init` still satisfies the head ref from the single all-additive genesis edge - new `data`-classed 3.0.4 upgrade self-edge (20260728T0000_upgrade_eql_v3_3_0_4) for databases installed at an older bundle, walked via `migrate` only - head ref gains the 3.0.4 invariant; descriptor wires the new edge; example vendored space synced; changeset added Tests: prisma-next 345 passed (frozen-hash pins re-pinned for the re-emitted baseline, new edge pinned); stack 1107; cli 947. Verified live against a consumer app: fresh-database `db init` applies the cipherstash space additively and `eql_v3.version()` reports 3.0.4.
…820 review) Addresses Copilot review on #820. The 3.0.4 bump left three comments describing the 3.0.2-era state: - the install migration's invariant-carrier comment still named the baked bundle `eql-3.0.2` while the same sentence called the pinned release 3.0.4 - the same file's PUBLISHED banner described the re-emit as adding one 3.0.2 carrier, omitting the bundle bump, the second carrier, and the fact that the baked `installSqlSha256` changed too (not just the `migrationHash`) - the baseline test was still named "two additive rawSql ops" and its comment described a single carrier landing at 3.0.2, while the assertion below it already expected three ops Comments only — `migrationHash` covers `ops.json` and `migration.json`, not `migration.ts`, so the published artefact identity is untouched (frozen-hash pins still pass).
053441f to
7a6badd
Compare
`prisma-next db init` enforces an additive-only operation policy, but the cipherstash space's install-eql-v3-bundle op was classed `data`, so every fresh-database init — including Prisma Compute's GitHub preview deploys — failed with PN-RUN-3020 (POLICY_VIOLATION). The `data` class existed to satisfy the aggregate integrity checker's no-op self-edge rule, but that rule only fires when from === to; the genesis edge runs from: null → the empty-storage hash and is not a self-edge, so `additive` — the truthful class for a bundle that only CREATEs its own schemas/domains/functions — passes the checker. The 3.0.2 upgrade edge IS a true self-edge and must keep its `data` class. To stop fresh databases needing that edge at all, the re-emitted install edge now also carries the 3.0.2 upgrade invariant via a no-SQL additive carrier op (the baked bundle is already the pinned 3.0.2 release). The shortest-path planner then satisfies the head ref from the single all-additive genesis edge; databases installed at 3.0.0 still reach 3.0.2 through the upgrade edge via `migrate`, whose policy allows all classes. This is a one-time authorized pre-GA re-emit of the published install artefact (migrationHash changes). RC consumers with a vendored migrations/cipherstash/ must refresh the install package's ops.json and migration.json (or delete the space dir and re-run migration plan). The baked SQL digest is unchanged. The example app's vendored copy is synced. Verified end-to-end against a consumer app: `prisma-next migration check` passes, and `prisma-next db init` on a fresh database applies the cipherstash space additively (previously PN-RUN-3020), installing eql_v3 with both encrypted-column domains, then signs the database.
Addresses review on #820: the install baseline must target the latest EQL release, not 3.0.2. - @cipherstash/eql pinned 3.0.2 -> 3.0.4 in prisma-next, cli, and stack (lockfile updated via the one-off cooldown bypass; @cipherstash/eql is already in minimumReleaseAgeExclude as a first-party package) - the re-emitted install baseline now bakes the eql-3.0.4 bundle and carries BOTH upgrade invariants (3.0.2 + 3.0.4) via no-SQL additive carrier ops, so fresh-database `db init` still satisfies the head ref from the single all-additive genesis edge - new `data`-classed 3.0.4 upgrade self-edge (20260728T0000_upgrade_eql_v3_3_0_4) for databases installed at an older bundle, walked via `migrate` only - head ref gains the 3.0.4 invariant; descriptor wires the new edge; example vendored space synced; changeset added Tests: prisma-next 345 passed (frozen-hash pins re-pinned for the re-emitted baseline, new edge pinned); stack 1107; cli 947. Verified live against a consumer app: fresh-database `db init` applies the cipherstash space additively and `eql_v3.version()` reports 3.0.4.
…820 review) Addresses Copilot review on #820. The 3.0.4 bump left three comments describing the 3.0.2-era state: - the install migration's invariant-carrier comment still named the baked bundle `eql-3.0.2` while the same sentence called the pinned release 3.0.4 - the same file's PUBLISHED banner described the re-emit as adding one 3.0.2 carrier, omitting the bundle bump, the second carrier, and the fact that the baked `installSqlSha256` changed too (not just the `migrationHash`) - the baseline test was still named "two additive rawSql ops" and its comment described a single carrier landing at 3.0.2, while the assertion below it already expected three ops Comments only — `migrationHash` covers `ops.json` and `migration.json`, not `migration.ts`, so the published artefact identity is untouched (frozen-hash pins still pass).
025dd25 to
9ad92c4
Compare
Closes #850.
Problem
Prisma Compute's GitHub preview deploy runs
prisma-next db init(additive-only policy) against each branch database. The cipherstash space'sinstall-eql-v3-bundleop is classeddata, so every preview deploy of an app using@cipherstash/stack-prismafails:Hit in a live dogfooding run (rc.4 consumer app + Compute push-to-deploy).
Why
datawas there, and why it's safe to changeThe in-file rationale says
datasatisfies the aggregate integrity checker's no-op self-edge rule (sameSourceAndTarget, PN-MIG-CHECK-007). Verified againstmigration-tools0.16.0: that rule only fires whenfrom === to. The genesis edge runsfrom: null→ the empty-storage hash — not a self-edge — soadditivepasses the checker. Empirically confirmed both ways: flipping an upgrade edge (a trueA → Aself-edge) to additive trips PN-MIG-CHECK-007; flipping the install edge does not.additiveis also the truthful class on the policy axis: the bundle only CREATEs its own schemas, domains, and functions; it cannot damage user data.Keeping fresh databases off the upgrade self-edges
The upgrade edges must keep
data(true self-edges). So the re-emitted install edge now also carries every upgrade invariant via no-SQL additive carrier ops — legitimate because the baked bundle already IS the pinned release, a superset of every earlier v3 surface.computeExtensionSpaceApplyPathpicks the shortest invariant-covering path, so a fresh database satisfies the head ref from the single all-additive genesis edge and never walks an upgrade edge. Databases installed at an older bundle still upgrade through those edges viamigrate(all classes allowed).EQL bundle pinned 3.0.2 → 3.0.4
Per review, the install baseline should target the latest EQL release:
@cipherstash/eqlpinned3.0.2→3.0.4instack-prisma,cli, andstack(already inminimumReleaseAgeExcludeas a first-party package, so no cooldown bypass needed)data-classed 3.0.4 upgrade self-edge (20260728T0000_upgrade_eql_v3_3_0_4) for databases installed at an older bundle, walked viamigrateonlyConsumer impact (pre-GA, deliberate)
One-time authorized re-emit of a published artefact. Both content-addressed pins on the install package change: its
migrationHashand its bakedinstallSqlSha256— the latter because the baked SQL is now the 3.0.4 bundle rather than 3.0.2. (An earlier revision of this description claimed the baked digest was unchanged; that was true only of the pre-3.0.4 version of this branch — thanks @copilot for catching it.) The 3.0.2 upgrade edge keeps its own original digest, pinned to its own release.RC consumers with a vendored
migrations/cipherstash/should delete the space directory and re-runprisma-next migration planto pick up the re-emitted artefacts. Frozen-hash tests re-pinned with a comment recording the exception; example app's vendored copy synced.Verification
@cipherstash/stack-prisma: 345 passed / 27 skipped (frozen-hash pins re-pinned for the re-emitted baseline, new edge pinned)@cipherstash/stack: 1017 passed;stash: 931 passed; supply-chain e2e: 18 passed;code:check0 errorspnpm install --frozen-lockfileclean — lockfile diff is eql-only (9 lines)migration checkpasses;db initon a fresh database succeeds (previously PN-RUN-3020), applying the cipherstash space additively, witheql_v3.version()reporting 3.0.4migrate, confirmed on the dogfooding appBranch housekeeping
This branch originally targeted
remove_v2; when that merged as a squash the base retargeted tomainbut the fork point did not, leaving 100 commits and a conflicted diff. Rebased ontomaindown to this PR's own commits, with thepackages/prisma-next→packages/stack-prismarename (#844) applied and the changeset key corrected to@cipherstash/stack-prisma. All commits are GPG-signed.Closes #850.
Related: #819 (backfill support, same dogfooding run).
Summary by CodeRabbit
prisma-next db initcompletes successfully, including Prisma Compute preview deployments.