Skip to content

TML-2747: drop the storage.namespaces wrapper (flat storage.<ns> IR)#649

Closed
wmadden-electric wants to merge 61 commits into
mainfrom
tml-2747-storage-namespaces-wrapper-drop
Closed

TML-2747: drop the storage.namespaces wrapper (flat storage.<ns> IR)#649
wmadden-electric wants to merge 61 commits into
mainfrom
tml-2747-storage-namespaces-wrapper-drop

Conversation

@wmadden-electric
Copy link
Copy Markdown
Contributor

@wmadden-electric wmadden-electric commented May 31, 2026

At a glance

Here is a Postgres contract's storage plane, before and after this change:

// before                                // after
"storage": {                             "storage": {
  "namespaces": {                          "storageHash": "",
    "__unbound__": {                       "__unbound__": {
      "tables": { "user": {  } }            "tables": { "user": {  } }
    }                                      }
  },                                     }
  "storageHash": ""
}

The namespaces envelope is gone. Namespace ids (__unbound__, and — in later slices — public, auth, …) are now direct keys under storage, and storageHash sits beside them as a reserved sibling key. Reading a namespace goes from storage.namespaces.public.tables to storage.public.tables.

Decision

Key the storage plane's namespaces directly under contract.storage, matching the canonical IR shape described in ADR 221. storageHash becomes a reserved sibling key (no namespace may be named storageHash).

This is the first slice of bringing the contract IR to its ADR 221 shape, and it does the storage plane only.

Why

The previous milestone shipped per-namespace storage, but kept every namespace behind a namespaces wrapper segment that ADR 221 never describes. That wrapper had two costs:

  1. Every storage consumer reached through a dead segment. Walking namespaces meant storage.namespaces.<id> everywhere — an extra hop that carried no information.
  2. Foundation couldn't express namespace topology. StorageBase (foundation) is hash-only; the namespace map lived a layer up. Code that needed to walk namespaces from foundation resorted to a duck-typing shim, because foundation may not import the layer where the map was declared.

Dropping the wrapper removes that whole class of accidental complexity: namespace ids are the storage keys, and three generic walk helpers — storageNamespaceEntries, storageNamespaceValues, getStorageNamespace — replace the ad-hoc reads across both families, targets, and extensions.

What changed

  • Substrate. The in-memory and serialized storage shape across foundation, both families (SQL + Mongo), targets, and extensions. Cast cleanup came with it: lint:casts is net −10 vs base — every wrapper-era cast removed, the few genuinely unavoidable ones converted to justified blindCast.
  • Fixtures & tests. Every on-disk contract.json / contract.d.ts, all migration storageHash pins, and inline test fixtures regenerated/flattened.
  • One real bug fixed. The Postgres control adapter's extractContractNamespaceIds still read the old wrapper, so flat-storage contracts introspected only the public schema and cross-namespace tables verified as missing. It now reads namespace ids through the walk helpers.
  • Merged current main. Reconciled with the closed-Mongo-$jsonSchema-validators change that landed in parallel; regenerated artifacts carry both.

Out of scope (deliberately)

These belong to later slices in the same stack and are not touched here:

  • Domain plane — flat contract.modelscontract.domain.<ns>.models (next slice).
  • Postgres public-by-default — the PSL policy for un-namespaced models.
  • Runtime SQL qualification — emitting "public"."user" at query time.

Verification

typecheck (138/138) · fixtures:check · lint:deps · lint:casts (−10) · test:e2e (104/104) — all green. test:integration is green modulo pre-existing PGlite connection-churn flakiness (passes in isolation).

Alternatives considered

  • Keep the namespaces wrapper. Rejected: it diverges from ADR 221, taxes every consumer with a dead segment, and is what forced the foundation-layer duck-typing shim in the first place.
  • Land the storage and domain planes together. Rejected: the two planes are independent, and one combined PR would be far larger and harder to review. Storage-first keeps each slice self-contained.
  • Model storageHash as a nested metadata object (e.g. storage.__meta__.storageHash) rather than a reserved sibling key. Rejected as unnecessary ceremony: a single reserved key is simpler, and namespace ids are already validated, so collision with storageHash is a non-issue.

wmadden added 30 commits May 30, 2026 21:25
… stack

S1 closed but shipped storage under a `namespaces` wrapper and never wired
the domain plane, so the emitted IR diverges from ADR 221. Re-plan the
umbrella's remaining work from scratch as one sequential thread
(S2 IR-canonicalization -> S3 Postgres public-by-default -> S4 runtime
qualification -> S5 explicit-namespace DSL, deferrable) rather than two
parallel projects: the only real concurrency (GAP 2) is not worth the
cross-project coordination, and GAP 1 must precede S4 regardless.

Signed-off-by: Will Madden <madden@prisma.io>
Intent-driven slice spec for TML-2747: bring the storage plane to ADR 221's
canonical `storage.<ns>` shape (no `namespaces` segment; `storageHash` a
reserved sibling key). File discovery left to the implementer.

Signed-off-by: Will Madden <madden@prisma.io>
D1 surgical substrate change (wrapper drop + in-memory typing decision);
D2 mechanical artifact regeneration + full gate sweep. Kept apart so design
judgment and mechanical fan-out do not share a dispatch.

Signed-off-by: Will Madden <madden@prisma.io>
…substrate

Namespace ids become direct keys under `storage` alongside the reserved
`storageHash`/`types` keys (ADR 221 canonical shape). Adds
`storage-plane-keys` with the reserved-key vocabulary plus
`storageNamespaceEntries`/`storageNamespaceValues`/`getStorageNamespace`
walk helpers, and reworks `elementCoordinates` to enumerate namespace-id
keys directly while skipping reserved keys. `StorageBase` loses its
`namespaces` member; `Storage` keeps only the typed `storageHash`.
Updates the foundation testing factories and the framework unit tests to
the flat shape.

Signed-off-by: Will Madden <madden@prisma.io>
SqlStorage sets namespace ids as own-enumerable keys via
`Object.defineProperty`, keeping `storageHash`/`types` as reserved
siblings; `buildSqlStorageInput` spreads a namespace map into the flat
input. Validators and canonicalization hooks walk the flat shape via the
framework `storageNamespaceEntries`/`getStorageNamespace` helpers, and
the arktype storage schema validates every non-reserved key as a
namespace entry.

Signed-off-by: Will Madden <madden@prisma.io>
The SQL emitter generates `storage.<ns>` namespace entries as direct
siblings of `storageHash` (no `namespaces` wrapper) and walks the flat
shape for table/enum resolution. Authoring builders and their unit tests
move to the flat shape.

Signed-off-by: Will Madden <madden@prisma.io>
…aces

Query-builder selection and relational-core codec lookup walk namespace
entries directly under `storage` rather than through `storage.namespaces`.
Storage-path update only — no change to the per-namespace type structure.

Signed-off-by: Will Madden <madden@prisma.io>
The sql-builder runtime and `Db`/`UnboundTables`/`TableProxyContract`
types index namespace entries directly under `storage` instead of
`storage.namespaces`. Storage-path update only — the
`TableNamesAcrossNamespaces`/`TableInAnyNamespace` indexing keeps the
same per-namespace structure, just rooted at the flat storage object.
The deferred `UnboundTables` rewrite (TML-2745) is NOT pulled in.

Signed-off-by: Will Madden <madden@prisma.io>
The SQL runtime context and codec validation walk namespace entries
directly under `storage` via the framework helpers instead of
`storage.namespaces`. Unit-test fixtures updated to the flat shape.

Signed-off-by: Will Madden <madden@prisma.io>
The SQL family contract-serializer hydration rebuilds `SqlStorage` from
flat namespace keys (via `buildSqlStorageInput`), and the schema-verify,
migration field-event planner, and contract-to-schema-IR walks iterate
namespace entries directly under `storage`. Family unit tests and
helpers updated to the flat shape.

Signed-off-by: Will Madden <madden@prisma.io>
MongoStorage sets namespace ids as own-enumerable keys via
`Object.defineProperty` with `storageHash` reserved; `buildMongoStorageInput`
spreads a namespace map into the flat input. The contract schema validates
every non-reserved storage key as a namespace envelope, and validate-storage
/ canonicalization hooks walk the flat shape. Foundation tests and the
hand-authored orm-contract fixture updated to the flat shape.

Signed-off-by: Will Madden <madden@prisma.io>
The Mongo authoring interpreters/builders, emitter (flat
`storage.<ns>` namespace type generation), family contract-serializer
hydration, schema verifier, schema-diff, and contract-to-schema walks
read namespace entries directly under `storage`. Authoring + family unit
tests updated to the flat shape.

Signed-off-by: Will Madden <madden@prisma.io>
The migration aggregate verifier, project-schema-to-space, and
integrity check read namespace entries directly under `storage` via the
framework helpers instead of `storage.namespaces`. Aggregate tests
updated to the flat shape.

Signed-off-by: Will Madden <madden@prisma.io>
Postgres contract serializer, schema, migration planners (enum-planning,
issue-planner, planner-strategies, verify-postgres-namespaces), the
postgres SQL renderer, and the sqlite planner read namespace entries
directly under `storage` via the framework helpers. Target serializer
and snapshot tests updated to the flat shape.

Signed-off-by: Will Madden <madden@prisma.io>
The Mongo target contract serializer and contract construction wrap the
flat namespace shape (namespace ids keyed directly under `storage`), and
target serializer/schema-verifier tests follow.

Signed-off-by: Will Madden <madden@prisma.io>
The sql-orm-client model accessor, collection contract, where-binding,
and query-plan helpers resolve tables through namespace entries directly
under `storage` via the framework helpers. Extension PSL-interpretation
and descriptor tests updated to the flat shape.

Signed-off-by: Will Madden <madden@prisma.io>
`storageNamespaceEntries`/`storageNamespaceValues`/`getStorageNamespace`
take `object` and are generic over the namespace concretion (callers
select `SqlNamespace` etc.), so class instances and plain records flow in
without per-call-site casts. Drops the now-redundant
`as Record<string, unknown>` arg casts across the SQL substrate, routes
build-contract through `buildSqlStorageInput`, and fixes the typecheck
fallout in SQL authoring/runtime/family and their tests.

Signed-off-by: Will Madden <madden@prisma.io>
Removes the now-unnecessary `as Record<string, unknown>` arg casts at the
generic walk-helper call sites across the Mongo family/target, the SQL
extensions, sqlite, and the postgres adapter, and fixes the related
typecheck fallout.

Signed-off-by: Will Madden <madden@prisma.io>
…ntCoordinates

Finishes the postgres target wrapper drop the mechanical pass left
incomplete: imports the generic walk helpers in the migration planners,
schema, and serializer; fixes a botched `ctx.toContract.storage` lookup;
routes test fixtures through `buildSqlStorageInput`; and selects
`SqlNamespace` at `.tables`/`.enum` access sites. Also widens
`elementCoordinates` to accept `object` so class instances pass without a
cast.

Signed-off-by: Will Madden <madden@prisma.io>
Imports the generic walk helper in the sqlite migration planner and
routes the planner/serializer test fixtures through `buildSqlStorageInput`
with `SqlNamespace`-typed lookups, finishing the wrapper drop the
mechanical pass left incomplete for this target.

Signed-off-by: Will Madden <madden@prisma.io>
…d tests

Trims the unused walk-helper imports in the SQL renderer, selects
`SqlNamespace` at the `.tables` lookup, and routes every migration test
fixture through `buildSqlStorageInput`, finishing the wrapper drop for
the postgres adapter.

Signed-off-by: Will Madden <madden@prisma.io>
Routes every sqlite migration test fixture through `buildSqlStorageInput`
(namespace ids keyed directly under `storage`), finishing the wrapper
drop for the sqlite adapter that the mechanical pass left incomplete.

Signed-off-by: Will Madden <madden@prisma.io>
The flat `TableProxyContract` constraint only requires the reserved
`storageHash` key (intersecting `Record<string, namespaceEntry>` would
force `storageHash` itself to be a namespace, which the reserved-key
storage shape cannot satisfy and which broke `Db<Contract<SqlStorage>>`
in the adapter runtimes). The table-name walk re-establishes the
`StorageTable` upper bound the prior `namespaces`-keyed constraint gave
via `infer Tables extends Record<string, StorageTable>`, and excludes the
reserved sibling keys. Drops the now-unused walk-helper imports in the
runtime and routes the field-proxy fixture through `buildSqlStorageInput`.
This is the reserved-key typing decision, not the deferred multi-namespace
DSL surface (TML-2745).

Signed-off-by: Will Madden <madden@prisma.io>
Imports the generic walk helper across the model accessor, collection
contract, where-binding, and query-plan helpers; selects `SqlNamespace`
at `.tables` lookups; flattens the `NamespaceTableDef` source type to walk
namespace-id keys directly (excluding the reserved `storageHash`/`types`
siblings); and gives the test helper a mutable namespace view for
in-place fixture assembly.

Signed-off-by: Will Madden <madden@prisma.io>
…tor/postgres tests

Adds the generic walk-helper imports, selects `SqlNamespace` at
`.tables`/`.enum` lookups, repairs a mechanically-mangled
`getStorageNamespace` call in the cipherstash descriptor test, and routes
the cipherstash codec fixture through `buildSqlStorageInput`.

Signed-off-by: Will Madden <madden@prisma.io>
Routes the pgvector planner test helpers and storage-types fixtures
through `buildSqlStorageInput` with the namespaces-keyed input type, and
drops the stale `namespaces: {}` wrapper from the cli contract-enrichment
test IR. pgvector typechecks fully green.

Signed-off-by: Will Madden <madden@prisma.io>
Drops the stale `namespaces` wrapper from the db-verify test contract so
namespace ids key directly under `storage`. CLI typechecks fully green.

Signed-off-by: Will Madden <madden@prisma.io>
…rage schema

The storage arktype schema used `+: reject`, which rejected the
namespace-id keys that now sit directly under `storage` (ADR 221 flat
shape) before the narrow could validate them — so genuine flat contracts
failed structural validation with "storage.<ns> must be removed". Switches
the base to `+: ignore` and lets the narrow validate every non-reserved
key as a namespace entry. Flattens the validators test fixtures to the
wrapper-less shape.

Signed-off-by: Will Madden <madden@prisma.io>
…izer tests

Unwraps the `namespaces` wrapper from the mongo family test fixtures and
routes the fake-storage builder through `buildMongoStorageInput`, and
restores the optional `storageHash` on the mongo storage schema.

Signed-off-by: Will Madden <madden@prisma.io>
…ath patterns

Drops the `namespaces` wrapper from the test fixtures, helpers, sort/
preserve-empty path patterns, and the structural assertion so they match
the flat ADR 221 storage shape.

Signed-off-by: Will Madden <madden@prisma.io>
wmadden added 19 commits May 31, 2026 00:18
…lat storage

Signed-off-by: Will Madden <madden@prisma.io>
D1 flattened the IR SqlStorage type and the runtime emit but left the
contract-builder output type BuiltStorage nesting namespace ids under a
`namespaces` wrapper, so every defineContract result was unassignable to
the flat Contract<SqlStorage>. Hoist namespace ids (and the named-
namespace mapped type) to direct keys under storage, mirroring the flat
IR shape. Type-only; no runtime behaviour change.

Signed-off-by: Will Madden <madden@prisma.io>
…s to flat shape

Signed-off-by: Will Madden <madden@prisma.io>
…value-objects fixtures to flat shape

Signed-off-by: Will Madden <madden@prisma.io>
…at shape

Signed-off-by: Will Madden <madden@prisma.io>
Signed-off-by: Will Madden <madden@prisma.io>
Signed-off-by: Will Madden <madden@prisma.io>
…at storage

Regenerate src contracts (audit, feature-flags, app) and per-space migration
refs (ops.json, migration.json, head.json) to the flat storage shape via the
documented emit + tsx incantation. The migration end-contract bookends are not
auto-regenerated (TML-2698) and remain on the prior shape; they are explicitly
excluded from the snapshot-read-shapes scan.

Signed-off-by: Will Madden <madden@prisma.io>
…ns to flat storage

Signed-off-by: Will Madden <madden@prisma.io>
…ath predicates to flat shape

Signed-off-by: Will Madden <madden@prisma.io>
extractContractNamespaceIds still reached through the dropped
storage.namespaces wrapper, so flat-storage contracts yielded zero
declared namespaces and introspect fell back to the single public
schema. Cross-namespace contracts then verified as missing every
non-public table. Read namespace ids via storageNamespaceEntries so
the multi-namespace introspection walk covers every declared schema.

Signed-off-by: Will Madden <madden@prisma.io>
Signed-off-by: Will Madden <madden@prisma.io>
…o flat storage

Re-express the contract-ts edge case for the flat shape: storage with
only storageHash now deserializes to an empty unbound namespace and is
accepted rather than rejected. Repair the dropped trailing comma the
codemod left in sql-storage fixtures and switch interpreter type
assertions to flat namespace-key access.

Signed-off-by: Will Madden <madden@prisma.io>
…orm-client storage reads to flat shape

Signed-off-by: Will Madden <madden@prisma.io>
…ter test reads to flat storage

Signed-off-by: Will Madden <madden@prisma.io>
…erals and assertions

The flat-storage codemod had not reached test/integration, so these
contract literals and toMatchObject assertions still wrapped namespace
entries under storage.namespaces. Promote namespace ids to direct
storage keys (ADR 221 flat shape).

Signed-off-by: Will Madden <madden@prisma.io>
…spaces-wrapper-drop

Signed-off-by: Will Madden <madden@prisma.io>

# Conflicts:
#	examples/mongo-blog-leaderboard/src/contract.d.ts
#	examples/mongo-blog-leaderboard/src/contract.json
#	examples/mongo-demo/src/contract.d.ts
#	examples/mongo-demo/src/contract.json
#	examples/retail-store/src/contract.d.ts
#	examples/retail-store/src/contract.json
#	packages/2-mongo-family/2-authoring/contract-psl/test/interpreter.test.ts
#	test/integration/test/authoring/side-by-side/mongo/contract.json
@wmadden-electric wmadden-electric requested a review from a team as a code owner May 31, 2026 07:03
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Important

Review skipped

Too many files!

This PR contains 292 files, which is 142 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 4dd28790-1a68-444f-8939-9d978a89d100

📥 Commits

Reviewing files that changed from the base of the PR and between d093844 and 037436e.

⛔ Files ignored due to path filters (8)
  • examples/bundle-size/src/mongo/generated/contract.d.ts is excluded by !**/generated/**
  • examples/bundle-size/src/mongo/generated/contract.json is excluded by !**/generated/**
  • 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/**
  • 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/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/**
📒 Files selected for processing (292)
  • apps/telemetry-backend/src/prisma/contract.d.ts
  • apps/telemetry-backend/src/prisma/contract.json
  • examples/cipherstash-integration/src/prisma/contract.d.ts
  • examples/cipherstash-integration/src/prisma/contract.json
  • examples/mongo-blog-leaderboard/src/contract.d.ts
  • examples/mongo-blog-leaderboard/src/contract.json
  • examples/mongo-demo/src/contract.d.ts
  • examples/mongo-demo/src/contract.json
  • examples/multi-extension-monorepo/app/src/contract.d.ts
  • examples/multi-extension-monorepo/app/src/contract.json
  • examples/multi-extension-monorepo/packages/audit/migrations/20260601T0000_create_audit_event/migration.json
  • examples/multi-extension-monorepo/packages/audit/migrations/20260601T0000_create_audit_event/migration.ts
  • examples/multi-extension-monorepo/packages/audit/migrations/refs/head.json
  • examples/multi-extension-monorepo/packages/audit/src/contract.d.ts
  • examples/multi-extension-monorepo/packages/audit/src/contract.json
  • examples/multi-extension-monorepo/packages/feature-flags/migrations/20260601T0000_create_feature_flag/migration.json
  • examples/multi-extension-monorepo/packages/feature-flags/migrations/20260601T0000_create_feature_flag/migration.ts
  • examples/multi-extension-monorepo/packages/feature-flags/migrations/refs/head.json
  • examples/multi-extension-monorepo/packages/feature-flags/src/contract.d.ts
  • examples/multi-extension-monorepo/packages/feature-flags/src/contract.json
  • examples/paradedb-demo/src/prisma/contract.d.ts
  • examples/paradedb-demo/src/prisma/contract.json
  • examples/prisma-next-cloudflare-worker/src/prisma/contract.d.ts
  • examples/prisma-next-cloudflare-worker/src/prisma/contract.json
  • examples/prisma-next-demo-sqlite/src/prisma/contract.d.ts
  • examples/prisma-next-demo-sqlite/src/prisma/contract.json
  • examples/prisma-next-demo/src/app/ContractView.tsx
  • examples/prisma-next-demo/src/prisma/contract.d.ts
  • examples/prisma-next-demo/src/prisma/contract.json
  • examples/prisma-next-demo/test/contract-authoring.test.ts
  • examples/prisma-next-demo/test/demo-dx.integration.test.ts
  • examples/prisma-next-demo/test/demo-dx.types.test.ts
  • examples/prisma-next-postgis-demo/src/prisma/contract.d.ts
  • examples/prisma-next-postgis-demo/src/prisma/contract.json
  • examples/react-router-demo/src/prisma/contract.d.ts
  • examples/react-router-demo/src/prisma/contract.json
  • examples/retail-store/src/contract.d.ts
  • examples/retail-store/src/contract.json
  • examples/retail-store/test/migration-chain.test.ts
  • examples/retail-store/test/migration.test.ts
  • packages/1-framework/0-foundation/contract/src/testing-factories.ts
  • packages/1-framework/0-foundation/contract/src/types.ts
  • packages/1-framework/0-foundation/contract/test/canonicalization-storage-sort.test.ts
  • packages/1-framework/0-foundation/contract/test/canonicalization.test.ts
  • packages/1-framework/0-foundation/contract/test/contract-factories.test.ts
  • packages/1-framework/0-foundation/contract/test/contract-types.test.ts
  • packages/1-framework/0-foundation/contract/test/hashing.test.ts
  • packages/1-framework/0-foundation/utils/src/assertions.ts
  • packages/1-framework/1-core/framework-components/src/exports/ir.ts
  • packages/1-framework/1-core/framework-components/src/ir/storage-plane-keys.ts
  • packages/1-framework/1-core/framework-components/src/ir/storage.ts
  • packages/1-framework/1-core/framework-components/test/element-coordinates.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/cross-consumer-integrity.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migrate-to-contract.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-invariants.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-list.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-plan-command.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-tamper.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/apply-aggregate.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/client.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/contract-enrichment.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/db-init.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/db-update.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/db-verify.per-member-verifier.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/progress.test.ts
  • packages/1-framework/3-tooling/cli/test/sql-storage-fixture.ts
  • packages/1-framework/3-tooling/cli/test/utils/contract-space-aggregate-loader.ac15.test.ts
  • packages/1-framework/3-tooling/cli/test/utils/contract-space-seed-phase.mongo.test.ts
  • packages/1-framework/3-tooling/emitter/test/canonicalization.test.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.roundtrip.test.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.test.ts
  • packages/1-framework/3-tooling/emitter/test/hashing.test.ts
  • packages/1-framework/3-tooling/migration/src/assert-descriptor-self-consistency.ts
  • packages/1-framework/3-tooling/migration/test/aggregate/loader.catastrophic-io.test.ts
  • packages/1-framework/3-tooling/migration/test/aggregate/loader.test.ts
  • packages/1-framework/3-tooling/migration/test/aggregate/project-schema-to-space.test.ts
  • packages/1-framework/3-tooling/migration/test/aggregate/strategies/synth.test.ts
  • packages/1-framework/3-tooling/migration/test/aggregate/verifier.test.ts
  • packages/1-framework/3-tooling/migration/test/assert-descriptor-self-consistency.test.ts
  • packages/1-framework/3-tooling/migration/test/deletable-node-modules.test.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/canonicalization-hooks.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/contract-schema.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/contract-types.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/exports/index.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-collection.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-storage.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/validate-storage.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/canonicalization-hooks.test.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/contract-types.test-d.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/element-coordinates.test.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/fixtures/orm-contract.d.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/fixtures/orm-contract.json
  • packages/2-mongo-family/1-foundation/mongo-contract/test/mongo-storage.test.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/validate-storage.test.ts
  • packages/2-mongo-family/2-authoring/contract-psl/src/interpreter.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/interpreter.polymorphism.test.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/interpreter.test.ts
  • packages/2-mongo-family/2-authoring/contract-ts/src/contract-builder.ts
  • packages/2-mongo-family/2-authoring/contract-ts/test/contract-builder.dsl.test.ts
  • packages/2-mongo-family/2-authoring/contract-ts/test/contract-builder.polymorphism.test.ts
  • packages/2-mongo-family/3-tooling/emitter/src/index.ts
  • packages/2-mongo-family/3-tooling/emitter/test/emitter-hook.e2e.test.ts
  • packages/2-mongo-family/3-tooling/emitter/test/emitter-hook.generation.test.ts
  • packages/2-mongo-family/3-tooling/emitter/test/emitter-hook.structure.test.ts
  • packages/2-mongo-family/3-tooling/emitter/test/fixtures/blog-contract.ts
  • packages/2-mongo-family/3-tooling/emitter/test/fixtures/create-mongo-contract.ts
  • packages/2-mongo-family/5-query-builders/orm/test/value-object-inputs.test-d.ts
  • packages/2-mongo-family/5-query-builders/query-builder/test/fixtures/test-contract.ts
  • packages/2-mongo-family/7-runtime/test/fixtures/decode-fixture-contract.ts
  • packages/2-mongo-family/9-family/src/core/contract-to-schema.ts
  • packages/2-mongo-family/9-family/src/core/control-target-descriptor.ts
  • packages/2-mongo-family/9-family/src/core/ir/mongo-contract-serializer-base.ts
  • packages/2-mongo-family/9-family/src/core/ir/mongo-schema-verifier-base.ts
  • packages/2-mongo-family/9-family/src/core/schema-diff.ts
  • packages/2-mongo-family/9-family/test/contract-to-schema.test.ts
  • packages/2-mongo-family/9-family/test/control-instance.descriptor-self-consistency.test.ts
  • packages/2-mongo-family/9-family/test/mongo-contract-serializer-base.test.ts
  • packages/2-mongo-family/9-family/test/mongo-schema-verifier-base.test.ts
  • packages/2-mongo-family/9-family/test/schema-verify.test.ts
  • packages/2-sql/1-core/contract/src/canonicalization-hooks.ts
  • packages/2-sql/1-core/contract/src/exports/types.ts
  • packages/2-sql/1-core/contract/src/index-type-validation.ts
  • packages/2-sql/1-core/contract/src/ir/sql-storage.ts
  • packages/2-sql/1-core/contract/src/types.ts
  • packages/2-sql/1-core/contract/src/validators.ts
  • packages/2-sql/1-core/contract/test/element-coordinates.test.ts
  • packages/2-sql/1-core/contract/test/sql-storage.test.ts
  • packages/2-sql/1-core/contract/test/validators.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.defaults.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.extensions.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.namespaces.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.types.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.value-objects.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/provider.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/psl-ts-namespace-parity.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/ts-psl-parity.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/unbound-tables.ts
  • packages/2-sql/2-authoring/contract-ts/src/build-contract.ts
  • packages/2-sql/2-authoring/contract-ts/src/contract-definition.ts
  • packages/2-sql/2-authoring/contract-ts/src/contract-types.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.namespaces.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract-builder.per-model-namespace.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract.edge-cases.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract.integration.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract.logic.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/fixtures/contract.d.ts
  • packages/2-sql/2-authoring/contract-ts/test/storage-with-namespaced-tables.ts
  • packages/2-sql/2-authoring/contract-ts/test/unbound-tables.ts
  • packages/2-sql/3-tooling/emitter/src/index.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.parameterized-types.test.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.structure.test.ts
  • packages/2-sql/3-tooling/emitter/test/sql-storage-fixture.ts
  • packages/2-sql/4-lanes/query-builder/src/selection.ts
  • packages/2-sql/4-lanes/relational-core/src/codec-ref-for-column.ts
  • packages/2-sql/4-lanes/relational-core/test/codec-descriptor-registry.test.ts
  • packages/2-sql/4-lanes/relational-core/test/fixtures/contract.d.ts
  • packages/2-sql/4-lanes/sql-builder/src/runtime/sql.ts
  • packages/2-sql/4-lanes/sql-builder/src/types/db.ts
  • packages/2-sql/4-lanes/sql-builder/test/runtime/field-proxy.test.ts
  • packages/2-sql/5-runtime/src/codecs/validation.ts
  • packages/2-sql/5-runtime/src/sql-context.ts
  • packages/2-sql/5-runtime/test/codec-integrity.test.ts
  • packages/2-sql/5-runtime/test/context.types.test-d.ts
  • packages/2-sql/5-runtime/test/contract-codec-registry.test.ts
  • packages/2-sql/5-runtime/test/intercept-decoding.test.ts
  • packages/2-sql/5-runtime/test/marker-verification.test.ts
  • packages/2-sql/5-runtime/test/marker-vs-intercept-ordering.test.ts
  • packages/2-sql/5-runtime/test/mutation-default-generators.test.ts
  • packages/2-sql/5-runtime/test/parameterized-types.test.ts
  • packages/2-sql/5-runtime/test/runtime-ctx-passthrough.test.ts
  • packages/2-sql/5-runtime/test/scope-plumbing.test.ts
  • packages/2-sql/5-runtime/test/sql-context.codec-context.test.ts
  • packages/2-sql/5-runtime/test/sql-context.test.ts
  • packages/2-sql/5-runtime/test/sql-family-adapter.test.ts
  • packages/2-sql/5-runtime/test/sql-runtime-abort.test.ts
  • packages/2-sql/5-runtime/test/sql-runtime.test.ts
  • packages/2-sql/5-runtime/test/utils.ts
  • packages/2-sql/9-family/src/core/control-instance.ts
  • packages/2-sql/9-family/src/core/ir/sql-contract-serializer-base.ts
  • packages/2-sql/9-family/src/core/migrations/contract-to-schema-ir.ts
  • packages/2-sql/9-family/src/core/migrations/field-event-planner.ts
  • packages/2-sql/9-family/src/core/schema-verify/verify-sql-schema.ts
  • packages/2-sql/9-family/test/contract-to-schema-ir.test.ts
  • packages/2-sql/9-family/test/control-instance.descriptor-self-consistency.test.ts
  • packages/2-sql/9-family/test/cross-reference-roundtrip.test.ts
  • packages/2-sql/9-family/test/field-event-planner.test.ts
  • packages/2-sql/9-family/test/schema-verify.helpers.ts
  • packages/3-extensions/cipherstash/migrations/20260601T0000_install_eql_bundle/end-contract.d.ts
  • packages/3-extensions/cipherstash/migrations/20260601T0000_install_eql_bundle/end-contract.json
  • packages/3-extensions/cipherstash/migrations/20260601T0000_install_eql_bundle/migration.json
  • packages/3-extensions/cipherstash/migrations/20260601T0000_install_eql_bundle/migration.ts
  • packages/3-extensions/cipherstash/migrations/refs/head.json
  • packages/3-extensions/cipherstash/src/contract.d.ts
  • packages/3-extensions/cipherstash/src/contract.json
  • packages/3-extensions/cipherstash/test/cipherstash-codec.test.ts
  • packages/3-extensions/cipherstash/test/descriptor.test.ts
  • packages/3-extensions/cipherstash/test/helpers.test.ts
  • packages/3-extensions/cipherstash/test/operator-lowering.helpers.ts
  • packages/3-extensions/cipherstash/test/psl-interpretation-numeric.test.ts
  • packages/3-extensions/cipherstash/test/psl-interpretation-other-types.test.ts
  • packages/3-extensions/cipherstash/test/psl-interpretation.test.ts
  • packages/3-extensions/paradedb/migrations/20260601T0000_install_pg_search_extension/end-contract.d.ts
  • packages/3-extensions/paradedb/migrations/20260601T0000_install_pg_search_extension/end-contract.json
  • packages/3-extensions/paradedb/migrations/20260601T0000_install_pg_search_extension/migration.json
  • packages/3-extensions/paradedb/migrations/20260601T0000_install_pg_search_extension/migration.ts
  • packages/3-extensions/paradedb/migrations/refs/head.json
  • packages/3-extensions/paradedb/src/contract.d.ts
  • packages/3-extensions/paradedb/src/contract.json
  • packages/3-extensions/pgvector/migrations/20260601T0000_install_vector_extension/end-contract.d.ts
  • packages/3-extensions/pgvector/migrations/20260601T0000_install_vector_extension/end-contract.json
  • packages/3-extensions/pgvector/migrations/20260601T0000_install_vector_extension/migration.json
  • packages/3-extensions/pgvector/migrations/20260601T0000_install_vector_extension/migration.ts
  • packages/3-extensions/pgvector/migrations/refs/head.json
  • packages/3-extensions/pgvector/src/contract.d.ts
  • packages/3-extensions/pgvector/src/contract.json
  • packages/3-extensions/pgvector/test/control-adapter-lower-parity.test.ts
  • packages/3-extensions/pgvector/test/descriptor.test.ts
  • packages/3-extensions/pgvector/test/migrations/planner.behavior.test.ts
  • packages/3-extensions/pgvector/test/migrations/planner.contract-to-schema-ir.test.ts
  • packages/3-extensions/pgvector/test/migrations/planner.storage-types.test.ts
  • packages/3-extensions/pgvector/test/operation-lowering.test.ts
  • packages/3-extensions/pgvector/test/rich-adapter.test.ts
  • packages/3-extensions/pgvector/test/sql-renderer.cast-policy.test.ts
  • packages/3-extensions/postgis/migrations/20260601T0000_install_postgis_extension/end-contract.d.ts
  • packages/3-extensions/postgis/migrations/20260601T0000_install_postgis_extension/end-contract.json
  • packages/3-extensions/postgis/migrations/20260601T0000_install_postgis_extension/migration.json
  • packages/3-extensions/postgis/migrations/20260601T0000_install_postgis_extension/migration.ts
  • packages/3-extensions/postgis/migrations/refs/head.json
  • packages/3-extensions/postgis/src/contract.d.ts
  • packages/3-extensions/postgis/src/contract.json
  • packages/3-extensions/postgres/test/psl-namespace-qualifier-routing.test.ts
  • packages/3-extensions/postgres/test/raw-sql-composition.test.ts
  • packages/3-extensions/sql-orm-client/src/collection-contract.ts
  • packages/3-extensions/sql-orm-client/src/model-accessor.ts
  • packages/3-extensions/sql-orm-client/src/query-plan-meta.ts
  • packages/3-extensions/sql-orm-client/src/query-plan-mutations.ts
  • packages/3-extensions/sql-orm-client/src/types.ts
  • packages/3-extensions/sql-orm-client/src/where-binding.ts
  • packages/3-extensions/sql-orm-client/test/collection-contract.test.ts
  • packages/3-extensions/sql-orm-client/test/create-input.test-d.ts
  • packages/3-extensions/sql-orm-client/test/generated-contract-types.test-d.ts
  • packages/3-extensions/sql-orm-client/test/helpers.ts
  • packages/3-extensions/sql-orm-client/test/mutation-executor.test.ts
  • packages/3-extensions/sql-orm-client/test/query-plan-select.test.ts
  • packages/3-extensions/sql-orm-client/test/unbound-tables.ts
  • packages/3-mongo-target/1-mongo-target/src/core/mongo-target-contract-serializer.ts
  • packages/3-mongo-target/1-mongo-target/src/core/mongo-target-contract.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-planner.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-runner-integration.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-runner.schema-verify.integration.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-runner.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-runner.validator-closed.integration.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-runner.validator-widen.integration.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-target-contract-serializer.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-target-schema-verifier.test.ts
  • packages/3-mongo-target/1-mongo-target/test/render-ops.test.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/enum-planning.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/issue-planner.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/planner-strategies.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/verify-postgres-namespaces.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-contract-serializer.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-schema.ts
  • packages/3-targets/3-targets/postgres/test/element-coordinates.test.ts
  • packages/3-targets/3-targets/postgres/test/fixtures/snapshot-read-shapes/codec-instance.json
  • packages/3-targets/3-targets/postgres/test/fixtures/snapshot-read-shapes/postgres-enum.json
  • packages/3-targets/3-targets/postgres/test/migrations/enum-collision.test.ts
  • packages/3-targets/3-targets/postgres/test/migrations/issue-planner.test.ts
  • packages/3-targets/3-targets/postgres/test/migrations/verify-postgres-namespaces.test.ts
  • packages/3-targets/3-targets/postgres/test/postgres-contract-serializer.test.ts
  • packages/3-targets/3-targets/postgres/test/postgres-schema.test.ts
  • packages/3-targets/3-targets/postgres/test/snapshot-read-shapes.test.ts
  • packages/3-targets/3-targets/sqlite/src/core/migrations/planner-strategies.ts
  • packages/3-targets/3-targets/sqlite/test/migrations/issue-planner.test.ts
  • packages/3-targets/3-targets/sqlite/test/migrations/nullability-backfill.test.ts
  • packages/3-targets/3-targets/sqlite/test/migrations/planner-strategies.test.ts
  • packages/3-targets/3-targets/sqlite/test/migrations/planner.authoring-surface.test.ts
  • packages/3-targets/3-targets/sqlite/test/sqlite-contract-serializer.test.ts
  • packages/3-targets/6-adapters/postgres/src/core/control-adapter.ts
  • packages/3-targets/6-adapters/postgres/src/core/sql-renderer.ts
  • packages/3-targets/6-adapters/postgres/test/adapter-joins.test.ts
  • packages/3-targets/6-adapters/postgres/test/adapter.test.ts
  • packages/3-targets/6-adapters/postgres/test/control-adapter-lower-parity.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/cross-namespace-fk.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/db-init-update.cli.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/fixtures/runner-fixtures.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.authoring-surface.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.codec-field-event.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.fk-config.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.reconciliation.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.reconciliation.test.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tml-2747-storage-namespaces-wrapper-drop

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 31, 2026

Open in StackBlitz

@prisma-next/extension-author-tools

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

@prisma-next/mongo-runtime

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

@prisma-next/family-mongo

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

@prisma-next/sql-runtime

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

@prisma-next/family-sql

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

@prisma-next/extension-arktype-json

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

@prisma-next/extension-cipherstash

npm i https://pkg.pr.new/@prisma-next/extension-cipherstash@649

@prisma-next/middleware-cache

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

@prisma-next/mongo

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

@prisma-next/extension-paradedb

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

@prisma-next/extension-pgvector

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

@prisma-next/extension-postgis

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

@prisma-next/postgres

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

@prisma-next/sql-orm-client

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

@prisma-next/sqlite

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

@prisma-next/target-mongo

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

@prisma-next/adapter-mongo

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

@prisma-next/driver-mongo

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

@prisma-next/contract

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

@prisma-next/utils

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

@prisma-next/config

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

@prisma-next/errors

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

@prisma-next/framework-components

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

@prisma-next/operations

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

@prisma-next/ts-render

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

@prisma-next/contract-authoring

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

@prisma-next/ids

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

@prisma-next/psl-parser

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

@prisma-next/psl-printer

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

@prisma-next/cli

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

@prisma-next/cli-telemetry

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

@prisma-next/emitter

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

@prisma-next/migration-tools

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

prisma-next

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

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

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

@prisma-next/mongo-codec

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

@prisma-next/mongo-contract

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

@prisma-next/mongo-value

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

@prisma-next/mongo-contract-psl

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

@prisma-next/mongo-contract-ts

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

@prisma-next/mongo-emitter

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

@prisma-next/mongo-schema-ir

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

@prisma-next/mongo-query-ast

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

@prisma-next/mongo-orm

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

@prisma-next/mongo-query-builder

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

@prisma-next/mongo-lowering

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

@prisma-next/mongo-wire

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

@prisma-next/sql-contract

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

@prisma-next/sql-errors

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

@prisma-next/sql-operations

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

@prisma-next/sql-schema-ir

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

@prisma-next/sql-contract-psl

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

@prisma-next/sql-contract-ts

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

@prisma-next/sql-contract-emitter

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

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

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

@prisma-next/sql-relational-core

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

@prisma-next/sql-builder

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

@prisma-next/target-postgres

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

@prisma-next/target-sqlite

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

@prisma-next/adapter-postgres

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

@prisma-next/adapter-sqlite

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

@prisma-next/driver-postgres

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

@prisma-next/driver-sqlite

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

commit: 037436e

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 31, 2026

size-limit report 📦

Path Size
postgres / no-emit 135.65 KB (+0.23% 🔺)
postgres / emit 125.34 KB (+0.15% 🔺)
mongo / no-emit 74.09 KB (+0.26% 🔺)
mongo / emit 68.99 KB (+0.15% 🔺)

wmadden added 2 commits May 31, 2026 09:13
…test

The flat-storage migration left getStorageNamespace / storageNamespaceEntries
/ storageNamespaceValues imported but unused (the only textual hit was inside
an error-message string), tripping biome noUnusedImports under
--error-on-warnings in CI.

Signed-off-by: Will Madden <madden@prisma.io>
…test

The preserve-empty predicate now matches the flat storage.<ns>.collections
path (no namespaces wrapper); the test still passed the old wrapped path, so
the empty-collections-slot case asserted false where the flat hook returns
true.

Signed-off-by: Will Madden <madden@prisma.io>
Comment on lines +5 to +9
/**
* Own-enumerable keys under a storage plane object that are not namespace
* entries. Walkers (`elementCoordinates`, validators, serializers) skip these.
*/
export const STORAGE_PLANE_RESERVED_KEYS = ['storageHash', 'types'] as const;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

types is SQL-specific, isn't it? It shouldn't have special handling here.


function isNamespaceEntry(value: unknown): value is Namespace {
return (
typeof value === 'object' && value !== null && 'id' in value && typeof value.id === 'string'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an unreliable condition. Anything with a string id? That's so context-specific the type predicate is pointless

Comment on lines +37 to +38
if (isStoragePlaneReservedKey(key)) continue;
if (isNamespaceEntry(value)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this logic is here only because types is a top-level member alongside namespaces. There should be no top-level members which aren't within a namespace, otherwise this strategy doesn't work

/**
* Spread a namespace map into flat storage input (namespace ids as direct keys).
*/
export function flatStorageInput<TNamespace>(params: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function looks like a code smell: is it just converting the new structure back into the old?

@wmadden-electric
Copy link
Copy Markdown
Contributor Author

Closing without merging — this slice took the IR in the wrong direction.

The goal was symmetric two-plane IR. main already has the storage plane in the right shape: { storageHash, types?, namespaces: { … } }, where storageHash/types are clean named siblings of the namespaces map. This PR flattened that to { storageHash, types?, …namespaceKeys }, which mixes a closed set of metadata fields into the open namespace key-space — the heterogeneous-map anti-pattern. That mix is what forced the STORAGE_PLANE_RESERVED_KEYS denylist, the isNamespaceEntry structural sniff, the reserved-key collision guard, and the flatStorageInput cast glue. None of that machinery exists under the wrapper.

Decision (with @wmadden): keep the namespaces wrapper on both planes ({ <planeHash>?, namespaces: { <ns> } }), and instead do the work the umbrella actually needs — wire the domain plane into that same symmetric shape (today its models/valueObjects are still flat at the contract root). ADR 221 will be amended: its commitment #2 ("the word namespaces never appears as an IR segment") and flat example were the actual error; the rationale weighed visual redundancy and missed the heterogeneous-map cost.

The one code change here that looked like a standalone fix (extractContractNamespaceIds reading flat namespace ids) is not — it only adapts to the flatten; the wrapper-reading code on main is already correct. Nothing to salvage.

wmadden added a commit that referenced this pull request May 31, 2026
## Linked issue

Refs [TML-2751](https://linear.app/prisma/issue/TML-2751)

## At a glance

**Before** — models lived at the contract root:

```json
{
  "target": "postgres",
  "models": {
    "User": {
      "fields": { "id": { "nullable": false, "type": { "kind": "scalar", "codecId": "pg/int4@1" } } },
      "storage": { "table": "user", "fields": { "id": { "column": "id" } } }
    }
  },
  "storage": { "namespaces": { "__unbound__": { "tables": { "user": { } } } } }
}
```

**After** — the application plane is symmetric with storage; models and
value objects sit under `domain.namespaces`:

```json
{
  "target": "postgres",
  "domain": {
    "namespaces": {
      "__unbound__": {
        "models": {
          "User": {
            "fields": { "id": { "nullable": false, "type": { "kind": "scalar", "codecId": "pg/int4@1" } } },
            "storage": { "table": "user", "fields": { "id": { "column": "id" } } }
          }
        },
        "valueObjects": { }
      }
    }
  },
  "storage": { "namespaces": { "__unbound__": { "tables": { "user": { } } } } }
}
```

`storage.namespaces` is unchanged in shape and responsibility. The
framework domain plane has **no** `domain.types` bucket (SQL storage
types stay on `storage` only).

## Why

ADR 221 calls for symmetric plane envelopes: both storage and domain
carry a `namespaces` segment so extension packs and multi-namespace
authoring compose the same way at each plane. Consumers stop reading
flat `contract.models` / `contract.valueObjects`; runtime and DSL code
use `contract.domain.namespaces` and helpers such as `contractModels()`
/ `ContractModelsMap`.

## What changed

- Contract IR, canonicalization, and validation emit and require
`domain.namespaces`.
- SQL and Mongo emitters, validators, and generated `contract.d.ts`
include the domain envelope.
- `contractModels`, `ContractModelsMap`, and `ContractValueObjectsMap`
are the supported access paths; legacy flat domain roots are normalized
at the boundary only.
- SQL `insert()` / update row typing resolves models via
`ContractModelsMap` (fixes `never` rows when only `domain` is
populated).
- Tests, examples, and tracked contract fixtures updated; `pnpm
fixtures:check` passes.

## Alternatives considered

[PR #649](#649) explored
**flattening storage** (lifting tables out of `storage.namespaces`).
That direction was abandoned in favour of this symmetric envelope: keep
`storage.namespaces` as-is, add `domain.namespaces` for models/value
objects, and avoid `STORAGE_PLANE_RESERVED_KEYS` or other storage
reshaping.

## Testing performed

- [x] `pnpm fixtures:check`
- [x] `test/integration` package `pnpm typecheck`
- [ ] Full `pnpm test:packages` — last run: type errors clean; a few
PGlite/MMS integration flakes in `@prisma-next/adapter-postgres` and
unrelated packages (re-run on CI)
- [ ] Full `pnpm test:integration` — not re-run end-to-end in this
session after typecheck green; pretest build includes postgis demo
(insert typing fixed via sql-builder)

## Checklist

- [x] No `domain.types` on framework contracts
- [x] No storage flatten / `STORAGE_PLANE_RESERVED_KEYS`
- [x] Upgrade instructions not recorded (fixture/hash-only and test
changes; no `examples/` or `packages/3-extensions/` source API changes
requiring consumer migrations)

---------

Signed-off-by: Will Madden <madden@prisma.io>
Co-authored-by: Will Madden <madden@prisma.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants