Skip to content

Commit 966be05

Browse files
authored
Merge pull request #1006 from cipherstash/feat/stack-prisma-bake-eql-3-0-6
feat(stack-prisma): bake EQL 3.0.6 into the migrations
2 parents 9d221fb + c20df92 commit 966be05

27 files changed

Lines changed: 808 additions & 161 deletions

File tree

‎.changeset/eql-3-0-5-migration.md‎

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Any RLS policy, view, or constraint that calls an `eql_v3` function is dropped
5050
by the same CASCADE and needs recreating too. **The rename itself needs no
5151
action — the alias makes it non-breaking.**
5252

53-
Two artefacts carry the new bundle:
53+
Two artefacts carry the new invariant:
5454

5555
- A new upgrade edge, `20260814T0000_upgrade_eql_v3_3_0_5`, carrying the
5656
invariant `cipherstash:upgrade-eql-v3-bundle-3.0.5-v1`. Databases already
@@ -60,27 +60,31 @@ Two artefacts carry the new bundle:
6060
phase that copies a new migration package into your repo runs only from
6161
`migration plan`, so without it the 3.0.5 directory never reaches disk and
6262
`migrate` is a silent no-op that leaves the database on the older bundle.
63-
- The baseline install migration `20260601T0100_install_eql_v3_bundle`, whose
64-
baked bundle moves to 3.0.5 and which gains a fourth no-SQL carrier op for
65-
the new invariant. Fresh databases therefore land on 3.0.5 from the single
66-
all-additive genesis edge, keeping `db init` (additive-only policy) working.
63+
- The baseline install migration `20260601T0100_install_eql_v3_bundle`, which
64+
gains a no-SQL carrier op for the new invariant. The baseline itself bakes
65+
eql-3.0.6, not 3.0.5: it was re-emitted again for 3.0.6 before any release
66+
carried the 3.0.5 bytes (see the 3.0.6 entry). Fresh databases land on 3.0.6
67+
from the single all-additive genesis edge, keeping `db init` (additive-only
68+
policy) working.
6769

6870
**Action required.** The baseline's bytes — and so its `migrationHash` — have
69-
changed. If your project already has a `migrations/cipherstash/` directory
70-
generated against `@cipherstash/stack-prisma@1.0.0` or `@1.1.0`, delete that
71-
directory and re-run `prisma-next migration plan` (or `migrate`); the 1.1.0
72-
Prisma Next 0.17 upgrade re-anchored the same artefacts, so a space vendored
73-
against either release is stale here. The seed phase regenerates
71+
changed. This is one change, shared with the 3.0.6 entry: npm never shipped
72+
the 3.0.5 baseline on its own. If your project already has a
73+
`migrations/cipherstash/` directory generated against
74+
`@cipherstash/stack-prisma@1.0.0`, `@1.1.0` or `@1.1.1`, delete that directory
75+
and re-run `prisma-next migration plan` (or `migrate`); the 1.1.0 Prisma Next
76+
0.17 upgrade re-anchored the same artefacts, so a space vendored against any
77+
of them is stale here. The seed phase regenerates
7478
it byte-identical to the shipped artefacts. Your database keeps its markers, so
75-
already-applied invariants are not re-run — the only new work is the 3.0.5
76-
upgrade edge.
79+
already-applied invariants are not re-run — the only new work is the 3.0.5 and
80+
3.0.6 upgrade edges.
7781

7882
If you skip the delete, nothing warns you: a vendored baseline is stale but
7983
internally intact, so it passes every integrity check. On an existing database
8084
the upgrade still applies correctly; on a **fresh** one, `db init` refuses with
8185
`Operation cipherstash.upgrade-eql-v3-bundle-3.0.5 has class "data" which is
8286
not allowed by policy.` — an error that names neither the directory nor the
83-
remedy. See "Upgrading from 1.0.0" in the package README.
87+
remedy. See "Upgrading from 1.0.0 or 1.1.x" in the package README.
8488

8589
**Why the baseline was re-emitted rather than left frozen.** These artefacts are
8690
content-addressed and normally append-only: an EQL bump ships as a new upgrade
@@ -93,4 +97,6 @@ collect every head-ref invariant from the genesis edge it walks. The
9397
append-only alternative would duplicate the full ~2.6 MB bundle into a new
9498
genesis edge on every EQL release, permanently; re-emitting was taken instead
9599
while 1.0.0 was two weeks old with negligible adoption, and is a decision to be
96-
re-argued on adoption numbers rather than repeated by default.
100+
re-argued on adoption numbers rather than repeated by default. This re-emit
101+
never reached npm: 1.1.0 and 1.1.1 shipped the eql-3.0.4 baseline, and the
102+
3.0.6 re-emit replaced these bytes before a release carried them.

‎.changeset/eql-3-0-6-migration.md‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
'@cipherstash/stack-prisma': minor
3+
---
4+
5+
Move the bundled EQL v3 migrations to **eql-3.0.6**. This release changes only
6+
the version stamp: `eql_v3.version()` returns `'3.0.6'` and the `eql_v3` schema
7+
comment reads `'3.0.6'`. No function, operator, domain or index behaviour
8+
changes.
9+
10+
Two artefacts carry the new bundle:
11+
12+
- A new upgrade edge, `20261002T0000_upgrade_eql_v3_3_0_6`, carrying the
13+
invariant `cipherstash:upgrade-eql-v3-bundle-3.0.6-v1`. Existing databases
14+
re-install through it on the next `prisma-next migration plan` followed by
15+
`prisma-next migrate`. **`migrate` alone is not enough**: only
16+
`migration plan` copies the new directory into your repo.
17+
- The baseline install migration `20260601T0100_install_eql_v3_bundle`, which
18+
now bakes 3.0.6 and gains a fifth op, a no-SQL carrier for the new
19+
invariant, so fresh databases land on 3.0.6 from the single all-additive
20+
genesis edge and `db init` keeps working.
21+
22+
**Upgrading a 1.0.0 or 1.1.x database installs the EQL bundle twice.** Those
23+
releases shipped eql-3.0.4, so `migrate` walks the 3.0.5 upgrade edge and then
24+
the 3.0.6 one, re-installing the ~2.6 MB bundle once for each in the same run.
25+
That costs time, not correctness: the database ends on 3.0.6 with every
26+
invariant recorded. The 3.0.5 edge is kept rather than folded into this one
27+
because the frozen-history guard treats every committed edge as published, and
28+
a database built from `main` may already have walked it and recorded its
29+
invariant. As with every EQL upgrade, each re-install opens with
30+
`DROP SCHEMA IF EXISTS eql_v3 CASCADE`: re-run your grant script, and recreate
31+
functional indexes and anything else depending on `eql_v3` (see the 3.0.5
32+
entry).
33+
34+
**Action required: the one in the 3.0.5 entry, once.** npm has only ever
35+
shipped the eql-3.0.4 baseline (1.0.0 on 30 July, 1.1.0 on 19 August, 1.1.1 on
36+
20 August), so this release changes the published baseline once, not twice. If
37+
your project has a `migrations/cipherstash/` directory generated against any
38+
earlier version, delete it and re-run `prisma-next migration plan`. Your
39+
database keeps its markers, so already-applied invariants are not re-run. If
40+
you skip the delete, a fresh `db init` refuses with
41+
`Operation cipherstash.upgrade-eql-v3-bundle-3.0.5 has class "data" which is
42+
not allowed by policy.` — see "Upgrading from 1.0.0 or 1.1.x" in the package
43+
README.
44+
45+
**Why the baseline was re-emitted rather than given a second genesis edge.**
46+
In this repository the baseline was already re-emitted once, for 3.0.5, and
47+
that decision said the trade must be re-argued on adoption numbers at the next
48+
bump. This is that bump, and the trade came out the same way.
49+
`@cipherstash/stack-prisma` had 144 npm downloads in September 2026 (52 in the
50+
last week), fewer than the ~253 monthly downloads at which the 3.0.5 re-emit
51+
was judged a small, knowable blast radius. The 3.0.5 re-emit never reached
52+
npm, so what this one rewrites is unpublished. And since 3.0.6 changes only
53+
the version stamp, the append-only alternative, a second `from: null` genesis
54+
edge, would add another permanent ~2.6 MB copy of the bundle for no change in
55+
behaviour. Once this package has real adoption, the second genesis edge is the
56+
right shape.

‎.changeset/prisma-skill-eql-306.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'stash': patch
3+
---
4+
5+
`skills/stash-prisma`: the stale-`migrations/cipherstash/` table now describes
6+
eql-3.0.6. The baseline bakes 3.0.6, 1.1.x shipped 3.0.4 as 1.0.0 did, and an
7+
existing database upgrades through both the 3.0.5 and 3.0.6 edges.

‎.changeset/stack-prisma-upgrade-from-1-0-0.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'@cipherstash/stack-prisma': patch
33
---
44

5-
Document the 1.0.0 → 3.0.5 upgrade in the package README: why
5+
Document the upgrade from 1.0.0 or 1.1.x in the package README: why
66
`migrations/cipherstash/` must be deleted and regenerated, what each Prisma Next
77
command does if it is not, and the exact `db init` refusal
88
(`Operation cipherstash.upgrade-eql-v3-bundle-3.0.5 has class "data" which is

‎docs/plans/2026-08-13-eql-monorepo-absorption.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ The entire diff is one rename — `eql_v3.ste_vec_contains` → `eql_v3.jsonb_do
186186

187187
That re-emit is the part worth recording, because the append-only rule says not to. No upgrade edge can ever be walked by `db init`: every one of them is a self-edge, `checkIntegrity` requires a self-edge to carry a `data`-class op, and `db init` runs `allowedOperationClasses: ['additive']`. A fresh database therefore has to collect every head-ref invariant from the genesis edge, so a new required invariant either lands on the baseline or arrives on a second `from: null` edge duplicating the full ~2.6 MB bundle — permanently, once per EQL release. Re-emitting was chosen while `@cipherstash/stack-prisma@1.0.0` was 14 days old with ~253 monthly downloads, i.e. while the blast radius was small and knowable, and the changeset carries the delete-and-re-plan instruction. **Once this package has real adoption the second genesis edge is the correct shape** and the size cost is the price of not orphaning consumers; the trade should be re-argued on adoption numbers at the next bump, not defaulted to.
188188

189+
**Re-argued at 3.0.6, and re-emitted once more — still one change on npm.** The next bump changed only the version stamp (`eql_v3.version()` and the `eql_v3` schema comment), but it still moved the digest (`accde003…` → `9b6dab78…`), and the Version Packages PR (`cipherstash/stack#938`) failed the lockstep test because no migration baked it. The trade came out the same way, on the numbers it was meant to be argued on: `@cipherstash/stack-prisma` had 144 npm downloads in September 2026 (52 in its last week), below the ~253/month at which the 3.0.5 re-emit was judged small and knowable; and a second genesis edge would have added another permanent ~2.6 MB bundle copy for a release with no behavioural change. A new `20261002T0000_upgrade_eql_v3_3_0_6` edge carries existing databases. One fact the 3.0.5 record did not have: that re-emit never reached npm. 1.0.0 ships baseline `fc495f7f…` and 1.1.0 and 1.1.1 ship `1030654387…`, both baking the eql-3.0.4 bundle, and none of the three ships the 3.0.5 edge (checked against the unpacked tarballs). So the 3.0.6 re-emit rewrote an unpublished baseline, not a second published one: npm consumers see the 3.0.5 and 3.0.6 re-emits as one baseline change, in the same release that first ships both upgrade edges. The 3.0.5 edge is kept anyway — the frozen-history guard treats every committed edge as published, and a database built from `main` may already have walked it — so a database on eql-3.0.4 installs the bundle twice on upgrade, a time cost rather than a correctness problem. The append-only rule, and the second genesis edge once adoption is real, still stand for the next bump.
190+
189191
The narrower lesson for the absorption: **absorbing a repo swaps "last published release" for "current HEAD" across every consumer**, and nothing in the dependency graph announces that. Only a digest pin caught it here. Any other package this repo absorbs by workspace link deserves the same check — diff the built artefact against the published tarball — before the link is treated as neutral.
190192

191193
### Three imported release workflows violate the no-caching rule — by omission, not by setting

‎examples/prisma/migrations/cipherstash/20260601T0100_install_eql_v3_bundle/migration.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
"cipherstash:install-eql-v3-bundle-v1",
66
"cipherstash:upgrade-eql-v3-bundle-3.0.2-v1",
77
"cipherstash:upgrade-eql-v3-bundle-3.0.4-v1",
8-
"cipherstash:upgrade-eql-v3-bundle-3.0.5-v1"
8+
"cipherstash:upgrade-eql-v3-bundle-3.0.5-v1",
9+
"cipherstash:upgrade-eql-v3-bundle-3.0.6-v1"
910
],
1011
"createdAt": "2026-07-14T20:10:24.325Z",
11-
"migrationHash": "bad30c9b3d2ad383d853cda0209eb14a031f2d107ba9cbdfb26b95d58e9aff37"
12+
"migrationHash": "2fdc7cafd2c6011b5129267cd77e640077fdc6401cba5a987c3f0bb412dad05c"
1213
}

‎examples/prisma/migrations/cipherstash/20260601T0100_install_eql_v3_bundle/ops.json‎

Lines changed: 24 additions & 7 deletions
Large diffs are not rendered by default.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"from": "0c0734babd6eeb868fee1f281ca96963022475611560e9f170f465daa35f8599",
3+
"to": "0c0734babd6eeb868fee1f281ca96963022475611560e9f170f465daa35f8599",
4+
"providedInvariants": [
5+
"cipherstash:upgrade-eql-v3-bundle-3.0.6-v1"
6+
],
7+
"createdAt": "2026-10-02T04:18:42.588Z",
8+
"migrationHash": "b16c9fc5fbe87f2ec03bcae3fc3d619cb4aac0c5781da7ba2105d3e11a6e0a3a"
9+
}

‎examples/prisma/migrations/cipherstash/20261002T0000_upgrade_eql_v3_3_0_6/ops.json‎

Lines changed: 32 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"hash":"0c0734babd6eeb868fee1f281ca96963022475611560e9f170f465daa35f8599","invariants":["cipherstash:install-eql-v3-bundle-v1","cipherstash:upgrade-eql-v3-bundle-3.0.2-v1","cipherstash:upgrade-eql-v3-bundle-3.0.4-v1","cipherstash:upgrade-eql-v3-bundle-3.0.5-v1"]}
1+
{"hash":"0c0734babd6eeb868fee1f281ca96963022475611560e9f170f465daa35f8599","invariants":["cipherstash:install-eql-v3-bundle-v1","cipherstash:upgrade-eql-v3-bundle-3.0.2-v1","cipherstash:upgrade-eql-v3-bundle-3.0.4-v1","cipherstash:upgrade-eql-v3-bundle-3.0.5-v1","cipherstash:upgrade-eql-v3-bundle-3.0.6-v1"]}

0 commit comments

Comments
 (0)