fix(demo): remove collapsed no-op bookend migrations + integrity guard#773
Conversation
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (17)
💤 Files with no reviewable changes (16)
📝 WalkthroughWalkthroughThis 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. ChangesMigration cleanup and validation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
size-limit report 📦
|
@prisma-next/extension-author-tools
@prisma-next/mongo-runtime
@prisma-next/family-mongo
@prisma-next/sql-runtime
@prisma-next/family-sql
@prisma-next/extension-arktype-json
@prisma-next/middleware-cache
@prisma-next/mongo
@prisma-next/extension-paradedb
@prisma-next/extension-pgvector
@prisma-next/extension-postgis
@prisma-next/postgres
@prisma-next/sql-orm-client
@prisma-next/sqlite
@prisma-next/extension-supabase
@prisma-next/target-mongo
@prisma-next/adapter-mongo
@prisma-next/driver-mongo
@prisma-next/contract
@prisma-next/utils
@prisma-next/config
@prisma-next/errors
@prisma-next/framework-components
@prisma-next/operations
@prisma-next/ts-render
@prisma-next/contract-authoring
@prisma-next/ids
@prisma-next/psl-parser
@prisma-next/psl-printer
@prisma-next/cli
@prisma-next/cli-telemetry
@prisma-next/emitter
@prisma-next/migration-tools
prisma-next
@prisma-next/vite-plugin-contract-emit
@prisma-next/mongo-codec
@prisma-next/mongo-contract
@prisma-next/mongo-value
@prisma-next/mongo-contract-psl
@prisma-next/mongo-contract-ts
@prisma-next/mongo-emitter
@prisma-next/mongo-schema-ir
@prisma-next/mongo-query-ast
@prisma-next/mongo-orm
@prisma-next/mongo-query-builder
@prisma-next/mongo-lowering
@prisma-next/mongo-wire
@prisma-next/sql-contract
@prisma-next/sql-errors
@prisma-next/sql-operations
@prisma-next/sql-schema-ir
@prisma-next/sql-contract-psl
@prisma-next/sql-contract-ts
@prisma-next/sql-contract-emitter
@prisma-next/sql-lane-query-builder
@prisma-next/sql-relational-core
@prisma-next/sql-builder
@prisma-next/target-postgres
@prisma-next/target-sqlite
@prisma-next/adapter-postgres
@prisma-next/adapter-sqlite
@prisma-next/driver-postgres
@prisma-next/driver-sqlite
commit: |
## 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>
What
The example-app demo shipped two broken migration fixtures: a
fixtures:emithash recomputation collapsed two namespace-"bookend" migrations tofrom === towith no data invariant — true no-op self-edges thatmigration check/migration plancorrectly reject (PN-MIG-5002). The namespace drift they bookended no longer affects the contract hash, so they're obsolete.Changes
20260518T1701_namespaces_bookend,20260605T1143_public_namespaces_bookend). They sat as self-loops on7c31c2…; removing both leaves a cleana12e04→7c31c2→ab50ccchain.migration checkon the demo now passes.examples/prisma-next-demo/test/migration-integrity.test.ts): runs the on-diskcheckIntegrityover the shipped demo migrations and asserts zero violations, plus a proof test that injects a no-op self-edge and confirms thesameSourceAndTargetviolation is caught. This is the gap that let the broken fixture ship —fixtures:checkonly diffs contract files, nothing ran integrity on the demo.Why this matters
fixtures:emitcan 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 atmigration plantime.Summary by CodeRabbit
Chores
Tests