Skip to content

refactor(contract): execution default refs name an entry and a field, not a table and a column - #30399

Merged
wmadden-electric merged 12 commits into
mainfrom
execution-ref-neutral-names
Sep 25, 2026
Merged

wmadden-electric merged 12 commits into
mainfrom
execution-ref-neutral-names

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Every contract that declares a write-time default carries a reference to the field it applies to. Before this PR that reference was written in SQL vocabulary; now it uses the framework's own storage words:

{ "ref": { "namespace": "app", "entry": "users", "field": "updated_at" },
  "onUpdate": { "kind": "generator", "id": "timestampNow" } }

entry was table and field was column. The values are unchanged: a SQL contract still stores the table and column names there. executionHash changes for every contract with generators, because the canonical JSON changed; storageHash and profileHash do not.

The decision

The framework contract type ExecutionMutationDefault.ref is { namespace, entry, field }. The framework already calls the tables and collections of a storage namespace its entries, so entry is the existing generic word for "the thing in storage that holds fields", and field is the stored field or column. SQL puts table and column names in those slots; the MongoDB family will put collection and field names in the same slots and reuse the framework type unchanged.

Why now

Mongo is about to get write-time defaults (temporal.createdAt() and temporal.updatedAt(), the same presets Postgres has). The first attempt gave the Mongo contract its own execution type with Mongo-named refs. That produced over a thousand type errors: every emitted contract.d.ts derives its type from the framework Contract, and the Mongo control-plane interfaces extend framework interfaces written against it. Renaming the framework field once is far smaller than teaching every family to carry its own copy, and the framework rules forbid SQL vocabulary in shared types anyway. Doing it in its own PR keeps the Mongo change reviewable.

What changed

  • Framework (packages/1-framework/0-foundation/contract): the ref type, with a type test that fails on the old shape.
  • SQL follow-through: the arktype validator, contract assembly and its sort order, the runtime match (ref.entry against the operation's table), the ORM client's create-input optionality check, and the checked-in JSON schema data-contract-sql-v1.json. The SQL PSL interpreter shares the TS assembly path, so it needed no separate change. MutationDefaultsOptions.table in the SQL lanes layer keeps its name: it is SQL-side API and reads clearly against ref.entry.
  • Regenerated fixtures: 158 contract.json and contract.d.ts files (integration fixtures, example contracts, example migration snapshots, the Supabase contract) plus two Prisma 7 reader expected contracts. The only diff in each is the ref keys and executionHash.
  • Renamed by script, not regenerated: 47 embedded migration snapshots that no emit step produces (the prisma7-adoption baseline that refs/db.json points at, and the prisma-8-demo migration-graph fixtures, most of which were already recorded as invalid for other reasons in gotchas.md). Only the ref keys changed, written in sorted order; their executionHash values are stale on purpose, because the snapshot loader re-hashes storage only and nothing can regenerate a past snapshot. This is the same instruction the upgrade fragment gives users.
  • Upgrade instructions: upgrade-instructions/pending/execution-ref-entry-field/{app,extension}/instructions.md detect JSON refs with table/column keys under execution and TypeScript that reads .ref.table or .ref.column. Step 1 is re-emit; step 2 renames the keys in past migration snapshots and leaves their executionHash alone. Validated by execution against this repo's examples: after the fragment runs, the only leftover difference is the executionHash in the five snapshots this PR regenerated, which is the documented expectation.
  • Docs: ADR 158's example and the phases doc comment. The framework-vocabulary ratchet drops from 275 to 274 and the threshold follows it.

Alternatives considered

  • A Mongo-specific execution type and an emitter hook to shape it. Rejected: large churn across emitted types and control interfaces that a later hoist would undo.
  • A type parameter on Contract for the ref shape. Rejected: churn at every Contract use site for a two-key rename.
  • Mongo writes collection and field names into table and column. Rejected: that is the vocabulary leak the framework rules exist to prevent.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Contract Updates
    • Mutation-default references now identify targets by namespace, entry, and field, rather than by namespace, table, and column. Generated contracts and snapshots reflect the updated format.
    • Update existing contract references and direct reads to use the new shape; legacy table-and-column references are no longer accepted by validation.
  • Documentation
    • Added upgrade guidance covering contract regeneration and updates to references in application code and snapshots.

wmadden-electric and others added 12 commits September 24, 2026 19:11
…xecution defaults slice 3

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…olumn

ExecutionMutationDefault.ref in the framework contract becomes
{ namespace, entry, field }. The values are unchanged: SQL still writes the
table name into entry and the column name into field. The framework type
now carries no SQL vocabulary, so another family can use it as is.

SQL follows: the arktype execution schema, the contract-ts assembly and
its sort, the runtime match in applyMutationDefaults, the ORM client
create-input check and HasExecutionCreateDefault, and every test that
builds or reads a ref. MutationDefaultsOptions keeps its table key: the
match reads mutationDefault.ref.entry !== options.table, which is clear
as it stands.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Emitted contract.json and contract.d.ts files and the example migration
snapshots come from pnpm fixtures:emit. The Prisma 7 reader expected
contracts come from UPDATE_PRISMA7_FIXTURES=1 and the package formatter.
Only execution refs and executionHash change.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…instructions

ADR 158 shows the { namespace, entry, field } ref. The framework
vocabulary count drops from 275 to 274, so the threshold follows. App and
extension upgrade fragments declare the rename with detection for JSON
refs, TypeScript ref literals, and .ref.table / .ref.column reads.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ON schema

A standalone ref constant in the temporal-codec interpreter test still used
table and column. The checked-in data-contract-sql-v1.json schema is
regenerated with pnpm schemas:generate.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The multi-line ref literal kept table/column, so the test input had two
defects instead of only the bad generator id it is named for.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Renames table/column to entry/field in the execution-default refs of the
47 snapshots regeneration does not rewrite: the prisma7-adoption snapshot
refs/db.json points at, the prisma-8-demo fixture snapshots, and the two
unreferenced prisma-8-demo snapshots. Keys are written in the emitted
order (entry, field, namespace); nothing else in the files changes.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Step 2 now says to write the ref keys as entry, field, namespace and to
leave a snapshot's executionHash alone, since the snapshot loader
re-hashes only storage. The "after" example uses the same order.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…-names

Main bumped every workspace package to 8.0.0-rc.12 and archived the
pending upgrade fragments it shipped. Merged cleanly; this branch's
execution-ref-entry-field fragments stay pending.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric requested a review from a team as a code owner September 24, 2026 18:47
@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: prisma/orm/.coderabbit.yml

Review profile: CHILL

Plan: Advanced

Run ID: 39d66ec7-ecc3-4d8d-891c-e491780a4015

📥 Commits

Reviewing files that changed from the base of the PR and between 7a47637 and 13625d2.

⛔ Files ignored due to path filters (131)
  • examples/bundle-size/src/postgres/generated/contract.d.ts is excluded by !**/generated/**
  • examples/bundle-size/src/postgres/generated/contract.json is excluded by !**/generated/**
  • examples/prisma7-adoption/generated/prisma8/contract.d.ts is excluded by !**/generated/**
  • examples/prisma7-adoption/generated/prisma8/contract.json is excluded by !**/generated/**
  • packages/2-sql/4-lanes/sql-builder/test/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • packages/2-sql/4-lanes/sql-builder/test/fixtures/generated/contract.json is excluded by !**/generated/**
  • packages/3-extensions/postgres/test/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • packages/3-extensions/postgres/test/fixtures/generated/contract.json is excluded by !**/generated/**
  • packages/3-extensions/sql-orm-client/test/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • packages/3-extensions/sql-orm-client/test/fixtures/generated/contract.json is excluded by !**/generated/**
  • packages/3-extensions/sql-orm-client/test/fixtures/junction-namespaces/generated/contract.d.ts is excluded by !**/generated/**
  • packages/3-extensions/sql-orm-client/test/fixtures/junction-namespaces/generated/contract.json is excluded by !**/generated/**
  • projects/mongo-defaults-codecs-prisma6-source/README.md is excluded by !projects/**
  • projects/mongo-defaults-codecs-prisma6-source/design-notes.md is excluded by !projects/**
  • projects/mongo-defaults-codecs-prisma6-source/plan.md is excluded by !projects/**
  • projects/mongo-defaults-codecs-prisma6-source/slices/01-mongo-target-codecs/plan.md is excluded by !projects/**
  • projects/mongo-defaults-codecs-prisma6-source/slices/01-mongo-target-codecs/spec.md is excluded by !projects/**
  • projects/mongo-defaults-codecs-prisma6-source/slices/02-execution-ref-neutral-names/spec.md is excluded by !projects/**
  • projects/mongo-defaults-codecs-prisma6-source/slices/03-mongo-execution-defaults/plan.md is excluded by !projects/**
  • projects/mongo-defaults-codecs-prisma6-source/slices/03-mongo-execution-defaults/spec.md is excluded by !projects/**
  • projects/mongo-defaults-codecs-prisma6-source/spec.md is excluded by !projects/**
  • test/e2e/framework/test/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • test/e2e/framework/test/fixtures/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/blog-update/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/blog-update/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/bytes-upsert/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/bytes-upsert/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/decimal-list/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/decimal-list/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/decimal-precision/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/decimal-precision/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/decimal-scalar/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/decimal-scalar/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/enum-array/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/enum-array/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/extended-where/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/extended-where/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/handle-int-overflow/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/handle-int-overflow/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/interactive-transactions/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/interactive-transactions/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-12378/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-12378/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-12572/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-12572/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-14954-date-batch/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-14954-date-batch/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-15044/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-15044/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-16535-select-enum/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-16535-select-enum/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-17005-args-type-conflict/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-17005-args-type-conflict/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-18970-invalid-date/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-18970-invalid-date/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-20261-group-by-shortcut/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-20261-group-by-shortcut/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-21454-type-in-json/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-21454-type-in-json/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-21631-batching-in-transaction/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-21631-batching-in-transaction/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-22098-column-does-not-exist/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-22098-column-does-not-exist/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-22610-parallel-batch/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-22610-parallel-batch/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-23201-non-ascii-comments/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-23201-non-ascii-comments/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-23902/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-23902/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-28151-broken-nested-set/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-28151-broken-nested-set/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-28192-pg-historical-dates/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-28192-pg-historical-dates/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-29174-jsonb-parameter-regression/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-29174-jsonb-parameter-regression/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-29176-cursor-parameter-regression/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-29176-cursor-parameter-regression/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-29254-query-plan-cache-mutation/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-29254-query-plan-cache-mutation/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-29267-uint8array-in-json/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-29267-uint8array-in-json/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-29331-query-plan-cache-bloat/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-29331-query-plan-cache-bloat/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-4004/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-4004/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-5952-decimal-batch/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/issues-5952-decimal-batch/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/legacy-aggregations/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/legacy-aggregations/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/legacy-optional-relation-filters/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/legacy-optional-relation-filters/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-count/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-count/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-createMany/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-createMany/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-createManyAndReturn/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-createManyAndReturn/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-findFirstOrThrow/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-findFirstOrThrow/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-findUniqueOrThrow/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-findUniqueOrThrow/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-updateManyAndReturn/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-updateManyAndReturn/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-upsert-native-atomic/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-upsert-native-atomic/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-upsert-simple/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/methods-upsert-simple/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/mixed-string-uuid-datetime-list-inputs/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/mixed-string-uuid-datetime-list-inputs/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/multi-schema/_fixture/different-names/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/multi-schema/_fixture/different-names/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/multi-schema/_fixture/identical-names/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/multi-schema/_fixture/identical-names/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/multi-schema/_fixture/no-map/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/multi-schema/_fixture/no-map/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/multiple-types/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/multiple-types/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/optimistic-concurrency-control/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/ports/prisma/functional/optimistic-concurrency-control/_fixture/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/sql-builder/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/sql-builder/fixtures/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/sql-orm-client/fixtures/execution-defaulted-tags/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/sql-orm-client/fixtures/execution-defaulted-tags/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/sql-orm-client/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/sql-orm-client/fixtures/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/sql-orm-client/fixtures/junction-namespaces/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/sql-orm-client/fixtures/junction-namespaces/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/temporal-defaults/_fixture-timestamp/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/temporal-defaults/_fixture-timestamp/generated/contract.json is excluded by !**/generated/**
  • test/integration/test/temporal-defaults/_fixture/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/temporal-defaults/_fixture/generated/contract.json is excluded by !**/generated/**
📒 Files selected for processing (165)
  • docs/architecture docs/adrs/ADR 158 - Execution mutation defaults.md
  • examples/prisma-8-cloudflare-worker/src/prisma/contract.d.ts
  • examples/prisma-8-cloudflare-worker/src/prisma/contract.json
  • examples/prisma-8-demo-sqlite/src/prisma/contract.d.ts
  • examples/prisma-8-demo-sqlite/src/prisma/contract.json
  • examples/prisma-8-demo/fixtures/converging-branches/migrations/snapshots/042e80cecce8271bb96dedcc7986dadb4c72b098ad5b5b43d8f3bf2d5d61806b/contract.d.ts
  • examples/prisma-8-demo/fixtures/converging-branches/migrations/snapshots/042e80cecce8271bb96dedcc7986dadb4c72b098ad5b5b43d8f3bf2d5d61806b/contract.json
  • examples/prisma-8-demo/fixtures/converging-branches/migrations/snapshots/789dd79ab5ab725be1b6ced088109b803a4d62f9874f932eb384a868d94360a4/contract.d.ts
  • examples/prisma-8-demo/fixtures/converging-branches/migrations/snapshots/789dd79ab5ab725be1b6ced088109b803a4d62f9874f932eb384a868d94360a4/contract.json
  • examples/prisma-8-demo/fixtures/converging-branches/migrations/snapshots/7e3fa7fbe98974385451444c229337c87ec90c547a9214f81700f86b5af3563d/contract.d.ts
  • examples/prisma-8-demo/fixtures/converging-branches/migrations/snapshots/7e3fa7fbe98974385451444c229337c87ec90c547a9214f81700f86b5af3563d/contract.json
  • examples/prisma-8-demo/fixtures/converging-branches/migrations/snapshots/93be6c200743261baf55f0586b1380a1c0ade3c48730c09a8fec71ba419c2464/contract.d.ts
  • examples/prisma-8-demo/fixtures/converging-branches/migrations/snapshots/93be6c200743261baf55f0586b1380a1c0ade3c48730c09a8fec71ba419c2464/contract.json
  • examples/prisma-8-demo/fixtures/converging-branches/migrations/snapshots/afdcd8ee600252054660e79266ede99d1f5227b586225985565eff24414696d0/contract.d.ts
  • examples/prisma-8-demo/fixtures/converging-branches/migrations/snapshots/afdcd8ee600252054660e79266ede99d1f5227b586225985565eff24414696d0/contract.json
  • examples/prisma-8-demo/fixtures/diamond/migrations/snapshots/789dd79ab5ab725be1b6ced088109b803a4d62f9874f932eb384a868d94360a4/contract.d.ts
  • examples/prisma-8-demo/fixtures/diamond/migrations/snapshots/789dd79ab5ab725be1b6ced088109b803a4d62f9874f932eb384a868d94360a4/contract.json
  • examples/prisma-8-demo/fixtures/diamond/migrations/snapshots/7e3fa7fbe98974385451444c229337c87ec90c547a9214f81700f86b5af3563d/contract.d.ts
  • examples/prisma-8-demo/fixtures/diamond/migrations/snapshots/7e3fa7fbe98974385451444c229337c87ec90c547a9214f81700f86b5af3563d/contract.json
  • examples/prisma-8-demo/fixtures/diamond/migrations/snapshots/93be6c200743261baf55f0586b1380a1c0ade3c48730c09a8fec71ba419c2464/contract.d.ts
  • examples/prisma-8-demo/fixtures/diamond/migrations/snapshots/93be6c200743261baf55f0586b1380a1c0ade3c48730c09a8fec71ba419c2464/contract.json
  • examples/prisma-8-demo/fixtures/diamond/migrations/snapshots/f9a41d77df6eae57bcd25ab25df31e6e905aad034a5b813f408bf8e78e9f384a/contract.d.ts
  • examples/prisma-8-demo/fixtures/diamond/migrations/snapshots/f9a41d77df6eae57bcd25ab25df31e6e905aad034a5b813f408bf8e78e9f384a/contract.json
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/2636edd722347d39a60458e4b0733f62e8d316d054fb7cca2b801e91cd619f74/contract.d.ts
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/2636edd722347d39a60458e4b0733f62e8d316d054fb7cca2b801e91cd619f74/contract.json
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/47f4a4f58e99a479aaa3ba2ff9d00d1728b1c240359e03aa564ae163d63ba8d7/contract.d.ts
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/47f4a4f58e99a479aaa3ba2ff9d00d1728b1c240359e03aa564ae163d63ba8d7/contract.json
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/6c66c897ec186bbc7b69feb6bfc5bb19b28a4c9ffe1a4fff5c96172cf5716ea5/contract.d.ts
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/6c66c897ec186bbc7b69feb6bfc5bb19b28a4c9ffe1a4fff5c96172cf5716ea5/contract.json
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/789dd79ab5ab725be1b6ced088109b803a4d62f9874f932eb384a868d94360a4/contract.d.ts
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/789dd79ab5ab725be1b6ced088109b803a4d62f9874f932eb384a868d94360a4/contract.json
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/7e951c7a95f42ca0420d9c4aae3602e32911606399982347621943fce34076d8/contract.d.ts
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/7e951c7a95f42ca0420d9c4aae3602e32911606399982347621943fce34076d8/contract.json
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/827997ce6f33b7193b0a9eda969affe757e0d54209fde344afcd4d41321c5078/contract.d.ts
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/827997ce6f33b7193b0a9eda969affe757e0d54209fde344afcd4d41321c5078/contract.json
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/93be6c200743261baf55f0586b1380a1c0ade3c48730c09a8fec71ba419c2464/contract.d.ts
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/93be6c200743261baf55f0586b1380a1c0ade3c48730c09a8fec71ba419c2464/contract.json
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/99de8c2642999fd9b4c99ea77e53e8e31cb65d66575027eb287e8b0d849e8b84/contract.d.ts
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/99de8c2642999fd9b4c99ea77e53e8e31cb65d66575027eb287e8b0d849e8b84/contract.json
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/b34dc9149b6856eacb47e3e6f2157860d8690f5fb382e71ae6b27f943007b778/contract.d.ts
  • examples/prisma-8-demo/fixtures/long-spine/migrations/snapshots/b34dc9149b6856eacb47e3e6f2157860d8690f5fb382e71ae6b27f943007b778/contract.json
  • examples/prisma-8-demo/fixtures/multi-branch/migrations/snapshots/789dd79ab5ab725be1b6ced088109b803a4d62f9874f932eb384a868d94360a4/contract.d.ts
  • examples/prisma-8-demo/fixtures/multi-branch/migrations/snapshots/789dd79ab5ab725be1b6ced088109b803a4d62f9874f932eb384a868d94360a4/contract.json
  • examples/prisma-8-demo/fixtures/multi-branch/migrations/snapshots/7e3fa7fbe98974385451444c229337c87ec90c547a9214f81700f86b5af3563d/contract.d.ts
  • examples/prisma-8-demo/fixtures/multi-branch/migrations/snapshots/7e3fa7fbe98974385451444c229337c87ec90c547a9214f81700f86b5af3563d/contract.json
  • examples/prisma-8-demo/fixtures/multi-branch/migrations/snapshots/827997ce6f33b7193b0a9eda969affe757e0d54209fde344afcd4d41321c5078/contract.d.ts
  • examples/prisma-8-demo/fixtures/multi-branch/migrations/snapshots/827997ce6f33b7193b0a9eda969affe757e0d54209fde344afcd4d41321c5078/contract.json
  • examples/prisma-8-demo/fixtures/multi-branch/migrations/snapshots/93be6c200743261baf55f0586b1380a1c0ade3c48730c09a8fec71ba419c2464/contract.d.ts
  • examples/prisma-8-demo/fixtures/multi-branch/migrations/snapshots/93be6c200743261baf55f0586b1380a1c0ade3c48730c09a8fec71ba419c2464/contract.json
  • examples/prisma-8-demo/fixtures/multi-branch/migrations/snapshots/afdcd8ee600252054660e79266ede99d1f5227b586225985565eff24414696d0/contract.d.ts
  • examples/prisma-8-demo/fixtures/multi-branch/migrations/snapshots/afdcd8ee600252054660e79266ede99d1f5227b586225985565eff24414696d0/contract.json
  • examples/prisma-8-demo/fixtures/multi-branch/migrations/snapshots/d11106e57024ff51282c4a92f549538eb9b8c77b30c719d5e25e726e9cdb40de/contract.d.ts
  • examples/prisma-8-demo/fixtures/multi-branch/migrations/snapshots/d11106e57024ff51282c4a92f549538eb9b8c77b30c719d5e25e726e9cdb40de/contract.json
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/34dd5176d953c101467355b72fd2adf3e49c97bf13d8198dcc0dafec4d6341ce/contract.d.ts
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/34dd5176d953c101467355b72fd2adf3e49c97bf13d8198dcc0dafec4d6341ce/contract.json
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/3705eb1cd04a52180d1206181446bb87e18bb32afcc3d1dacbec685ca2d449d1/contract.d.ts
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/3705eb1cd04a52180d1206181446bb87e18bb32afcc3d1dacbec685ca2d449d1/contract.json
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/3bfce91c81146b347dc05f423a71907a82d8b2e78ab5714b2bfab673f673d021/contract.d.ts
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/3bfce91c81146b347dc05f423a71907a82d8b2e78ab5714b2bfab673f673d021/contract.json
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/419c09911c25cf9b97e60ee157c61a126accfa5f26f5cdb7954667c704f53753/contract.d.ts
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/419c09911c25cf9b97e60ee157c61a126accfa5f26f5cdb7954667c704f53753/contract.json
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/83a1ded0b0045642794c268ef48d21d54bb65a481c13c8b243a7f5821b78d9a0/contract.d.ts
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/83a1ded0b0045642794c268ef48d21d54bb65a481c13c8b243a7f5821b78d9a0/contract.json
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/935a02360e01dda00d62f98429f4347bf765abf9118bca03941383cef87591c5/contract.d.ts
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/935a02360e01dda00d62f98429f4347bf765abf9118bca03941383cef87591c5/contract.json
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/bf158ef32daace0a629bfdac5d569b0d43cd81e257e2463aef2545638e2c7585/contract.d.ts
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/bf158ef32daace0a629bfdac5d569b0d43cd81e257e2463aef2545638e2c7585/contract.json
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/f1e8cde6ed1bd4ed5851d1308cd58431169236230778c42382189cdc0557a7fb/contract.d.ts
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/f1e8cde6ed1bd4ed5851d1308cd58431169236230778c42382189cdc0557a7fb/contract.json
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/f5aa17d46d7be94ca3ddf4d14d90e0444291d9c063c52d0e05455726e52e0026/contract.d.ts
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/f5aa17d46d7be94ca3ddf4d14d90e0444291d9c063c52d0e05455726e52e0026/contract.json
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/f66098408da51786d8c6701a2b10db2e90f4b7e138eb5e95f84dc61e156d242b/contract.d.ts
  • examples/prisma-8-demo/fixtures/showcase/migrations/snapshots/f66098408da51786d8c6701a2b10db2e90f4b7e138eb5e95f84dc61e156d242b/contract.json
  • examples/prisma-8-demo/fixtures/skip-rollback/migrations/snapshots/789dd79ab5ab725be1b6ced088109b803a4d62f9874f932eb384a868d94360a4/contract.d.ts
  • examples/prisma-8-demo/fixtures/skip-rollback/migrations/snapshots/789dd79ab5ab725be1b6ced088109b803a4d62f9874f932eb384a868d94360a4/contract.json
  • examples/prisma-8-demo/fixtures/skip-rollback/migrations/snapshots/7e951c7a95f42ca0420d9c4aae3602e32911606399982347621943fce34076d8/contract.d.ts
  • examples/prisma-8-demo/fixtures/skip-rollback/migrations/snapshots/7e951c7a95f42ca0420d9c4aae3602e32911606399982347621943fce34076d8/contract.json
  • examples/prisma-8-demo/fixtures/skip-rollback/migrations/snapshots/827997ce6f33b7193b0a9eda969affe757e0d54209fde344afcd4d41321c5078/contract.d.ts
  • examples/prisma-8-demo/fixtures/skip-rollback/migrations/snapshots/827997ce6f33b7193b0a9eda969affe757e0d54209fde344afcd4d41321c5078/contract.json
  • examples/prisma-8-demo/fixtures/skip-rollback/migrations/snapshots/93be6c200743261baf55f0586b1380a1c0ade3c48730c09a8fec71ba419c2464/contract.d.ts
  • examples/prisma-8-demo/fixtures/skip-rollback/migrations/snapshots/93be6c200743261baf55f0586b1380a1c0ade3c48730c09a8fec71ba419c2464/contract.json
  • examples/prisma-8-demo/fixtures/wide-fan/migrations/snapshots/2796854eb60b7ce66a0cd34d550680931f82fc2d2dca048726f971d1cc3aef10/contract.d.ts
  • examples/prisma-8-demo/fixtures/wide-fan/migrations/snapshots/2796854eb60b7ce66a0cd34d550680931f82fc2d2dca048726f971d1cc3aef10/contract.json
  • examples/prisma-8-demo/fixtures/wide-fan/migrations/snapshots/789dd79ab5ab725be1b6ced088109b803a4d62f9874f932eb384a868d94360a4/contract.d.ts
  • examples/prisma-8-demo/fixtures/wide-fan/migrations/snapshots/789dd79ab5ab725be1b6ced088109b803a4d62f9874f932eb384a868d94360a4/contract.json
  • examples/prisma-8-demo/fixtures/wide-fan/migrations/snapshots/7e3fa7fbe98974385451444c229337c87ec90c547a9214f81700f86b5af3563d/contract.d.ts
  • examples/prisma-8-demo/fixtures/wide-fan/migrations/snapshots/7e3fa7fbe98974385451444c229337c87ec90c547a9214f81700f86b5af3563d/contract.json
  • examples/prisma-8-demo/fixtures/wide-fan/migrations/snapshots/93be6c200743261baf55f0586b1380a1c0ade3c48730c09a8fec71ba419c2464/contract.d.ts
  • examples/prisma-8-demo/fixtures/wide-fan/migrations/snapshots/93be6c200743261baf55f0586b1380a1c0ade3c48730c09a8fec71ba419c2464/contract.json
  • examples/prisma-8-demo/fixtures/wide-fan/migrations/snapshots/afdcd8ee600252054660e79266ede99d1f5227b586225985565eff24414696d0/contract.d.ts
  • examples/prisma-8-demo/fixtures/wide-fan/migrations/snapshots/afdcd8ee600252054660e79266ede99d1f5227b586225985565eff24414696d0/contract.json
  • examples/prisma-8-demo/fixtures/wide-fan/migrations/snapshots/f224748df616e79a307d7d1d964b2cca74f858a8f00c95ed131d7675a3e74554/contract.d.ts
  • examples/prisma-8-demo/fixtures/wide-fan/migrations/snapshots/f224748df616e79a307d7d1d964b2cca74f858a8f00c95ed131d7675a3e74554/contract.json
  • examples/prisma-8-demo/migrations/snapshots/06b2dc7bf45a1c5bf00ae3a80653b88fc0146101673e2a029b2c7db290833284/contract.d.ts
  • examples/prisma-8-demo/migrations/snapshots/06b2dc7bf45a1c5bf00ae3a80653b88fc0146101673e2a029b2c7db290833284/contract.json
  • examples/prisma-8-demo/migrations/snapshots/2268a4dd377c4a238d1c8d5fada0056356d753619b26472c10cb1d258d7cea77/contract.d.ts
  • examples/prisma-8-demo/migrations/snapshots/2268a4dd377c4a238d1c8d5fada0056356d753619b26472c10cb1d258d7cea77/contract.json
  • examples/prisma-8-demo/migrations/snapshots/62d81d607d929760f7d740b45bb97acc1dba361363c4851b19ee5a1cb4fecbe3/contract.d.ts
  • examples/prisma-8-demo/migrations/snapshots/62d81d607d929760f7d740b45bb97acc1dba361363c4851b19ee5a1cb4fecbe3/contract.json
  • examples/prisma-8-demo/migrations/snapshots/8abaa3b97115767c5fee67bcd90de0cec3ac1f14a59875c2f5d22887ba435f89/contract.d.ts
  • examples/prisma-8-demo/migrations/snapshots/8abaa3b97115767c5fee67bcd90de0cec3ac1f14a59875c2f5d22887ba435f89/contract.json
  • examples/prisma-8-demo/migrations/snapshots/b1643ad5e63c8896f80a44f59430cefd17a44554e3b5458121bf1bc87a89bbc0/contract.d.ts
  • examples/prisma-8-demo/migrations/snapshots/b1643ad5e63c8896f80a44f59430cefd17a44554e3b5458121bf1bc87a89bbc0/contract.json
  • examples/prisma-8-demo/migrations/snapshots/f62a4154d0b48cb144ca4f74667fc6922e770f81edd5517393285fb92d07dddc/contract.d.ts
  • examples/prisma-8-demo/migrations/snapshots/f62a4154d0b48cb144ca4f74667fc6922e770f81edd5517393285fb92d07dddc/contract.json
  • examples/prisma-8-demo/src/prisma/contract.d.ts
  • examples/prisma-8-demo/src/prisma/contract.json
  • examples/prisma-8-postgis-demo/migrations/snapshots/22e2633fb68e81380243a7fb492d650f4b45dcf990f2a3a146744fe8e2277423/contract.d.ts
  • examples/prisma-8-postgis-demo/migrations/snapshots/22e2633fb68e81380243a7fb492d650f4b45dcf990f2a3a146744fe8e2277423/contract.json
  • examples/prisma-8-postgis-demo/src/prisma/contract.d.ts
  • examples/prisma-8-postgis-demo/src/prisma/contract.json
  • examples/prisma7-adoption/migrations/snapshots/8a3bf4f3a5f417a5be8a3c3f1fd5047d9bcee0bc6b9901c90cda00c4550f3282/contract.d.ts
  • examples/prisma7-adoption/migrations/snapshots/8a3bf4f3a5f417a5be8a3c3f1fd5047d9bcee0bc6b9901c90cda00c4550f3282/contract.json
  • examples/react-router-demo/src/prisma/contract.d.ts
  • examples/react-router-demo/src/prisma/contract.json
  • examples/supabase/src/contract.d.ts
  • examples/supabase/src/contract.json
  • packages/1-framework/0-foundation/contract/src/types.ts
  • packages/1-framework/0-foundation/contract/test/contract-factories.test.ts
  • packages/1-framework/0-foundation/contract/test/execution-mutation-default.test-d.ts
  • packages/1-framework/0-foundation/contract/test/hashing.test.ts
  • packages/2-sql/1-core/contract/src/validators.ts
  • packages/2-sql/1-core/contract/test/execution-defaults-validation.test.ts
  • packages/2-sql/2-authoring/contract-prisma7/test/fixtures/generators/expected-contract.json
  • packages/2-sql/2-authoring/contract-prisma7/test/fixtures/updated-at/expected-contract.json
  • packages/2-sql/2-authoring/contract-psl/test/composed-mutation-defaults.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.defaults.functions.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.defaults.generator-storage.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.defaults.presets.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.defaults.temporal-codecs.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/provider.test.ts
  • packages/2-sql/2-authoring/contract-ts/schemas/data-contract-sql-v1.json
  • packages/2-sql/2-authoring/contract-ts/src/build-contract.ts
  • packages/2-sql/2-authoring/contract-ts/test/authoring-uuid-native-presets.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract-builder.contract-definition.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract-builder.dsl.helpers.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract-builder.dsl.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract.logic.test.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.generation.basic.test.ts
  • packages/2-sql/5-runtime/src/sql-context.ts
  • packages/2-sql/5-runtime/test/mutation-default-generators.test.ts
  • packages/2-sql/5-runtime/test/sql-context.test.ts
  • packages/3-extensions/postgres/test/contract-builder/define-contract.test.ts
  • packages/3-extensions/sql-orm-client/src/collection-contract.ts
  • packages/3-extensions/sql-orm-client/src/types.ts
  • packages/3-extensions/sql-orm-client/test/create-input.test-d.ts
  • packages/3-extensions/supabase/test/fixtures/example-app/contract.d.ts
  • packages/3-extensions/supabase/test/fixtures/example-app/contract.json
  • packages/3-extensions/supabase/test/fixtures/no-policy/contract.d.ts
  • packages/3-extensions/supabase/test/fixtures/no-policy/contract.json
  • packages/3-extensions/supabase/test/fixtures/renamed-policy/contract.d.ts
  • packages/3-extensions/supabase/test/fixtures/renamed-policy/contract.json
  • scripts/lint-framework-vocabulary.config.json
  • test/integration/test/authoring/parity/default-cuid-2/expected.contract.json
  • test/integration/test/authoring/parity/default-nanoid-16/expected.contract.json
  • test/integration/test/authoring/parity/default-nanoid/expected.contract.json
  • test/integration/test/authoring/parity/default-pack-slugid/expected.contract.json
  • test/integration/test/authoring/parity/default-ulid/expected.contract.json
  • test/integration/test/authoring/parity/default-uuid-v4/expected.contract.json
  • test/integration/test/authoring/parity/default-uuid-v7/expected.contract.json
  • test/integration/test/sql-builder/fixtures/generated-no-pgvector/contract.d.ts
  • test/integration/test/sql-builder/fixtures/generated-no-pgvector/contract.json
  • test/integration/test/sql-orm-client/collection-mutation-defaults.test.ts
  • upgrade-instructions/pending/execution-ref-entry-field/app/instructions.md
  • upgrade-instructions/pending/execution-ref-entry-field/extension/instructions.md

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Mutation default references now identify targets by namespace, entry, and field instead of table and column. The contract type, validation, authoring, runtime matching, generated contracts, snapshots, tests, and upgrade instructions reflect the new reference shape.

Changes

Mutation default reference contract

Layer / File(s) Summary
Contract definition and authoring
docs/architecture docs/adrs/ADR 158 - Execution mutation defaults.md, packages/1-framework/0-foundation/contract/*, packages/2-sql/1-core/contract/*, packages/2-sql/2-authoring/*, packages/2-sql/3-tooling/emitter/*, packages/3-extensions/postgres/*
The reference type and validation schema use namespace, entry, and field. Contract generation sorts defaults by entry and field. Authoring and type-level tests use the updated shape, and validation tests reject the old keys.
Runtime and ORM matching
packages/2-sql/5-runtime/*, packages/3-extensions/sql-orm-client/*, test/integration/test/sql-orm-client/*
Runtime default application selects by ref.entry and reads the destination from ref.field. ORM create-default checks compare the entry and field. Related tests use the new shape.
Generated contracts and upgrade instructions
examples/*/contract.*, examples/*/migrations/snapshots/*/contract.*, examples/prisma-8-demo/fixtures/*/migrations/snapshots/*/contract.*, packages/2-sql/2-authoring/contract-prisma7/test/fixtures/*, packages/3-extensions/supabase/test/fixtures/*, test/integration/test/authoring/parity/*, test/integration/test/sql-builder/fixtures/*, upgrade-instructions/pending/execution-ref-entry-field/*, scripts/lint-framework-vocabulary.config.json
Generated references and expected contracts use entry and field. Execution hashes change in affected generated artifacts. Upgrade instructions cover contract re-emission, snapshot updates, and direct code reads.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 13625

No actionable issue is established; the change is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to 13625

The new reference format is consistent across the updated writer and readers, but contracts and readers using different versions may not work together during deployment or rollback. No new attacker-controlled access path was identified.

Retained concerns

  • Medium · reliability · inferred: Mixed-version readers and contracts are not shown to be compatible. During a staged update or rollback, legacy references fail new validation, while readers expecting table and column cannot use renamed references. This can disrupt write-time defaults until reader and artifact versions are coordinated.
Security review details

Security Blast Radius

  • inferred — The compatibility exposure is limited to contracts with execution defaults and consumers crossing the old/new format boundary. The evidence does not quantify affected deployments or establish tenant-wide or privileged reachability.

Trust Boundaries and Controls

  • observed — The SQL validator rejects unexpected keys in execution-default references, and the inspected runtime still scopes a default by namespace and entry before applying it to a field.

Resilience and Maintainability Implications

  • inferred — Forward-regenerated artifacts address the new format, but strict validation leaves mixed-version operation and interruption recovery dependent on deployment coordination not demonstrated here.

Hardening Proposals

  • proposed — Define and verify an artifact-and-reader rollout and rollback sequence for contracts with execution defaults, including behavior after interruption or reuse of an older snapshot.
🚥 Pre-merge checks | ✅ 5

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: execution default references now use entry and field names instead of table and column names.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 5…
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.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

@pkg-pr-new

pkg-pr-new Bot commented Sep 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

@prisma/orm-extension-arktype-json

npm i https://pkg.pr.new/@prisma/orm-extension-arktype-json@30399

@prisma/orm-extension-middleware-cache

npm i https://pkg.pr.new/@prisma/orm-extension-middleware-cache@30399

@prisma/orm-extension-paradedb

npm i https://pkg.pr.new/@prisma/orm-extension-paradedb@30399

@prisma/orm-extension-pgvector

npm i https://pkg.pr.new/@prisma/orm-extension-pgvector@30399

@prisma/orm-extension-postgis

npm i https://pkg.pr.new/@prisma/orm-extension-postgis@30399

@prisma/orm-extension-supabase

npm i https://pkg.pr.new/@prisma/orm-extension-supabase@30399

@prisma/orm-family-mongo

npm i https://pkg.pr.new/@prisma/orm-family-mongo@30399

@prisma/orm-family-sql

npm i https://pkg.pr.new/@prisma/orm-family-sql@30399

@prisma/orm-framework

npm i https://pkg.pr.new/@prisma/orm-framework@30399

@prisma/orm-mongo

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

@prisma/orm-postgres

npm i https://pkg.pr.new/@prisma/orm-postgres@30399

@prisma/orm-sqlite

npm i https://pkg.pr.new/@prisma/orm-sqlite@30399

@prisma/orm-target-mongo

npm i https://pkg.pr.new/@prisma/orm-target-mongo@30399

@prisma/orm-target-postgres

npm i https://pkg.pr.new/@prisma/orm-target-postgres@30399

@prisma/orm-target-sqlite

npm i https://pkg.pr.new/@prisma/orm-target-sqlite@30399

@prisma/orm-toolchain

npm i https://pkg.pr.new/@prisma/orm-toolchain@30399

commit: 13625d2

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
postgres / no-emit 194.93 KB (+0.01% 🔺)
postgres / emit 165.59 KB (+0.01% 🔺)
mongo / no-emit 110.52 KB (0%)
mongo / emit 92.01 KB (0%)
cf-worker / no-emit 218.07 KB (+0.01% 🔺)
cf-worker / emit 185.52 KB (+0.01% 🔺)

@wmadden

wmadden commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@wmadden-electric
wmadden-electric added this pull request to the merge queue Sep 25, 2026
Merged via the queue into main with commit 5b0683d Sep 25, 2026
27 checks passed
@wmadden-electric
wmadden-electric deleted the execution-ref-neutral-names branch September 25, 2026 13:55
wmadden-electric added a commit that referenced this pull request Sep 25, 2026
main renamed the keys of an execution default's ref from table and column to entry and field (#30399). The printer and its tests read the new keys.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden-electric added a commit that referenced this pull request Sep 25, 2026
The project spec, plan and design notes take main's five-slice version from #30399.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Thegreatsura pushed a commit to Thegreatsura/prisma that referenced this pull request Sep 26, 2026
…tamps on create and update (prisma#30403)

> Stacked on prisma#30396 (Mongo target owns its codecs) and prisma#30399 (execution
ref rename). Until those merge, their commits appear in this diff; the
slice 3 work starts at commit 80ac5d7.

A Mongo schema in Prisma 8 can now declare automatic timestamps, the
same way a Postgres schema does:

```prisma
model Post {
  id        ObjectId               @id
  title     String
  createdAt temporal.createdAt()
  updatedAt temporal.updatedAt()
}
```

```ts
const Post = model('Post', {
  fields: {
    title: field.string(),
    createdAt: field.temporal.createdAt(),
    updatedAt: field.temporal.updatedAt(),
  },
});
```

`orm.post.create({ data: { title: 'x' } })` writes both timestamps. An
update with a non-empty payload advances `updatedAt`; an empty payload
writes nothing. Both fields are optional on the create input type. Until
this PR, Mongo had no way to declare a write-time default at all:
`@updatedAt` was a hard error and the ORM never filled anything in.

## The decision

Mongo reuses the framework's field-preset machinery and the same
`temporal.*` presets Postgres registers, and its contract carries the
same `execution` section (`{ ref: { namespace, entry, field }, onCreate,
onUpdate }`, hashed into `executionHash`). The pieces that were
SQL-local but not SQL-specific move up into the framework so both
families call one implementation: the temporal preset builders and the
`timestampNow` control descriptor, the PSL field-preset resolution
helpers, the arktype schema for the execution section, and the
TypeScript helpers that turn a pack's `authoring.field` namespace into
callable `field.*` helpers. The runtime generator registry and apply
loop stay Mongo-local in this PR, as a deliberate short-lived duplicate
of the SQL runtime's; the next PR hoists both into the framework.

## How the pieces fit

**Registration.** The Mongo target descriptor contributes
`authoring.field.temporal.{createdAt, updatedAt, timestamp}` built from
the framework's `temporalAuthoringPresets` and `temporalCodecPreset` on
`mongo/date@1`, plus the `timestampNow` control descriptor. A
runtime-only descriptor meta keeps the authoring surface out of the
runtime bundle, as Postgres does. There is no precision argument: Mongo
dates have none.

**PSL.** The Mongo interpreter resolves a namespaced call in type
position (`temporal.createdAt()`) against the composed field presets
before the bare scalar lookup, using the same helpers SQL uses (now in
`@internal/psl-parser/interpret` and
`@internal/framework-components/authoring`). Diagnostics mirror SQL: a
preset on an optional field, a list, or an `@id` field, an unknown
preset, an uncomposed namespace, or a bad argument each get the SQL
code. Two refusals are Mongo-only and report
`PSL_UNSUPPORTED_FIELD_TYPE`: a preset on a composite-type field, and a
preset that contributes a storage default, id, or unique, which Mongo
cannot represent. `@updatedAt` still errors, now pointing at
`temporal.updatedAt()`.

**TypeScript.** `field.temporal.*` is composed from the packs'
`authoring.field` namespaces through helpers hoisted from SQL into
`@internal/contract-authoring`, so PSL and TS instantiate one registry
entry. A field builder carries the preset's phases as a type parameter;
execution defaults on a nullable field, a list, a value object, or a
model with no collection throw `CONTRACT.DEFAULT_INVALID`. Both paths
build the `execution` section through one function in
`@internal/mongo-contract` that sorts by namespace, entry, field and
computes `executionHash`; the arktype schema for the section now lives
once in `@internal/contract` and both families' validators import it.

**Runtime.** `createMongoExecutionContext` collects
`mutationDefaultGenerators` from target, adapter, and extensions,
refuses duplicate ids naming both owners, and refuses to build when the
contract requires a generator no component provides, with the SQL error
codes and message. It exposes `applyMutationDefaults` with SQL
semantics: an empty update payload applies nothing, explicit values win,
`'row'` stability yields one value per row per call and `'query'` one
per operation. The `timestampNow` runtime generator (`new Date()`, query
stability) lives in the Mongo family package and the adapter registers
it, as the Postgres adapter registers SQL's.

**ORM and facade.** The ORM sits below the runtime layer, so it depends
on a `MongoMutationDefaults` interface in `@internal/mongo-contract`
that the execution context satisfies; `mongoOrm` takes it as a
`mutationDefaults` option and `mongo()` passes the context through;
building `mongoOrm` by hand without it, for a contract that declares
generators, throws `ORM.MUTATION_DEFAULTS_MISSING` naming the fix rather
than silently writing documents without their timestamps. `create`,
`createAll`, `createAndCount`, and the insert half of `upsert` apply
`onCreate`; `update`, `updateAll`, `updateAndCount`, and the update half
of `upsert` apply `onUpdate` only when the payload is non-empty.
Generated fields are optional on the create input type on both the
emitted `contract.d.ts` path and the no-emit TypeScript path.

## What you will see in the diff

- **Hoists.** SQL packages change import paths for the temporal preset
builders, the PSL preset-resolution helpers and argument mapping, and
the TS field-helper composition. Each is a pure move; SQL tests are
unchanged in intent and green. `@internal/family-sql/control` no longer
exports the temporal builders (they are in
`@internal/framework-components/authoring` and `/control`), which the
`temporal-presets-move-to-framework` upgrade fragment covers.
- **Runtime tests relocated.** The Mongo runtime package dev-depended on
the family, target, adapter, and mongodb-memory-server so its tests
could build a real stack; SQL's runtime has no such dependencies, and
they made it impossible for the family to depend on the runtime without
a package cycle. The tests that need a real stack (17 files plus a
fixture) moved to `test/integration/test/mongo/runtime/` with bodies
intact; two files were split so an internal hash function is not
exported for tests. The runtime package keeps 100% coverage through new
in-package unit tests built from plain descriptor objects.
- **New integration fixture**
`test/integration/test/mongo/temporal-presets/` with the same model
authored in PSL and in TS. The two emit an identical `execution` section
and `executionHash`.
- **Upgrade fragment** `mongo-execution-defaults`: hand-written
`MongoExecutionContext` objects must now provide
`applyMutationDefaults`. Application code needs no change.

## Alternatives considered

- **Prisma 6 style `@default(now())` and `@updatedAt` attributes on
Mongo.** Rejected: Mongo in Prisma 8 mirrors Postgres and reuses
framework primitives; a second grammar would need a second printer rule
and its own type-blind validation.
- **A Mongo-specific `execution` type with model and field refs.**
Rejected after it produced over a thousand type errors; the framework
ref was renamed to neutral names in prisma#30399 instead.
- **Hoisting the runtime registry into the framework in this PR.**
Deferred to its own PR to keep this one reviewable.
- **Omitting a precision argument versus ignoring it.** Mongo dates have
no precision, so the argument does not exist.

Known gaps recorded for later: PSL- and TS-authored Mongo contracts
still differ in `storageHash` and validators for reasons that predate
this PR, and SQL sorts execution defaults without the namespace key.

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


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added MongoDB timestamp presets for `createdAt`, `updatedAt`, and
custom timestamps on create and update operations.
* Generated timestamps are shared across an ORM operation, preserve
explicitly supplied values, and allow generated-on-create fields to be
omitted from create inputs.
* MongoDB reports clear errors when required default generators are
missing or duplicated.
* **Compatibility**
* Execution-default references now identify fields by entry and field
rather than table and column.
* **Documentation**
* Updated contract, MongoDB usage, and upgrade guidance for timestamp
defaults and field references.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
xb18 pushed a commit to xb18/prisma-orm that referenced this pull request Sep 27, 2026
…the contract source (prisma#30405)

> Stacked on prisma#30403 (Mongo execution defaults), which is stacked on
prisma#30396 and prisma#30399. Until those merge, their commits appear in this diff;
the slice 5 work starts at commit e33782e.

A Prisma 6 MongoDB project can point Prisma 8 at its existing
`schema.prisma` and get a contract without rewriting anything:

```ts
// prisma.config.ts
import { definePrismaConfig } from 'prisma/config';
import { defineConfig as ormConfig, prisma6Schema } from '@prisma/orm-mongo/config';

export default definePrismaConfig({
  orm: ormConfig({
    contract: prisma6Schema('prisma/schema.prisma'),
    db: { connection: process.env['DATABASE_URL']! },
  }),
});
```

```prisma
// prisma/schema.prisma, unchanged Prisma 6
model Post {
  id        String   @id @default(auto()) @Map("_id") @db.ObjectId
  title     String
  views     BigInt
  meta      Json
  authorId  String   @db.ObjectId
  author    User     @relation(fields: [authorId], references: [id])
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedat
  @@index([authorId])
}
```

`prisma contract emit` produces the same contract Prisma 8 PSL would for
the equivalent model written with `ObjectId`, `Int64`, `Json`,
`temporal.createdAt()`, and `temporal.updatedAt()`, and `prisma db sign`
verifies it against the database Prisma 6 built with zero findings.

## The decision

The Prisma 6 MongoDB dialect is a first-class contract source, read by
its own package (`@internal/mongo-contract-prisma6`, published as
`@prisma/orm-family-mongo/provider`) that mirrors the Prisma 7 Postgres
reader shipped in prisma#30287. It parses with the Prisma 8 parser in its
Prisma 7 grammar mode and builds the Mongo contract directly from the
family's exported building blocks, so the storage hash and execution
hash come from the same code the Prisma 8 interpreter uses. Everything
the reader cannot express is a hard error with a `PSL.PRISMA6_MONGO_*`
code and a span; nothing is silently dropped or approximated (ADR 252).
The function is named `prisma6Schema` because Prisma 7 has no MongoDB
connector, so the dialect it reads is Prisma 6's.

## How the pieces fit

**Binding.** The Mongo target supplies a `Prisma6TargetBinding`
(accepted providers, the scalar-to-codec map, the ObjectId codec, the
timestamp generator id). The reader holds no target facts, matching the
Prisma 7 reader's `Prisma7TargetBinding`.

**What maps.** `String`, `Int`, `Float`, `Boolean`, `DateTime` to the
existing codecs; `BigInt`, `Decimal`, `Bytes`, `Json` to the codecs
prisma#30396 added; `String @db.ObjectId` to the ObjectId codec; `DateTime
@default(now())` to an on-create `timestampNow` generator and
`@updatedAt` (with or without `@default(now())`) to on-create plus
on-update, which is what `temporal.createdAt()` and
`temporal.updatedAt()` from prisma#30403 produce; composite `type` blocks to
value objects; enums with member `@map` storage values; to-one
`@relation(fields, references)`; `@unique`, `@@unique`, `@@index` with
sort order; `@@fulltext` to a text index; `@map` and `@@map`; `@ignore`
and `@@ignore` omitted. Index names are dropped: Mongo verify matches
indexes by keys and options, never by name.

**What is a hard error, expected to flip later as the Mongo family gains
each capability.** Composite ids, `@map` on a composite-type field,
referential actions on `@relation`, the scalar-list many-to-many shape,
`@default` values other than `now()` and `auto()` on `_id` (Mongo has no
storage defaults and registers no id generators), optional generated
fields, `@updatedAt` on a non-`DateTime`, other `@db.*` types,
`Unsupported(...)`, `view`, and `@@schema` (which has no Mongo meaning
and stays an error).

**No validators.** The Prisma 8 Mongo PSL interpreter emits a strict
`$jsonSchema` validator per collection; a Prisma 6 database has none,
and Mongo verify fails on a declared-but-missing validator. The reader
emits none, which the TypeScript builder already does, so `db sign`
passes against the database as Prisma 6 left it. The parity test shows
validators are the only storage difference from the equivalent Prisma 8
PSL contract.

**Facade.** `defineConfig` in `@prisma/orm-mongo/config` accepts
`contract: string | ContractConfig`, exactly as the Postgres facade
does, and exports `prisma6Schema`.

**Also in this PR.** The Prisma 8 Mongo PSL interpreter now reports
unknown top-level blocks (`view`, `datasource`, `generator`) with
`PSL_UNSUPPORTED_TOP_LEVEL_BLOCK` instead of dropping them silently,
mirroring SQL. The storage builder and back-relation pairing the reader
shares with the interpreter were hoisted into the family packages so
there is one implementation of each.

## What you will see in the diff

- **Fixtures.** One case per rule-table row and per error code under
`packages/2-mongo-family/2-authoring/contract-prisma6/test/fixtures/`,
in the Prisma 7 reader's layout (`schema.prisma` or a `schema/`
directory, `expected-contract.json` or `expected-diagnostics.json`,
regenerated with `UPDATE_PRISMA6_FIXTURES=1`), plus a parity test
against the equivalent Prisma 8 PSL schema.
- **CLI journey.**
`test/integration/test/cli-journeys/prisma6-source.e2e.test.ts` creates
the collections and indexes Prisma 6 `db push` would create (no
validators, Prisma 6 index names, unique indexes for `@unique`), then
runs `contract emit`, `db sign`, and `db verify` through the CLI: zero
findings in lenient and strict mode. An extra undeclared index is a
warning in lenient mode and a failure in strict mode, as expected.
- **Shared building blocks.** `buildMongoStorage` and
`encodeMongoValueSets` now live in `@internal/mongo-contract`, and
`pairMongoBackRelations` in `@internal/mongo-contract-psl`; the Prisma 8
interpreter and the reader both call them, and `fixtures:check` shows no
hash moved.
- **Docs.** `prisma6Schema` section in the Mongo facade README, the
`PSL.PRISMA6_MONGO_*` codes in `docs/reference/error-reference.md`, and
notes in the Prisma 8 skill references. The superseded slice spec under
the Prisma 7 contract-source project is deleted and that project's
deferred-gaps entries for Mongo defaults and codecs are marked filled.

## Alternatives considered

- **Rewriting the Prisma 6 file into Prisma 8 syntax and running the
Prisma 8 interpreter.** Rejected: several Prisma 6 facts have no channel
through the interpreter (composite `@map`, enum member `@map`, the
ObjectId codec on a `String` field), and every rewrite would be a lossy
rule. The Postgres reader builds the contract directly for the same
reason.
- **Emitting validators and asking users to apply them before signing.**
Rejected for the adoption story: `db sign` must pass against the
database Prisma 6 built; validators come with the switch to Prisma 8
PSL.
- **Warnings for unsupported constructs.** Rejected by ADR 252: a
construct the reader cannot express is a hard error, and each error is a
signal to build the feature.

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


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Use Prisma 6 MongoDB schemas from a file or directory as contract
sources.
* Schema interpretation supports models, relations, indexes, enums,
composite types, lists, and timestamps.
* Mongo configuration accepts either a contract source path or a
contract configuration.
* Sign and verify MongoDB databases against emitted contracts;
verification reports undeclared indexes.
* **Bug Fixes**
* `contract emit` identifies unsupported indexes on composite-type
fields and suggests indexing a top-level field or removing the index.
* **Documentation**
* Added guidance on supported schemas, configuration, and database
ownership during migration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
Thegreatsura pushed a commit to Thegreatsura/prisma that referenced this pull request Sep 28, 2026
…work, for SQL and Mongo (prisma#30406)

> Stacked on prisma#30405, which is stacked on prisma#30403, prisma#30396 and prisma#30399.
Until those merge, their commits appear in this diff; the slice 4 work
starts at commit 7795377.

Both database families now run the same write-time default machinery.
The SQL runtime and the Mongo runtime each call three framework
functions instead of carrying their own registry, availability check,
and apply loop:

```ts
import {
  applyMutationDefaults,
  assertMutationDefaultGeneratorsAvailable,
  collectMutationDefaultGenerators,
} from '@internal/framework-components/runtime';

const generators = collectMutationDefaultGenerators([target, adapter, ...extensions]);
assertMutationDefaultGeneratorsAvailable(contract.execution, generators);
// per ORM operation:
applyMutationDefaults(contract.execution, generators, { op: 'create', namespace, entry, values, defaultValueCache });
```

A generator is `{ id, generate(params?), stability: 'field' | 'row' |
'query' }`, typed once in the framework; the SQL and Mongo
`timestampNow` generators and the Postgres Temporal generators all use
that type.

## The decision

The mutation-default runtime is framework-owned. It was written for SQL
and lived in `@internal/sql-runtime`; prisma#30403 gave Mongo a deliberate
short-lived copy so the Mongo work could land without touching SQL. This
PR deletes both copies and moves the code, with the SQL semantics
verbatim, into
`framework-components/src/execution/mutation-defaults.ts`. Nothing in it
was ever SQL-specific except the option key names, and prisma#30399 had
already made the contract reference neutral; this PR finishes the rename
in the runtime options (`table` becomes `entry`, `column` becomes
`field`).

## How the pieces fit

**Semantics, unchanged from SQL.** A duplicate generator id refuses
context creation naming both owners; a contract that requires a
generator no component provides refuses context creation listing the
ids; a key present in the values is explicit whatever its value; an
update with no keys applies nothing; `'row'` stability gives one value
per row per call, `'query'` one per operation through the caller's
cache, `'field'` none; a reference is applied once per call. The unit
tests moved from the SQL runtime package to the framework and run
against plain contributor objects; the SQL package keeps only its wiring
tests.

**SQL.** The runtime calls the framework in the same place it ran its
own code, after codec collection. The lanes' `ExecutionContext` extends
the framework `MutationDefaults` interface. The ORM client, the mutation
executor, and the SQL builder lane follow the option and result key
rename. A new SQL builder test pins the existing rule that a key present
with an `undefined` value counts as explicit.

**Mongo.** The runtime copy from prisma#30403 is deleted;
`MongoExecutionContext` extends the same `MutationDefaults` interface
and the Mongo ORM depends on it. The Mongo `undefined`-as-absent
behaviour is a caller rule and its tests moved to the ORM level.

**One execution-section builder.** `buildExecutionSection` in
`@internal/contract` sorts defaults by namespace, entry, field and
computes `executionHash`; both families' authoring paths use it. SQL
previously sorted without the namespace key, so two multi-namespace
fixtures re-hash; everything else is byte-identical.

**ADR and docs.** ADR 255, "Mutation-default generators are a framework
runtime concern", records the generator contract, the three stabilities
and their caches, the availability check and its two error codes, the
explicit-key rule and why `namespace` is required, the neutral reference
and the sort order, and why each family keeps its own check position.
ADR 158's example is updated; subsystem 4 (Runtime & Middleware
Framework) gains a mutation-defaults section and subsystem 10 points at
it.

## What you will see in the diff

- **Deleted code.** The registry, availability check, apply loop, and
generator types are gone from
`packages/2-sql/5-runtime/src/sql-context.ts` and
`packages/2-mongo-family/7-runtime/src/mongo-execution-stack.ts`; both
keep only the wiring. `mongo-contract`'s `mutation-defaults.ts` and
`build-execution-section.ts` are deleted.
- **Renamed keys in SQL callers.** `table` → `entry` and `column` →
`field` in the SQL ORM client, the mutation executor, the SQL builder
lane, and their test stubs. Nothing else in those files changes.
- **Moved tests.** The SQL runtime's generator tests now live in
`framework-components/test/mutation-defaults.test.ts` and run against
plain contributor objects; the SQL and Mongo runtime packages keep
wiring tests only (including a new test per family pinning where the
check runs relative to codec collection). The Mongo ORM gains tests that
it strips `undefined` before calling the framework.
- **Dependencies.** `family-sql` no longer depends on `sql-runtime` and
`family-mongo` no longer depends on `mongo-runtime`; neither had a
source import left.
- **Fixtures.** Two multi-namespace SQL fixtures re-hash
(`test/integration/test/ports/prisma/functional/multi-schema/_fixture/{different-names,no-map}`),
the only contracts whose execution defaults span more than one namespace
and were not already in namespace order.
- **Upgrade instructions.**
`upgrade-instructions/pending/mutation-default-runtime-in-framework/extension/instructions.md`
covers the moved SQL and Mongo types, the renamed option and result
keys, and `buildMongoExecutionSection` → `buildExecutionSection`.

## Alternatives considered

- **Keep two copies and let them drift.** Rejected: the caching rule and
the error contract are exactly the kind of thing that diverges silently,
and the two copies had already diverged in `undefined` handling and
check placement.
- **Hoist before building the Mongo half.** Rejected during shaping: the
framework reference still carried SQL names then, and the Mongo work
would have blocked on a SQL-wide rename. Doing it in this order kept
each PR reviewable.
- **Treat `undefined` as absent inside the framework.** Rejected: that
would change the SQL builder lane's behaviour; callers that want it
(both ORMs) already filter before calling.

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


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Generated mutation defaults are now handled consistently across SQL
and MongoDB operations, with shared support for create and update
defaults.
* Defaults can be scoped to a specific entry and field, with
configurable value reuse and checks for missing or duplicate generators.
* Execution defaults are sorted consistently before hashing, supporting
stable contract results across environments.

* **Documentation**
* Added guidance on mutation-default behavior, generator stability, and
execution-section construction.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
Thegreatsura pushed a commit to Thegreatsura/prisma that referenced this pull request Sep 30, 2026
…cript instead of by hand (prisma#30453)

## At a glance

Step 2 of the `8.0.0-rc.12` to `8.0.0-rc.13` upgrade guide, run instead
of done by hand:

$ pnpm exec tsx
<skill>/upgrading/app/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/scripts/execution-ref-entry-field/rename-execution-ref-keys.ts
--check
    19 file(s) under migrations/ scanned, 19 need the rename.
$ pnpm exec tsx
<skill>/upgrading/app/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/scripts/execution-ref-entry-field/rename-execution-ref-keys.ts
    19 file(s) under migrations/ scanned, 19 got the rename.

One reference in a snapshot, before and after:

```json
{ "ref": { "namespace": "public", "table": "user", "column": "updated_at" } }
{ "ref": { "entry": "user", "field": "updated_at", "namespace": "public" } }
```

## What this PR changes

1. The published rc.12-to-rc.13 guides, app and extension, gain a script
for the `execution-ref-entry-field` change, and step 2 tells the reader
to run it.
2. Step 2 also names the intermediate contracts inside migration
packages, says the old key order varies between files, and names the
command that shows whether the rewrite worked.

## What the change is

Since prisma#30399 the emitted contract names the target of a generated
default (`temporal.updatedAt()`, `@default(uuid())` and the like) as
`ref: { entry, field, namespace }` where it used to say `{ table,
column, namespace }`. The values are the same; only the keys changed,
because Mongo is gaining write-time defaults and the shared types must
not use SQL words.

The toolchain refuses the old keys. A project's live `contract.json` is
fixed by `prisma contract emit`. Its migration snapshots are not: every
migration keeps a copy of the contract as it was, under
`migrations/snapshots/<hash>/contract.json` and `contract.d.ts`, and
those copies were written by the old release. Any command that loads one
of them, such as `prisma db migrate --to <hash>`, fails:

    CONTRACT.VALIDATION_FAILED: … contract.json failed to deserialize:
execution.mutations.defaults[0].ref.entry must be a string (was
missing);
    execution.mutations.defaults[0].ref.column must be removed …

The rc.13 guide's `execution-ref-entry-field` entry says to rename the
keys in every snapshot and leave the hashes alone: only `executionHash`
would change, nothing compares it, and the storage hash that names the
directory does not move. That instruction is right. It just had no
script, so it meant hand-editing every snapshot in the project. prisma#30399
renamed this repository's own 104 snapshot files with a script that was
never committed.

## What the script does

`rename-execution-ref-keys.ts` sits beside each guide under
`scripts/execution-ref-entry-field/`, as byte-identical copies for the
app and extension audiences, run with `pnpm exec tsx` from the project
root (the extension package root for an extension). It uses only Node
built-ins.

- It reads every `.json` and `.d.ts` file under any `migrations/`
directory, skipping `node_modules`, `.git` and `dist`, and changes only
files that hold `execution.mutations.defaults[].ref` entries.
`migration.json`, `ops.json` and `refs/*.json` are left byte-for-byte
alone.
- In JSON it renames the keys and writes them sorted (`entry`, `field`,
`namespace`). A file in canonical form is written the way
`writeContractSnapshot` writes it, so the result matches a fresh emit
apart from `executionHash`. An indented file, such as a hand-written
`intermediate.json`, keeps its indentation.
- In `.d.ts` it walks the declaration once, skipping quoted strings and
comments, and rewrites only the `ref` blocks that are elements of
`execution` → `mutations` → `defaults`. It renames `table` and `column`
and sorts the members, whatever order they were in, keeping single-line
and multi-line layouts. A `}` inside a quoted name does not end the
block, and a `readonly ref` anywhere else, such as a model field named
`ref`, is left alone.
- It replaces each file by writing a temporary file in the same
directory and renaming it over the target.
- It leaves `executionHash`, `storageHash`, `profileHash` and directory
names alone.
- A second run changes nothing. `--check` lists what would change and
exits 1 if anything would.
- A `.json` file that does not parse is listed as `NOT JSON`, left
untouched, and makes the run exit 1, with or without `--check`.

## The three prose additions

Applying the guide by hand in prisma/asks, on a dev build that carried
this change before rc.13 shipped, showed three things a reader needs
that the entry did not say:

- **Intermediate contracts.** A migration package can import a
hand-written contract (`migrations/app/<dir>/intermediate.json` and
`intermediate.d.ts`) with the same references. The entry's detection
patterns match them, but the prose named only `migrations/snapshots/`.
Step 2 now names both.
- **The old key order varies.** Older `.d.ts` files say `namespace,
table, column`; newer ones `column, namespace, table`. A hand edit or a
search-and-replace that assumes one order misses the rest. Step 2 says
so; the script sorts, so it does not care.
- **How to confirm it.** In an app, `prisma migration plan --from <dir>
--to <dir>`, naming one migration directory as both ends, loads that
snapshot without touching the database. It fails before the rewrite with
the error above and prints `No changes detected` after it. `prisma db
migrate --to <hash>` is no check: on a database already past that
snapshot it has no route back and fails either way. `prisma migration
check` and `prisma db verify` pass either way for app snapshots. In an
extension package, no command reads the package's own
`migrations/snapshots/`, and the CLI loads an extension space only at
its head, so the extension guide uses `--check` and names `prisma
migration check --space <space-id>` in an app that installs the
extension.

## Tests

The repository's rule for upgrade scripts is validation by execution. In
a disposable worktree of the branch head I restored the 104 snapshot
files prisma#30399 changed to their state before that PR, and added a
synthetic migration,
`test/synthetic-execution-ref/migrations/app/20260930T0000_synthetic/`,
with an indented `intermediate.json` and an `intermediate.d.ts`. Between
them they hold references in both old key orders, a single-line
reference, a quoted table name containing `}`, comments holding a quote
and braces, and an unrelated model-field block `readonly ref: { readonly
column: 'ref' }` outside the execution defaults. Then I ran the script
from the worktree root:

    $ tsx rename-execution-ref-keys.ts --check        # exit 1
    319 file(s) under migrations/ scanned, 106 need the rename.
    $ tsx rename-execution-ref-keys.ts
    319 file(s) under migrations/ scanned, 106 got the rename.
    $ tsx rename-execution-ref-keys.ts
    319 file(s) under migrations/ scanned, 0 got the rename.
    $ tsx rename-execution-ref-keys.ts --check        # exit 0
    319 file(s) under migrations/ scanned, 0 need the rename.

- The 94 files prisma#30399 had renamed by script came out byte-identical to
the branch. The other 10 are the 5 snapshots prisma#30399 regenerated by emit
instead; masking `executionHash` in both versions, every one matched.
That is the documented outcome, and it shows a rewritten `contract.json`
matches a fresh emit apart from that hash.
- Both synthetic files matched their expected output exactly: every
reference came out `entry, field, namespace`, the quoted `}` name was
renamed, the indentation and the single-line layout survived, and the
unrelated `ref` block was untouched. No temporary files were left
behind.
- A truncated `contract.json` holding `"table"` and `"column"` made
`--check` and a write run both print `NOT JSON …` and exit 1; the file
was left unchanged.
- After the run, the entry's detection regexes match one file under a
`migrations/` directory: the synthetic `intermediate.json`, whose
unrelated `"ref": { "column": "ref" }` block the detection pattern also
matches. The script leaves that block alone, as it should.
- The CLI built from this branch, on `examples/prisma-8-demo` with the
restored snapshots: `prisma migration plan --from
20260810T1108_add_post_engagement_counters --to
20260810T1108_add_post_engagement_counters` failed before the script
with `CONTRACT.VALIDATION_FAILED …
execution.mutations.defaults[0].ref.entry must be a string` and printed
`No changes detected` after it. `prisma migration check` passed before
the script.
- Extension space: with an old-key execution default added to the demo's
pgvector head snapshot, `prisma migration check --space pgvector` failed
with `MIGRATION.CHECK_CONTRACT_UNREADABLE`, and passed after the script.
From `packages/3-extensions/pgvector`, `prisma migration plan --from
<head hash> --to <head hash>` answers `MIGRATION.SNAPSHOT_MISSING … the
graph is empty`, which is why the extension guide offers no command
there.

Checks on the branch: `pnpm check:upgrade-coverage --mode dev` and
`--mode pr` against `origin/main`, `pnpm lint:skills`, `biome check` on
both guide directories, strict `tsc` on both script copies, `pnpm
lint:casts` and `pnpm lint:throws` (no increase), and `--check` on the
branch tree (317 files, 0 to rename) all pass.

## History of this branch

It opened as an addition to the pending fragment
`upgrade-instructions/pending/execution-ref-entry-field/`. While it was
open, rc.13 shipped (prisma#30457) and release preparation archived that
fragment and synthesized it into the published guides. A plain merge of
`main` followed the move and put the edits into the archived originals,
which must stay as shipped. The second commit restores the archive and
moves the script and prose into the published guides, so against `main`
the PR now changes only the two rc.13 `instructions.md` files and adds
the two script copies. That makes it a correction to published guidance,
which `upgrade-instructions/README.md` says goes through an ordinary
reviewed PR.

## Alternatives considered

- **Make the toolchain read the old `{ table, column }` shape.**
Rejected by the ORM owner: the toolchain should not parse an obsolete
representation. The upgrade step is the fix.
- **Tell readers to re-emit each snapshot.** Impossible: a snapshot is
the contract as it was at that migration, and emit only produces the
current one.
- **Leave step 2 as a hand edit.** Rejected: a project has one snapshot
per migration, the old key order differs between files, and prisma#30399
itself needed a script for 104 files.
- **Confirm with `prisma db migrate --to` against a fresh, empty
database.** Not needed: `prisma migration plan --from <dir> --to <dir>`
loads the same snapshot offline.
- **Fixing the misleading "Predecessor contract" wording for a failed
`--to` target.** Out of scope here; a separate follow-up.

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


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Upgrade Guidance**
* Updated the Prisma 8.0.0-rc.12 to 8.0.0-rc.13 upgrade instructions
with guidance for updating and validating migration snapshots and
intermediate contracts.
* **Migration Tooling**
* Added a tool to update reference keys in migration contracts. It can
check for required changes without modifying files and reports invalid
migration files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
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