Skip to content

fix(demo): remove collapsed no-op bookend migrations + integrity guard#773

Merged
wmadden merged 2 commits into
mainfrom
fix-noop-bookend-migrations
Jun 9, 2026
Merged

fix(demo): remove collapsed no-op bookend migrations + integrity guard#773
wmadden merged 2 commits into
mainfrom
fix-noop-bookend-migrations

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What

The example-app demo shipped two broken migration fixtures: a fixtures:emit hash recomputation collapsed two namespace-"bookend" migrations to from === to with no data invariant — true no-op self-edges that migration check / migration plan correctly reject (PN-MIG-5002). The namespace drift they bookended no longer affects the contract hash, so they're obsolete.

Changes

  • Delete both collapsed no-op bookends (20260518T1701_namespaces_bookend, 20260605T1143_public_namespaces_bookend). They sat as self-loops on 7c31c2…; removing both leaves a clean a12e04→7c31c2→ab50cc chain. migration check on the demo now passes.
  • Add an offline integrity regression guard (examples/prisma-next-demo/test/migration-integrity.test.ts): runs the on-disk checkIntegrity over the shipped demo migrations and asserts zero violations, plus a proof test that injects a no-op self-edge and confirms the sameSourceAndTarget violation is caught. This is the gap that let the broken fixture ship — fixtures:check only diffs contract files, nothing ran integrity on the demo.

Why this matters

fixtures:emit can emit a migration the integrity checker then rejects (emitter/checker disagreement). This guard turns that class of regression into a fast, offline test failure instead of a surprise at migration plan time.

Summary by CodeRabbit

  • Chores

    • Removed example migration files from the Prisma Next demo to streamline the codebase.
  • Tests

    • Added migration integrity validation test suite to ensure migrations function correctly and detect integrity violations.

wmadden added 2 commits June 9, 2026 13:20
The fixtures:emit hash recomputation collapsed two namespace-bookend
migrations to from===to with no data invariant — true no-op self-edges
that migration check/plan correctly reject (PN-MIG-5002). The namespace
drift they bookended no longer affects the contract hash, so they are
obsolete. Removing both leaves a clean a12e04→7c31c2→ab50cc chain.

Signed-off-by: Will Madden <madden@prisma.io>
Adds an offline test in examples/prisma-next-demo/test/ that loads the
shipped migrations/ tree via loadContractSpaceAggregate and asserts
aggregate.checkIntegrity() returns no violations. A second test injects
a no-op self-edge (from === to) into a tmpdir copy of the migrations tree
and confirms it raises a sameSourceAndTarget violation — proving the guard
can fail.

This would have caught the collapsed no-op bookend migrations (bd31bc3)
before they landed.

Signed-off-by: Will Madden <madden@prisma.io>
@wmadden-electric wmadden-electric requested a review from a team as a code owner June 9, 2026 11:27
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 3fca3570-d304-460f-b442-1ac6cd40b741

📥 Commits

Reviewing files that changed from the base of the PR and between b5c38a0 and a0ac5b0.

📒 Files selected for processing (17)
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/contract.prisma
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/end-contract.d.ts
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/end-contract.json
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/migration.json
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/migration.ts
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/ops.json
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/start-contract.d.ts
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/start-contract.json
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/contract.prisma
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/end-contract.d.ts
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/end-contract.json
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/migration.json
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/migration.ts
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/ops.json
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/start-contract.d.ts
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/start-contract.json
  • examples/prisma-next-demo/test/migration-integrity.test.ts
💤 Files with no reviewable changes (16)
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/ops.json
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/ops.json
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/end-contract.json
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/migration.json
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/migration.ts
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/migration.ts
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/start-contract.json
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/end-contract.json
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/contract.prisma
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/migration.json
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/contract.prisma
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/start-contract.d.ts
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/start-contract.json
  • examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/end-contract.d.ts
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/start-contract.d.ts
  • examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/end-contract.d.ts

📝 Walkthrough

Walkthrough

This PR removes two obsolete bookend migration folders from the Prisma Next demo and adds a test suite to validate that the remaining migrations maintain integrity and can detect violations.

Changes

Migration cleanup and validation

Layer / File(s) Summary
Remove obsolete bookend migrations
examples/prisma-next-demo/migrations/app/20260518T1701_namespaces_bookend/migration.ts (+ 7 related files deleted: contract.prisma, start/end-contract.d.ts, start/end-contract.json, migration.json, ops.json) and examples/prisma-next-demo/migrations/app/20260605T1143_public_namespaces_bookend/ (same structure)
Removes two bookend migration folders that declared identical from/to hashes with empty operation lists, along with their generated contract schemas, TypeScript type definitions, and JSON metadata. These migrations served as metadata-only placeholders for namespace bindings.
Migration integrity validation test
examples/prisma-next-demo/test/migration-integrity.test.ts
Adds a test suite that loads the remaining shipped migrations and validates their integrity using checkIntegrity, confirming all migrations pass. Also includes a guard test that injects a fabricated self-edge migration (from === to) and verifies checkIntegrity correctly detects and reports the violation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • prisma/prisma-next#662: Namespace rebinding for generated Postgres contract typings aligns with removal of the demo's namespace-default bookend migrations that were produced by that shift.

Suggested reviewers

  • wmadden
  • aqrln

Poem

🐰 The bookend migrations rest at last,
No more do they echo the schema's past.
A test now guards what remains,
Catching self-loops in the chain.
Clean migrations march ahead! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: removing two collapsed no-op bookend migrations and adding an integrity guard test.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-noop-bookend-migrations

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

size-limit report 📦

Path Size
postgres / no-emit 150.65 KB (0%)
postgres / emit 119.44 KB (0%)
mongo / no-emit 76.67 KB (0%)
mongo / emit 70.96 KB (0%)
cf-worker / no-emit 179.98 KB (0%)
cf-worker / emit 145.5 KB (0%)

@pkg-pr-new

pkg-pr-new Bot commented Jun 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

@prisma-next/extension-author-tools

npm i https://pkg.pr.new/@prisma-next/extension-author-tools@773

@prisma-next/mongo-runtime

npm i https://pkg.pr.new/@prisma-next/mongo-runtime@773

@prisma-next/family-mongo

npm i https://pkg.pr.new/@prisma-next/family-mongo@773

@prisma-next/sql-runtime

npm i https://pkg.pr.new/@prisma-next/sql-runtime@773

@prisma-next/family-sql

npm i https://pkg.pr.new/@prisma-next/family-sql@773

@prisma-next/extension-arktype-json

npm i https://pkg.pr.new/@prisma-next/extension-arktype-json@773

@prisma-next/middleware-cache

npm i https://pkg.pr.new/@prisma-next/middleware-cache@773

@prisma-next/mongo

npm i https://pkg.pr.new/@prisma-next/mongo@773

@prisma-next/extension-paradedb

npm i https://pkg.pr.new/@prisma-next/extension-paradedb@773

@prisma-next/extension-pgvector

npm i https://pkg.pr.new/@prisma-next/extension-pgvector@773

@prisma-next/extension-postgis

npm i https://pkg.pr.new/@prisma-next/extension-postgis@773

@prisma-next/postgres

npm i https://pkg.pr.new/@prisma-next/postgres@773

@prisma-next/sql-orm-client

npm i https://pkg.pr.new/@prisma-next/sql-orm-client@773

@prisma-next/sqlite

npm i https://pkg.pr.new/@prisma-next/sqlite@773

@prisma-next/extension-supabase

npm i https://pkg.pr.new/@prisma-next/extension-supabase@773

@prisma-next/target-mongo

npm i https://pkg.pr.new/@prisma-next/target-mongo@773

@prisma-next/adapter-mongo

npm i https://pkg.pr.new/@prisma-next/adapter-mongo@773

@prisma-next/driver-mongo

npm i https://pkg.pr.new/@prisma-next/driver-mongo@773

@prisma-next/contract

npm i https://pkg.pr.new/@prisma-next/contract@773

@prisma-next/utils

npm i https://pkg.pr.new/@prisma-next/utils@773

@prisma-next/config

npm i https://pkg.pr.new/@prisma-next/config@773

@prisma-next/errors

npm i https://pkg.pr.new/@prisma-next/errors@773

@prisma-next/framework-components

npm i https://pkg.pr.new/@prisma-next/framework-components@773

@prisma-next/operations

npm i https://pkg.pr.new/@prisma-next/operations@773

@prisma-next/ts-render

npm i https://pkg.pr.new/@prisma-next/ts-render@773

@prisma-next/contract-authoring

npm i https://pkg.pr.new/@prisma-next/contract-authoring@773

@prisma-next/ids

npm i https://pkg.pr.new/@prisma-next/ids@773

@prisma-next/psl-parser

npm i https://pkg.pr.new/@prisma-next/psl-parser@773

@prisma-next/psl-printer

npm i https://pkg.pr.new/@prisma-next/psl-printer@773

@prisma-next/cli

npm i https://pkg.pr.new/@prisma-next/cli@773

@prisma-next/cli-telemetry

npm i https://pkg.pr.new/@prisma-next/cli-telemetry@773

@prisma-next/emitter

npm i https://pkg.pr.new/@prisma-next/emitter@773

@prisma-next/migration-tools

npm i https://pkg.pr.new/@prisma-next/migration-tools@773

prisma-next

npm i https://pkg.pr.new/prisma-next@773

@prisma-next/vite-plugin-contract-emit

npm i https://pkg.pr.new/@prisma-next/vite-plugin-contract-emit@773

@prisma-next/mongo-codec

npm i https://pkg.pr.new/@prisma-next/mongo-codec@773

@prisma-next/mongo-contract

npm i https://pkg.pr.new/@prisma-next/mongo-contract@773

@prisma-next/mongo-value

npm i https://pkg.pr.new/@prisma-next/mongo-value@773

@prisma-next/mongo-contract-psl

npm i https://pkg.pr.new/@prisma-next/mongo-contract-psl@773

@prisma-next/mongo-contract-ts

npm i https://pkg.pr.new/@prisma-next/mongo-contract-ts@773

@prisma-next/mongo-emitter

npm i https://pkg.pr.new/@prisma-next/mongo-emitter@773

@prisma-next/mongo-schema-ir

npm i https://pkg.pr.new/@prisma-next/mongo-schema-ir@773

@prisma-next/mongo-query-ast

npm i https://pkg.pr.new/@prisma-next/mongo-query-ast@773

@prisma-next/mongo-orm

npm i https://pkg.pr.new/@prisma-next/mongo-orm@773

@prisma-next/mongo-query-builder

npm i https://pkg.pr.new/@prisma-next/mongo-query-builder@773

@prisma-next/mongo-lowering

npm i https://pkg.pr.new/@prisma-next/mongo-lowering@773

@prisma-next/mongo-wire

npm i https://pkg.pr.new/@prisma-next/mongo-wire@773

@prisma-next/sql-contract

npm i https://pkg.pr.new/@prisma-next/sql-contract@773

@prisma-next/sql-errors

npm i https://pkg.pr.new/@prisma-next/sql-errors@773

@prisma-next/sql-operations

npm i https://pkg.pr.new/@prisma-next/sql-operations@773

@prisma-next/sql-schema-ir

npm i https://pkg.pr.new/@prisma-next/sql-schema-ir@773

@prisma-next/sql-contract-psl

npm i https://pkg.pr.new/@prisma-next/sql-contract-psl@773

@prisma-next/sql-contract-ts

npm i https://pkg.pr.new/@prisma-next/sql-contract-ts@773

@prisma-next/sql-contract-emitter

npm i https://pkg.pr.new/@prisma-next/sql-contract-emitter@773

@prisma-next/sql-lane-query-builder

npm i https://pkg.pr.new/@prisma-next/sql-lane-query-builder@773

@prisma-next/sql-relational-core

npm i https://pkg.pr.new/@prisma-next/sql-relational-core@773

@prisma-next/sql-builder

npm i https://pkg.pr.new/@prisma-next/sql-builder@773

@prisma-next/target-postgres

npm i https://pkg.pr.new/@prisma-next/target-postgres@773

@prisma-next/target-sqlite

npm i https://pkg.pr.new/@prisma-next/target-sqlite@773

@prisma-next/adapter-postgres

npm i https://pkg.pr.new/@prisma-next/adapter-postgres@773

@prisma-next/adapter-sqlite

npm i https://pkg.pr.new/@prisma-next/adapter-sqlite@773

@prisma-next/driver-postgres

npm i https://pkg.pr.new/@prisma-next/driver-postgres@773

@prisma-next/driver-sqlite

npm i https://pkg.pr.new/@prisma-next/driver-sqlite@773

commit: a0ac5b0

@wmadden wmadden merged commit ec5f7df into main Jun 9, 2026
20 of 21 checks passed
@wmadden wmadden deleted the fix-noop-bookend-migrations branch June 9, 2026 12:06
wmadden-electric added a commit that referenced this pull request Jun 9, 2026
## Close-out: migration-graph-rendering

Closes the `migration-graph-rendering` project (TML-2746). It began as a
redesign of `migration graph`'s renderer and broadened into a revamp of
the whole interrogative migration **read-command family** (`list` /
`graph` / `status` / `log`) on a shared renderer + ledger foundation.
All work has shipped; this PR migrates the durable knowledge into
`docs/` and deletes the transient project scaffolding.

### Definition of Done — verified

| Outcome | Evidence |
|---|---|
| Tier-3 renderer rebuilt (line/plane/occlusion) | #762 |
| Back-arc convergence, configurable geometry, greedy lane colouring,
layout fixes | #767 |
| Ledger foundation (per-migration journal) | #665 |
| `list`/`status`/`log` revamped on the shared renderer; dagre + `list
--graph` retired | shipped; verified —
`migration-list/status/log/graph.ts` use the shared renderer; no
`dagre`/`tree-render`/`layout` renderers remain |
| Read-command consistency (TML-2801) | re-validated this PR: 4/7
findings resolved, 2 partial, 1 open (4 small follow-ups noted below) |
| Showcase real-world golden | on `main` |

No unmet acceptance criteria. External-reference scan for
`projects/migration-graph-rendering/` is empty (reference-strip step was
a no-op).

### Durable knowledge migrated to `docs/`

- **ADR 227** — Migration read commands share one graphical renderer
with command-specific annotations.
- **ADR 228** — The migration apply ledger is a per-migration journal.
- **ADR 229** — The migration graph renderer uses a line/plane/occlusion
model (the renderer's internal design — lines as the primitive,
single-owner cells, occlusion over blended glyphs). All three verified
against shipped code.
- **`docs/reference/Migration Graph Visual Language.md`** — the
glyph/layout vocabulary the renderer draws from (was the project's
`mockups.md`).
The read-command consistency audit was **re-validated** against current
code (verdict: largely accomplished — 4/7 findings resolved, 2 partial,
1 open) and captured as a Linear follow-up ticket (**TML-2877**, related
to TML-2801) rather than a committed doc, since what remains is
actionable backlog, not long-lived reference.

Transient artefacts (spec, plan, slice specs/plans/reviews,
`decisions.md` — now ADR'd, `learnings.md`, the followups draft,
`trace.jsonl`, prototype, the audit doc) deleted with the folder / moved
to Linear.

### Follow-ups (tracked, not in this PR)

- **TML-2877** — the four remaining read-command consistency items (show
`--space` policy, log unscoped-semantics doc, check see-also, show/check
decoration flags, + a parity-test extension).
- **PR #773** — the demo fixture no-op self-edge fix + offline integrity
guard.

### Retro — lessons

- **A wholesale rewrite obsoletes fine-grained bug-slices.** Three
glyph-bug slice specs (tee/marker bugs) were made moot by the
line/plane/occlusion rewrite — they targeted deleted code. Re-triage the
backlog after a rewrite; don't carry dead slices.
- **Hand-authored goldens beat auto-snapshots for correctness.**
`toMatchSnapshot()` self-certifies whatever the renderer emits; the
hand-authored `golden-pipeline` oracle caught a convergence regression
the snapshots happily recorded as "correct."
- **Real-world fixtures expose layout bugs unit fixtures miss.**
Validating against the `showcase` graph surfaced four distinct
layout/colour bugs (disconnected-component interleave,
asymmetric-diamond merge lane, trunk-continuation, greedy-colour
wraparound) that the simple scenarios never hit.
- **`@prisma-next/cli` runs vitest with `isolate: false`** — "passes
locally" ≠ passes in CI (parallel state pollution). Candidate for a
durable testing note.
- **`fixtures:emit` can emit an integrity-failing fixture** — the
emitter and `migration check` disagreed (a hash-collapse produced a
no-op self-edge). Landed an offline demo integrity guard (#773).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Will Madden <madden@prisma.io>
Co-authored-by: Will Madden <madden@prisma.io>
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.

2 participants