Skip to content
This repository was archived by the owner on Nov 25, 2026. It is now read-only.

TML-2887: namespace entries becomes an open, kind-keyed dictionary (ADR 224/225) - #812

Merged
wmadden-electric merged 64 commits into
mainfrom
tml-2887-open-entries-dictionary
Jun 12, 2026
Merged

wmadden-electric merged 64 commits into
mainfrom
tml-2887-open-entries-dictionary

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Decision: a storage namespace stores its entities in one open dictionary — keyed by entity kind, then by entity name — and that path is the only way the framework addresses, validates, and hydrates them. This PR makes the runtime types and the validation/hydration machinery match that model (ADR 224/225). Nothing persisted changes: the wire format was already this shape, byte for byte.

Here is a namespace exactly as it sits in a committed contract.json today (unchanged by this PR):

// storage.namespaces.public
{
  "id": "public",
  "entries": {
    "table":    { "user": { /* StorageTable */ }, "post": { /* … */ } },
    "type":     { "user_type": { "kind": "postgres-enum", "values": ["admin", "user"] } },
    "valueSet": { "Priority": { "kind": "valueSet", "values": ["low", "high"] } }
  }
}

Every entity has a coordinate — (plane, namespaceId, entityKind, entityName) — and one expression resolves any coordinate, for any entity kind, including kinds a target or extension pack contributes that the framework has never heard of:

entityAt(storage, { namespaceId, entityKind, entityName })
// ≡ storage.namespaces[namespaceId].entries[entityKind][entityName]

The problem

The persisted JSON was already open, but the runtime types were not. Each namespace class declared a closed object with one named field per kind it knew about:

// before — PostgresSchema
readonly entries: {
  readonly table: Readonly<Record<string, StorageTable>>;
  readonly type: Readonly<Record<string, PostgresEnumType>>;
  readonly valueSet?: Readonly<Record<string, StorageValueSet>>;
};

A closed type forces every consumer to know every kind. The validator hardcoded table?/type?/valueSet? schema fields; the postgres serializer hydrated the type map through a lookup keyed by the node tag 'postgres-enum'; generic code that received a coordinate had to switch on the kind to pick a property. Adding a new entity kind (the RLS branch needs policies and roles) meant editing framework and family code — or smuggling the kind past the closed types, which is what that branch currently does.

The change

The entity kind is the entries key — table, type, valueSet, collection — exactly the strings already persisted. Everything dispatches on that one string.

Open types that keep typed property access. entries is typed as the open dictionary intersected with its known kinds as optional keys:

// after — the SQL family shape (Postgres adds `type?`, Mongo has `collection?`)
readonly entries: Readonly<Record<string, Readonly<Record<string, unknown>>>> & {
  readonly table?: Readonly<Record<string, StorageTable>>;
  readonly valueSet?: Readonly<Record<string, StorageValueSet>>;
};

Unknown kinds remain valid (walkers iterate Object.entries as before), but ns.entries.table is ordinary typed property access — no helper layer, no per-call-site casts. Class instances additionally expose non-enumerable per-kind getters (schema.type, db.collection), so JSON.stringify emits only id + entries. Repo-wide there are exactly two read styles: generic walkers use entries[kind][name]; typed code uses property access or the getters. ~50 production and ~190 test call sites moved.

Construction is permissive-carry; the JSON boundary fails closed. This split is the heart of the open model, so be explicit about where each rule applies:

  • In-memory construction (builders/constructors) is permissive. A builder constructs the kinds it owns a factory for (table, collection, …) into IR instances and freezes-and-carries any other kind's map untouched. It does not enforce a closed kind list. This is required by the open model: a pack-contributed kind (an RLS policy, a Postgres role) must pass through buildSqlNamespace / buildMongoNamespace without the family layer knowing its name — if construction threw on unknown kinds, pack kinds would be un-authorable, which is the closed-list behavior this PR exists to remove. The carry tests that assert a synthetic unknown kind survives construction (frozen, present in JSON.stringify, yielded by elementCoordinates) are pinning this promise on purpose.
  • The JSON boundary (validation + hydration) fails closed. When a contract is deserialized, the kind→schema registry validates every kind and the hydration dispatch constructs every kind; an unregistered kind is rejected with an error naming the kind and the namespace id. This is where corruption and typos are caught — at the point a contract enters from disk, not at every in-memory construction. The accepted trade-off: a typo'd kind in hand-authored TypeScript surfaces at emit-time boundary validation rather than at the build* call.

Construction also accepts input literals only — the Instance | Input unions and their v instanceof X ? v : new X(v) normalization are gone (hydration constructs from validated JSON; authoring passes literals; the one caller that fed constructed instances was migrated).

Validation dispatches through one kind→schema registry. This is the fail-closed boundary above. Validation walks Object.entries(entries) and validates each inner map against the schema registered for that kind. The SQL core registers table and valueSet into the same registry the postgres pack registers type into — one tier, no privileged built-in fallback — and the postgres pack owns PostgresEnumTypeSchema outright, so the family layer contains zero target-kind knowledge. A kind nobody registered fails validation with an error naming the kind and namespace id. Hydration is also kind-dispatched and fail-closed (the hydrateEntriesKind hook, which a target overrides per kind), and namespace construction carries unknown kinds and builds the kinds it owns — but both of those still use per-kind code (a hydrateEntriesKind hook and an if (kind === …) construction switch) rather than the validation registry. Unifying construction and hydration onto one shared kind→factory registry is the explicit follow-up TML-2890; this PR delivers the registry on the validation path only.

One canonical lookup. entityAt(storage, coordinate) lives beside elementCoordinates in the framework; the hand-rolled two-step lookups (emitter FK validation and siblings) are gone.

Docs follow the code, and one ADR bug is fixed on the way: ADR 221 §115 stated the cross-plane reference invariant backwards. The correct direction — a domain entity may reference a storage entity, never the reverse, because the migration planner/runner must consume the storage plane in isolation — already misled one project design; the parenthetical now matches reality.

One breaking change for downstream code

The family-generic SqlContractSerializer no longer knows the postgres type kind (per ADR 225, the family carries no target knowledge), so it rejects postgres contracts with a clear error naming the kind. The fix is one line, and contract deserialization is now properly generic — no cast:

// before
const contract = new SqlContractSerializer(…).deserializeContract(json) as Contract;
// after
const contract = new PostgresContractSerializer(…).deserializeContract<Contract>(json);

SQLite and table-only contracts are unaffected. Upgrade instructions are recorded via the repo's upgrade-instructions process; the examples in this PR show the migration. The as Contract casts are swept from the demo, retail-store, and mongo-demo apps (three sites in multi-extension-monorepo are a recorded follow-up).

What deliberately does not change

  • Every persisted byte. storageHash is content-addressed over the entries subtree, so the persisted shape — keys, key order, presence semantics — is preserved exactly. pnpm fixtures:check passes with zero committed-artifact diffs (and earned its keep: it caught the one hash-drift regression introduced mid-review and forced the correct fix).
  • Node-body kind tags, including the two that don't match their entries key ('postgres-enum' under type, 'mongo-collection' under collection). They sit inside hash-covered node bodies, and nothing dispatches on them anymore — see Alternatives.
  • elementCoordinates — the framework's coordinate walker already read entries structurally; it is the consumer this refactor had to keep working unchanged, and it did.

Verification

All acceptance criteria carry committed tests: exact-shape serialization per concretion (getters absent from JSON), deep-freeze, unknown-kind rejection at construction/validation/hydration, round-trip unchanged, and a coordinate-resolution test asserting every elementCoordinates tuple resolves through entries[entityKind][entityName] for representative postgres, sqlite, and mongo contracts. Local gates: build, typecheck (138/138), lint (79/79), lint:deps, fixtures:check (clean tree, zero contract diffs); cast ratchet net negative vs merge-base. Integration suites run on this PR's CI.

Known follow-ups (tracked, deliberately not in this PR)

Review surfaced three refinements that are real but are each a distinct, higher-blast-radius change; bundling them into this already-large branch is what produced the one regression this PR hit, so they ship as focused PRs:

  • TML-2890 — Uniform kind dispatch in construction & hydration. One shared kind→factory registry replacing the per-kind if (kind === …) switches in the 8 construction/hydration files, so dispatch is uniform everywhere, not just in validation. (RLS adds its policy construction as a registration rather than a switch branch once this lands — it is not blocked on it.)
  • TML-2891 — Eliminate the SQL family placeholder concretion. Delete SqlBoundNamespace/buildSqlNamespace/SqlNamespaceTablesInput; SQL namespaces become always-target concretions; supabase emits postgres-schema. This is a wire-format change (committed contracts regenerate) and must land in isolation; the reverted item-G instanceof guard resolves here.
  • TML-2892 — Migration-author accessor. A Contract/Storage accessor for collections/tables by name, so migrations stop reaching through namespaces.__unbound__.entries.collection.

Out of scope (deliberate)

RLS (its branch rebases onto this and deletes its workarounds); the migration planner; ValueSetRef (settled in #805); the domain plane's flat models/valueObjects shape and the namespace-kind serializer strings (recorded follow-ups); the ADR 225/126 rewrite batch.

Alternatives considered

  • A helper-function layer instead of intersection typing. An earlier round of this PR shipped namespaceTables()/namespaceValueSets()/namespaceCollections() to give typed reads over a fully-widened entries. Rejected in review and deleted: the helpers were a parallel per-kind API duplicating the getters, and they existed only because the type had been over-widened — the intersection keeps the dictionary open while making plain property access type-safe.
  • Keep the Instance | Input construction unions. Also shipped early, also deleted: the instanceof-normalization they force is unreadable and hides which paths actually carry what. One shape per path needs no normalization.
  • Rename the legacy node tags to match their entries key ('postgres-enum' → 'type', 'mongo-collection' → 'collection') so the kind is literally one string everywhere. Rejected: the tags are persisted inside hash-covered node bodies, so the rename would churn every committed contract and storageHash — and the postgres-enum machinery is deleted by the enums cutover (TML-2853) regardless. New kinds (e.g. valueSet, post-TML-2882: transitional enum2 block makes the new enum PSL-authorable #805) use one string across coordinate, entries key, node tag, and registration from day one.
  • Rename the entries keys to match the node tags. Rejected: the keys are also persisted — strictly worse churn for the same goal.
  • Keep the closed types and teach each consumer the kind list. Rejected: that moves the kind→property mapping into every consumer and keeps pack-contributed kinds unreachable — the exact model ADR 224 rejects.
  • Translate between kind and key at the serializer boundary, or carry a mapping field on contributions (the entrySlotName approach the RLS branch had to invent). Rejected: both are the same translation table in disguise; ADR 224 explicitly rejects boundary reshaping, and the open dictionary makes the mapping unnecessary.

Linear: TML-2887

@wmadden-electric
wmadden-electric requested a review from a team as a code owner June 11, 2026 13:55
@coderabbitai

coderabbitai Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Storage namespace IRs now use open kind-indexed entries, with matching updates to builders, validators, serializers, and tests. Postgres contracts now deserialize through PostgresContractSerializer in affected call sites, and the framework gains entityAt for coordinate-based lookups.

Changes

Namespace entries and serializer transition

Layer / File(s) Summary
Docs and upgrade guidance
docs/architecture docs/..., skills/.../instructions.md
entries-based storage shapes and Postgres serializer migration guidance are documented, and the enum example literal is updated.
Framework entity lookup
packages/1-framework/1-core/framework-components/src/ir/storage.ts, .../test/*, .../exports/ir.ts
entityAt is added, elementCoordinates traversal is tightened, and direct tests cover coordinate resolution.
Mongo namespace entries and hydration
packages/2-mongo-family/..., packages/3-mongo-target/..., examples/mongo-demo/*, examples/retail-store/*, test/integration/test/mongo/*
Mongo namespace entries become kind-indexed, constructors/serializers handle optional collections and unknown kinds, and affected authoring/tests switch to typed deserialization and bracket-based access.
SQL namespace entries, validators, and serializers
packages/2-sql/1-core/..., packages/2-sql/2-authoring/..., packages/2-sql/3-tooling/..., packages/2-sql/5-runtime/..., packages/2-sql/9-family/...
SQL storage namespaces move to open entries, registry-based validation/hydration is added, runtime/emitter paths use optional table maps or entityAt, and tests are updated for the new access patterns.
Target serializers, Postgres schema entries, and target-aware tests
packages/3-targets/3-targets/postgres/..., packages/3-targets/3-targets/sqlite/..., packages/3-targets/6-adapters/postgres/..., packages/3-extensions/..., test/integration/test/*
Postgres and SQLite target schema/serializer classes adopt open entry kinds and typed getters, and downstream adapter, extension, and integration tests are updated to the new serializer and lookup behavior.

Sequence Diagram(s)

sequenceDiagram
  participant Authoring as Contract authoring
  participant Serializer as PostgresContractSerializer
  participant StorageIR as storage.namespaces[].entries
  participant Validator as schema validation
  participant Runtime as target/runtime call sites
  Authoring->>Serializer: deserializeContract(...)
  Serializer->>StorageIR: hydrate kind-indexed entries
  Serializer->>Validator: validate entries registry
  Validator->>StorageIR: resolve table/type/valueSet entries
  Runtime->>Serializer: deserializeContract(...) at call sites
Loading

Changes

Namespace entries and serializer transition

Layer / File(s) Summary
Docs and upgrade guidance
docs/architecture docs/..., skills/.../instructions.md
entries-based storage shapes and Postgres serializer migration guidance are documented, and the enum example literal is updated.
Framework entity lookup
packages/1-framework/1-core/framework-components/src/ir/storage.ts, .../test/*, .../exports/ir.ts
entityAt is added, elementCoordinates traversal is tightened, and direct tests cover coordinate resolution.
Mongo namespace entries and hydration
packages/2-mongo-family/..., packages/3-mongo-target/..., examples/mongo-demo/*, examples/retail-store/*, test/integration/test/mongo/*
Mongo namespace entries become kind-indexed, constructors/serializers handle optional collections and unknown kinds, and affected authoring/tests switch to typed deserialization and bracket-based access.
SQL namespace entries, validators, and serializers
packages/2-sql/1-core/..., packages/2-sql/2-authoring/..., packages/2-sql/3-tooling/..., packages/2-sql/5-runtime/..., packages/2-sql/9-family/...
SQL storage namespaces move to open entries, registry-based validation/hydration is added, runtime/emitter paths use optional table maps or entityAt, and tests are updated for the new access patterns.
Target serializers, Postgres schema entries, and target-aware tests
packages/3-targets/3-targets/postgres/..., packages/3-targets/3-targets/sqlite/..., packages/3-targets/6-adapters/postgres/..., packages/3-extensions/..., test/integration/test/*
Postgres and SQLite target schema/serializer classes adopt open entry kinds and typed getters, and downstream adapter, extension, and integration tests are updated to the new serializer and lookup behavior.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related issues

  • prisma/prisma-next#561 — The PR updates Mongo and SQLite authoring builders to construct/freeze namespace IR instances and adjusts the namespace handling described in that issue.

Possibly related PRs

  • prisma/prisma-next#629 — Both changesets center on elementCoordinates-based storage enumeration and related framework traversal changes.
  • prisma/prisma-next#630 — Both touch contract storage namespace construction and explicit unbound namespace wiring.
  • prisma/prisma-next#750 — Both update SQL storage schema/serializer handling around valueSet-style entries.

Suggested reviewers

  • wmadden

Poem

I hopped through namespaces bright and wide,
With entries open, nothing hid inside.
entityAt found each little trail,
And Postgres serializers set sail.
🐰✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tml-2887-open-entries-dictionary

@pkg-pr-new

pkg-pr-new Bot commented Jun 11, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@prisma-next/extension-author-tools

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

@prisma-next/mongo-runtime

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

@prisma-next/family-mongo

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

@prisma-next/sql-runtime

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

@prisma-next/family-sql

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

@prisma-next/extension-arktype-json

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

@prisma-next/middleware-cache

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

@prisma-next/mongo

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

@prisma-next/extension-paradedb

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

@prisma-next/extension-pgvector

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

@prisma-next/extension-postgis

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

@prisma-next/postgres

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

@prisma-next/sql-orm-client

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

@prisma-next/sqlite

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

@prisma-next/extension-supabase

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

@prisma-next/target-mongo

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

@prisma-next/adapter-mongo

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

@prisma-next/driver-mongo

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

@prisma-next/contract

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

@prisma-next/utils

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

@prisma-next/config

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

@prisma-next/errors

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

@prisma-next/framework-components

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

@prisma-next/operations

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

@prisma-next/ts-render

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

@prisma-next/contract-authoring

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

@prisma-next/ids

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

@prisma-next/psl-parser

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

@prisma-next/psl-printer

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

@prisma-next/cli

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

@prisma-next/cli-telemetry

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

@prisma-next/emitter

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

@prisma-next/migration-tools

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

prisma-next

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

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

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

@prisma-next/mongo-codec

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

@prisma-next/mongo-contract

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

@prisma-next/mongo-value

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

@prisma-next/mongo-contract-psl

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

@prisma-next/mongo-contract-ts

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

@prisma-next/mongo-emitter

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

@prisma-next/mongo-schema-ir

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

@prisma-next/mongo-query-ast

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

@prisma-next/mongo-orm

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

@prisma-next/mongo-query-builder

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

@prisma-next/mongo-lowering

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

@prisma-next/mongo-wire

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

@prisma-next/sql-contract

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

@prisma-next/sql-errors

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

@prisma-next/sql-operations

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

@prisma-next/sql-schema-ir

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

@prisma-next/sql-contract-psl

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

@prisma-next/sql-contract-ts

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

@prisma-next/sql-contract-emitter

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

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

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

@prisma-next/sql-relational-core

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

@prisma-next/sql-builder

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

@prisma-next/target-postgres

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

@prisma-next/target-sqlite

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

@prisma-next/adapter-postgres

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

@prisma-next/adapter-sqlite

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

@prisma-next/driver-postgres

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

@prisma-next/driver-sqlite

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

commit: 979caa6

@github-actions

github-actions Bot commented Jun 11, 2026 •

Copy link
Copy Markdown

size-limit report 📦

Path Size
postgres / no-emit 154.72 KB (+0.17% 🔺)
postgres / emit 121.96 KB (+0.24% 🔺)
mongo / no-emit 76.92 KB (+0.12% 🔺)
mongo / emit 71.01 KB (+0.08% 🔺)
cf-worker / no-emit 183.82 KB (+0.18% 🔺)
cf-worker / emit 147.7 KB (+0.18% 🔺)

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
packages/2-sql/5-runtime/src/codecs/validation.ts (1)

24-29: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Namespace collisions can hide missing codec mappings.

extractCodecIdsFromColumns keys rows by table.column only. If two namespaces share the same table+column names, one entry overwrites the other and missing codec detection can be skipped incorrectly.

💡 Suggested fix
-  for (const ns of Object.values(contract.storage.namespaces)) {
-    for (const [tableName, table] of Object.entries(namespaceTables(ns))) {
+  for (const [namespaceId, ns] of Object.entries(contract.storage.namespaces)) {
+    for (const [tableName, table] of Object.entries(namespaceTables(ns))) {
       for (const [columnName, column] of Object.entries(table.columns)) {
         const codecId = column.codecId;
-        const key = `${tableName}.${columnName}`;
+        const key = `${namespaceId}.${tableName}.${columnName}`;
         codecIds.set(key, codecId);
       }
     }
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/2-sql/5-runtime/src/codecs/validation.ts` around lines 24 - 29, The
current extractCodecIdsFromColumns implementation builds keys as
`${tableName}.${columnName}` which allows collisions across different
namespaces; update it to include the namespace identifier (e.g.,
`${namespaceName}.${tableName}.${columnName}` or similar) when creating the key
so each column is uniquely keyed per namespace, ensuring codecIds.set uses a
namespace-qualified key and prevents silent overwrites in functions that iterate
contract.storage.namespaces and namespaceTables.
packages/2-mongo-family/9-family/src/core/ir/mongo-contract-serializer-base.ts (1)

127-140: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve non-collection entry kinds during namespace hydration.

At Line 139, hydration rebuilds entries with only collection, which silently drops other entries[kind] maps when present. In an open-dictionary model this is a data-loss path across deserialization.

💡 Suggested fix
         return [
           nsId,
           {
             ...nsEnvelope,
             id: nsEnvelope.id,
-            entries: { collection: hydratedCollections },
+            entries: {
+              ...(nsEnvelope.entries as Record<string, unknown>),
+              collection: hydratedCollections,
+            },
           },
         ];
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/2-mongo-family/9-family/src/core/ir/mongo-contract-serializer-base.ts`
around lines 127 - 140, The hydration currently rebuilds nsEnvelope.entries with
only a collection key, discarding any other entry kinds; update the logic in
mongo-contract-serializer-base (the block using namespaceCollections,
rawCollections, hydratedCollections and returning { ...nsEnvelope, entries: {
collection: hydratedCollections } }) to merge the hydrated collection map into
the existing nsEnvelope.entries object instead of replacing it—e.g., compute
hydratedCollections as you do and then set entries = { ...nsEnvelope.entries,
collection: hydratedCollections } so non-collection entry kinds are preserved;
ensure you still convert raw items to MongoCollection (using
MongoCollectionInput) as before.
test/integration/test/cli.emit-cli-process.e2e.test.ts (1)

196-217: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Restore hard presence assertions before comparing table columns.

On Line 196, the optional access plus if (userTable && originalUserTable) allows this test to pass when either table is missing, so round-trip regressions can be missed.

Suggested fix
-      const tables = (validatedContract.storage as SqlStorage).namespaces['public']?.entries[
-        'table'
-      ] as Record<string, unknown> | undefined;
+      const tables = (validatedContract.storage as SqlStorage).namespaces['public']?.entries[
+        'table'
+      ] as Record<string, unknown> | undefined;
       const originalTables = (originalContract.storage as SqlStorage | undefined)?.namespaces[
         'public'
       ]?.entries['table'] as Record<string, unknown> | undefined;
+      expect(tables).toBeDefined();
+      expect(originalTables).toBeDefined();
       const userTable = tables?.['user'] as Record<string, unknown> | undefined;
       const originalUserTable = originalTables?.['user'] as Record<string, unknown> | undefined;
-      if (userTable && originalUserTable) {
-        const columns = userTable['columns'] as
-          | Record<string, { nativeType?: string; codecId?: string }>
-          | undefined;
-        const originalColumns = originalUserTable['columns'] as
-          | Record<string, { nativeType?: string; codecId?: string }>
-          | undefined;
-        if (columns && originalColumns) {
-          expect(columns['id']?.codecId).toBe(originalColumns['id']?.codecId);
-          expect(columns['email']?.codecId).toBe(originalColumns['email']?.codecId);
-          expect(columns['id']?.nativeType).toBe(originalColumns['id']?.nativeType);
-          expect(columns['email']?.nativeType).toBe(originalColumns['email']?.nativeType);
-        }
-      }
+      expect(userTable).toBeDefined();
+      expect(originalUserTable).toBeDefined();
+      const columns = userTable?.['columns'] as
+        | Record<string, { nativeType?: string; codecId?: string }>
+        | undefined;
+      const originalColumns = originalUserTable?.['columns'] as
+        | Record<string, { nativeType?: string; codecId?: string }>
+        | undefined;
+      expect(columns).toBeDefined();
+      expect(originalColumns).toBeDefined();
+      expect(columns?.['id']?.codecId).toBe(originalColumns?.['id']?.codecId);
+      expect(columns?.['email']?.codecId).toBe(originalColumns?.['email']?.codecId);
+      expect(columns?.['id']?.nativeType).toBe(originalColumns?.['id']?.nativeType);
+      expect(columns?.['email']?.nativeType).toBe(originalColumns?.['email']?.nativeType);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/integration/test/cli.emit-cli-process.e2e.test.ts` around lines 196 -
217, The test currently uses conditional guards that let it silently pass if the
tables or columns are missing; change that to hard assertions: replace the
if-checks around userTable and originalUserTable with explicit expects (e.g.,
expect(userTable).toBeDefined() and expect(originalUserTable).toBeDefined()) and
likewise assert columns and originalColumns exist
(expect(columns).toBeDefined(), expect(originalColumns).toBeDefined()) before
comparing codecId/nativeType values so the test fails if anything is absent;
keep the subsequent compares of columns['id'] and columns['email'] as-is.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/2-mongo-family/1-foundation/mongo-contract/src/ir/build-mongo-namespace.ts`:
- Around line 34-38: The fast-path that returns MongoUnboundNamespace.instance
when input.id === UNBOUND_NAMESPACE_ID and collectionCount === 0 skips
validating input.entries kinds; update the logic in build-mongo-namespace (the
function handling input.entries, collectionMap, UNBOUND_NAMESPACE_ID and
MongoUnboundNamespace.instance) to first validate that Object.keys(input.entries
|| {}) contains only allowed kinds (e.g., 'collection') and if any unknown kind
is present, do NOT take the unbound singleton fast-path — let the normal
constructor/validation path run (or throw) so unknown kinds are caught. Ensure
you reference input.entries, collectionMap, UNBOUND_NAMESPACE_ID and
MongoUnboundNamespace.instance when adding the check.

In `@packages/2-sql/1-core/contract/src/index-type-validation.ts`:
- Around line 13-14: The explicit cast "rawTable as StorageTable" is redundant
because namespaceTables(ns) already yields StorageTable values; remove the bare
cast by assigning const table = rawTable (or, if a cast is truly required for
type-system reasons, replace the bare cast with the sanctioned helper, e.g.
blindCast<StorageTable, "namespaceTables-return">(rawTable) or
castAs<StorageTable>(rawTable)); update the assignment in the loop that uses
namespaceTables, rawTable and table accordingly.

In `@packages/2-sql/1-core/contract/src/ir/build-sql-namespace.ts`:
- Around line 33-37: fromTablesInput currently takes the unbound fast-path when
input.id === UNBOUND_NAMESPACE_ID and only checks counts for 'table'/'valueSet',
which lets unknown entry kinds bypass validation; update the early-return logic
in fromTablesInput to detect any unknown keys in input.entries (i.e., keys other
than 'table' and 'valueSet') and avoid returning SqlUnboundNamespace.instance if
unknown kinds exist so that the normal constructor validation (the namespace
constructor that validates entry kinds and throws) runs; alternatively,
explicitly throw on unknown entry kinds in fromTablesInput after computing
allowedKinds to ensure invalid kinds are rejected rather than skipped.

In `@packages/2-sql/3-tooling/emitter/src/index.ts`:
- Around line 118-119: The code uses bare TypeScript "as" casts (e.g.,
"(namespaceTables(nsForTable)[tableName] as StorageTable | undefined)") which
violates the repo policy; replace these with the approved helpers by wrapping
the value with blindCast<T, "Reason"> or castAs<T> as appropriate (for nullable
cases use blindCast<StorageTable | undefined, "explain why cast is safe">(...)
or castAs<StorageTable | undefined>(...)). Search for similar bare casts in the
same file (the other occurrences that cast to StorageTable or related types) and
update each to use blindCast with a clear reason string or castAs to preserve
intent and traceability; keep the original runtime value and only change the
cast wrapper around namespaceTables(nsForTable)[tableName], the other cast
sites, and any comparable expressions.

In
`@packages/3-targets/3-targets/sqlite/src/core/migrations/planner-strategies.ts`:
- Around line 65-68: The code in tableAt uses a bare TypeScript cast
"(namespaceTables(ns)[tableName] as StorageTable | undefined)"; replace that
with the project's safe caster (blindCast or castAs) to satisfy the cast rule:
retrieve the value via namespaceTables(ns)[tableName] and wrap it with
blindCast(...) or castAs<StorageTable | undefined>(...) (depending on which
utility is used elsewhere) before returning, keeping the same conditional
structure around storage.namespaces[namespaceId] and preserving the StorageTable
| undefined signature.

In `@packages/3-targets/3-targets/sqlite/src/core/sqlite-unbound-database.ts`:
- Around line 137-140: The fast-path returns SqliteUnboundDatabase.instance
based solely on tableCount and therefore silently accepts inputs that contain
unknown kinds (e.g. entries['bogus']) when there are zero tables; change the
guard to ensure the fast-path only triggers when input.entries contains no keys
other than 'table' (or when entries has exactly 'table' key), i.e. inspect
Object.keys(input.entries) and verify all keys are either 'table' or none before
returning SqliteUnboundDatabase.instance (use the existing variables tableKind,
tableCount, input.entries, SqliteUnboundDatabase.instance and castAs to
implement the check).

---

Outside diff comments:
In
`@packages/2-mongo-family/9-family/src/core/ir/mongo-contract-serializer-base.ts`:
- Around line 127-140: The hydration currently rebuilds nsEnvelope.entries with
only a collection key, discarding any other entry kinds; update the logic in
mongo-contract-serializer-base (the block using namespaceCollections,
rawCollections, hydratedCollections and returning { ...nsEnvelope, entries: {
collection: hydratedCollections } }) to merge the hydrated collection map into
the existing nsEnvelope.entries object instead of replacing it—e.g., compute
hydratedCollections as you do and then set entries = { ...nsEnvelope.entries,
collection: hydratedCollections } so non-collection entry kinds are preserved;
ensure you still convert raw items to MongoCollection (using
MongoCollectionInput) as before.

In `@packages/2-sql/5-runtime/src/codecs/validation.ts`:
- Around line 24-29: The current extractCodecIdsFromColumns implementation
builds keys as `${tableName}.${columnName}` which allows collisions across
different namespaces; update it to include the namespace identifier (e.g.,
`${namespaceName}.${tableName}.${columnName}` or similar) when creating the key
so each column is uniquely keyed per namespace, ensuring codecIds.set uses a
namespace-qualified key and prevents silent overwrites in functions that iterate
contract.storage.namespaces and namespaceTables.

In `@test/integration/test/cli.emit-cli-process.e2e.test.ts`:
- Around line 196-217: The test currently uses conditional guards that let it
silently pass if the tables or columns are missing; change that to hard
assertions: replace the if-checks around userTable and originalUserTable with
explicit expects (e.g., expect(userTable).toBeDefined() and
expect(originalUserTable).toBeDefined()) and likewise assert columns and
originalColumns exist (expect(columns).toBeDefined(),
expect(originalColumns).toBeDefined()) before comparing codecId/nativeType
values so the test fails if anything is absent; keep the subsequent compares of
columns['id'] and columns['email'] as-is.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 411c5c57-eb4a-4eb1-9a63-1dbd7b3cdef5

📥 Commits

Reviewing files that changed from the base of the PR and between 622a001 and f1323c3.

📒 Files selected for processing (116)
  • docs/architecture docs/adrs/ADR 221 - Contract IR two planes with uniform entity coordinate and pack-contributed entity kinds.md
  • docs/architecture docs/subsystems/1. Data Contract.md
  • docs/architecture docs/subsystems/2. Contract Emitter & Types.md
  • docs/architecture docs/subsystems/5. Adapters & Targets.md
  • docs/reference/typescript-patterns.md
  • examples/prisma-next-demo/migrations/app/20260422T0748_migration/migration.ts
  • examples/prisma-next-demo/test/migration-integrity.test.ts
  • examples/retail-store/migrations/app/20260513T0505_initial/migration.ts
  • examples/retail-store/migrations/app/20260513T0508_backfill_product_status/migration.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/build-mongo-namespace.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-storage.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-unbound-namespace.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/validate-storage.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/element-coordinates.test.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/mongo-storage.test.ts
  • packages/2-mongo-family/2-authoring/contract-ts/test/contract-builder.control-policy.test.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/9-family/src/core/contract-to-schema.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-verify/verify-mongo-schema.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/build-sql-namespace.ts
  • packages/2-sql/1-core/contract/src/ir/sql-storage.ts
  • packages/2-sql/1-core/contract/src/ir/sql-unbound-namespace.ts
  • packages/2-sql/1-core/contract/src/resolve-storage-table.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/build-sql-namespace-map.test.ts
  • packages/2-sql/1-core/contract/test/namespace-entry-registry.test.ts
  • packages/2-sql/1-core/contract/test/sql-namespace-entries.test.ts
  • packages/2-sql/1-core/contract/test/storage-value-set.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.enum2.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.namespaces.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.polymorphism.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.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/test/check-constraint.authoring.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract-builder.cross-namespace-same-table.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.integration.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract.logic.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/cross-space-relation.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/enum-type.authoring.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/enum-type.codec-encoding.test.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.structure.test.ts
  • packages/2-sql/4-lanes/sql-builder/src/runtime/resolve-table.ts
  • packages/2-sql/4-lanes/sql-builder/src/types/db.ts
  • packages/2-sql/5-runtime/src/codecs/validation.ts
  • packages/2-sql/5-runtime/src/sql-context.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/namespace-hydration-registry.test.ts
  • packages/2-sql/9-family/test/value-set-roundtrip.test.ts
  • packages/3-extensions/pgvector/test/descriptor.test.ts
  • packages/3-extensions/postgres/test/psl-namespace-qualifier-routing.test.ts
  • packages/3-extensions/sql-orm-client/src/collection-contract.ts
  • packages/3-extensions/sql-orm-client/test/mutation-executor.test.ts
  • packages/3-extensions/sql-orm-client/test/unbound-tables.ts
  • packages/3-extensions/supabase/test/contract-handles.test.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-database.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-database-entries.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-target-database.test.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/control-policy.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/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/postgres-contract-serializer.test.ts
  • packages/3-targets/3-targets/postgres/test/postgres-schema.test.ts
  • packages/3-targets/3-targets/sqlite/src/core/migrations/planner-strategies.ts
  • packages/3-targets/3-targets/sqlite/src/core/sqlite-unbound-database.ts
  • packages/3-targets/3-targets/sqlite/test/element-coordinates.test.ts
  • packages/3-targets/3-targets/sqlite/test/sqlite-contract-serializer-hydration.test.ts
  • packages/3-targets/3-targets/sqlite/test/sqlite-contract-serializer.test.ts
  • packages/3-targets/3-targets/sqlite/test/sqlite-unbound-database.test.ts
  • packages/3-targets/6-adapters/postgres/src/core/sql-renderer.ts
  • packages/3-targets/6-adapters/postgres/test/adapter.test.ts
  • skills/extension-author/prisma-next-extension-upgrade/upgrades/0.13-to-0.14/instructions.md
  • skills/upgrade/prisma-next-upgrade/upgrades/0.13-to-0.14/instructions.md
  • test/integration/test/authoring/side-by-side-contracts.test.ts
  • test/integration/test/cli.emit-cli-process.e2e.test.ts
  • test/integration/test/contract-space-fixture-mongo/descriptor.test.ts
  • test/integration/test/contract-space-fixture/descriptor.test.ts
  • test/integration/test/cross-package/middleware-cache.test.ts
  • test/integration/test/family.schema-verify.basic.integration.test.ts
  • test/integration/test/family.schema-verify.dependencies.integration.test.ts
  • test/integration/test/family.schema-verify.helpers.ts
  • test/integration/test/family.schema-verify.mismatches.integration.test.ts
  • test/integration/test/family.schema-verify.types.test.ts
  • test/integration/test/family.sign-database.test.ts
  • test/integration/test/family.verify-database.basic.test.ts
  • test/integration/test/family.verify-database.errors.test.ts
  • test/integration/test/mongo/migration-psl-authoring.test.ts
  • test/integration/test/namespaced-accessors-e2e.integration.test.ts
  • test/integration/test/referential-actions.integration.test.ts
  • test/integration/test/rewriting-middleware.integration.test.ts
  • test/integration/test/runtime.verify-marker.missing-table.integration.test.ts
  • test/integration/test/sql-builder/raw-sql.integration.test.ts
  • test/integration/test/utils/cli-test-helpers.ts

@wmadden-electric wmadden-electric changed the title TML-2887: open the namespace entries dictionary (ADR 224/225) TML-2887: namespace entries becomes an open, kind-keyed dictionary (ADR 224/225) Jun 11, 2026

@wmadden wmadden left a comment

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.

What is this namespaceCollections(namespace) that's now everywhere?

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/3-targets/3-targets/postgres/src/core/postgres-contract-serializer.ts (1)

86-106: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Type safety concern when enum factory is undefined.

Lines 99-100 cast the result to PostgresEnumType, but when this.enumFactory is undefined, the fallback returns the raw entry (a plain validated object, not a class instance). The cast reason "postgres-enum factory returns PostgresEnumType" is only valid when the factory is called.

If the factory is ever missing (e.g., misconfiguration), the code will silently pass through plain objects typed as PostgresEnumType, leading to runtime failures when class methods are called.

🔒 Safer alternative: require the factory
     if (key === 'type') {
       if (innerMap === null || typeof innerMap !== 'object' || Array.isArray(innerMap)) {
         return {};
       }
+      if (this.enumFactory === undefined) {
+        throw new Error(
+          `Enum hydration factory not registered; cannot hydrate entries.type`,
+        );
+      }
       return Object.fromEntries(
         Object.entries(
           blindCast<Record<string, unknown>, 'checked object, non-null, non-array above'>(innerMap),
         ).map(([name, entry]) => [
           name,
-          blindCast<PostgresEnumType, 'postgres-enum factory returns PostgresEnumType'>(
-            this.enumFactory !== undefined ? this.enumFactory(entry) : entry,
-          ),
+          blindCast<PostgresEnumType, 'postgres-enum factory returns PostgresEnumType'>(
+            this.enumFactory(entry),
+          ),
         ]),
       );
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/3-targets/3-targets/postgres/src/core/postgres-contract-serializer.ts`
around lines 86 - 106, The code in hydrateEntriesKind incorrectly blind-casts
raw validated objects to PostgresEnumType when this.enumFactory is undefined;
update hydrateEntriesKind to explicitly require the enumFactory and fail fast
instead of silently casting: check this.enumFactory before mapping entries and
if it's undefined throw a clear Error (mentioning enumFactory and the key
'type') or otherwise call this.enumFactory(entry) for every entry so only actual
PostgresEnumType instances are returned; adjust any blindCast reasoning
accordingly to only be used when the factory is invoked.
packages/3-targets/3-targets/postgres/src/core/migrations/planner-strategies.ts (1)

715-782: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Namespace-blind check keys can mis-handle issues across schemas.

Line 726, Line 761, and Line 780 build keys as ${tableName}\0${constraintName}. In the new open namespace model, two namespaces can share table/check names, so these keys collide and one namespace’s check issue can be consumed by another.

Suggested fix
-        const issueKey = `${tableName}�${contractCheck.name}`;
+        const issueKey = `${namespaceId}�${tableName}�${contractCheck.name}`;
@@
-          const issueKey = `${tableName}�${liveCheck.name}`;
+          const issueKey = `${namespaceId}�${tableName}�${liveCheck.name}`;
@@
-    const key = `${issue.table}�${issue.indexOrConstraint}`;
+    const key = `${resolveNamespaceIdForIssue(issue)}�${issue.table}�${issue.indexOrConstraint}`;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/3-targets/3-targets/postgres/src/core/migrations/planner-strategies.ts`
around lines 715 - 782, Issue: keys for handledIssueKeys are built as
`${tableName}\0${constraintName}` which ignores namespace and can collide across
namespaces; fix by including the namespace identifier (use namespaceId or
ddlSchema) when constructing issueKey and when computing the key for filtering
remaining issues so keys become unique per namespace. Update every occurrence
that creates the key (the issueKey assignments inside the contractChecks loop
and the liveChecks loop and the key computed in the remaining filter) to
incorporate namespaceId or ddlSchema (e.g.,
`${namespaceId}\0${tableName}\0${constraintName}`) and adjust any comparisons to
use the new composite key.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/1-framework/1-core/framework-components/src/ir/storage.ts`:
- Around line 67-69: The entityAt function uses bare TypeScript casts on lines
creating kindMap and returning the entity value; replace those bare `as` casts
with the repo's approved helpers—use blindCast<T, "Reason"> when asserting the
broader Record shape for `kindMap` (or a narrow type guard) and use castAs<T>
(or blindCast with a clear reason) when returning the entity value from
`kindMap`; update references in entityAt to call blindCast/castAs on
`entries`->`kindMap` and on the final lookup for `coord.entityName` so
lint/policy checks pass.

In
`@packages/3-mongo-target/1-mongo-target/src/core/mongo-target-contract-serializer.ts`:
- Around line 28-30: The serializer is using a bare cast for collection
(nsData.entries['collection'] as Readonly<Record<string,
MongoCollectionInput>>), which violates the no-bare-`as` policy; replace that
cast by wrapping the value with the approved helper (either
blindCast<Readonly<Record<string, MongoCollectionInput>>, "Describe reason
here">(...) or castAs<Readonly<Record<string, MongoCollectionInput>>>(...)) so
the explicit-cast trail is preserved; update the expression that assigns to
collection in the mongo-target-contract-serializer (the
nsData.entries['collection'] usage) to use one of those helpers and include a
short rationale string if using blindCast.

---

Outside diff comments:
In
`@packages/3-targets/3-targets/postgres/src/core/migrations/planner-strategies.ts`:
- Around line 715-782: Issue: keys for handledIssueKeys are built as
`${tableName}\0${constraintName}` which ignores namespace and can collide across
namespaces; fix by including the namespace identifier (use namespaceId or
ddlSchema) when constructing issueKey and when computing the key for filtering
remaining issues so keys become unique per namespace. Update every occurrence
that creates the key (the issueKey assignments inside the contractChecks loop
and the liveChecks loop and the key computed in the remaining filter) to
incorporate namespaceId or ddlSchema (e.g.,
`${namespaceId}\0${tableName}\0${constraintName}`) and adjust any comparisons to
use the new composite key.

In
`@packages/3-targets/3-targets/postgres/src/core/postgres-contract-serializer.ts`:
- Around line 86-106: The code in hydrateEntriesKind incorrectly blind-casts raw
validated objects to PostgresEnumType when this.enumFactory is undefined; update
hydrateEntriesKind to explicitly require the enumFactory and fail fast instead
of silently casting: check this.enumFactory before mapping entries and if it's
undefined throw a clear Error (mentioning enumFactory and the key 'type') or
otherwise call this.enumFactory(entry) for every entry so only actual
PostgresEnumType instances are returned; adjust any blindCast reasoning
accordingly to only be used when the factory is invoked.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 9db427a8-47f3-42d2-923b-7f9cba692dd2

📥 Commits

Reviewing files that changed from the base of the PR and between f1323c3 and 57c65da.

📒 Files selected for processing (85)
  • examples/prisma-next-demo/migrations/app/20260422T0748_migration/migration.ts
  • examples/retail-store/migrations/app/20260513T0505_initial/migration.ts
  • examples/retail-store/migrations/app/20260513T0508_backfill_product_status/migration.ts
  • packages/1-framework/1-core/framework-components/src/exports/ir.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/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/build-mongo-namespace.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-storage.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-unbound-namespace.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/validate-storage.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/mongo-storage.test.ts
  • packages/2-mongo-family/2-authoring/contract-ts/test/contract-builder.control-policy.test.ts
  • packages/2-mongo-family/3-tooling/emitter/src/index.ts
  • packages/2-mongo-family/9-family/src/core/contract-to-schema.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-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/build-sql-namespace.ts
  • packages/2-sql/1-core/contract/src/ir/sql-storage.ts
  • packages/2-sql/1-core/contract/src/ir/sql-unbound-namespace.ts
  • packages/2-sql/1-core/contract/src/resolve-storage-table.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/build-sql-namespace-map.test.ts
  • packages/2-sql/1-core/contract/test/control-field.test.ts
  • packages/2-sql/1-core/contract/test/namespace-entry-registry.test.ts
  • packages/2-sql/1-core/contract/test/sql-namespace-entries.test.ts
  • packages/2-sql/1-core/contract/test/storage-value-set.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.enum2.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.namespaces.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.polymorphism.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.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/test/check-constraint.authoring.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract-builder.cross-namespace-same-table.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/enum-type.authoring.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/enum-type.codec-encoding.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/unbound-tables.ts
  • packages/2-sql/3-tooling/emitter/src/index.ts
  • packages/2-sql/4-lanes/sql-builder/src/runtime/resolve-table.ts
  • packages/2-sql/4-lanes/sql-builder/src/types/db.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-mapping-validation.test.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/schema-verify/verify-sql-schema.ts
  • packages/2-sql/9-family/test/namespace-hydration-registry.test.ts
  • packages/2-sql/9-family/test/value-set-roundtrip.test.ts
  • packages/3-extensions/postgres/test/psl-namespace-qualifier-routing.test.ts
  • packages/3-extensions/sql-orm-client/src/collection-contract.ts
  • packages/3-extensions/sql-orm-client/test/mutation-executor.test.ts
  • packages/3-extensions/sql-orm-client/test/unbound-tables.ts
  • packages/3-extensions/supabase/test/contract-handles.test.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-database.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-target-contract-serializer.test.ts
  • packages/3-targets/3-targets/postgres/src/core/authoring.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/planner-strategies.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-contract-serializer.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-enum-type-schema.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-schema.ts
  • packages/3-targets/3-targets/postgres/src/exports/types.ts
  • packages/3-targets/3-targets/postgres/test/control-field.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/sqlite/src/core/migrations/planner-strategies.ts
  • packages/3-targets/3-targets/sqlite/src/core/sqlite-unbound-database.ts
  • packages/3-targets/3-targets/sqlite/test/sqlite-contract-serializer.test.ts
  • packages/3-targets/3-targets/sqlite/test/sqlite-unbound-database.test.ts
  • packages/3-targets/6-adapters/postgres/src/core/sql-renderer.ts
  • packages/3-targets/6-adapters/postgres/test/adapter.test.ts
  • test/integration/test/cli.emit-cli-process.e2e.test.ts
  • test/integration/test/contract-space-fixture-mongo/descriptor.test.ts
  • test/integration/test/contract-space-fixture/descriptor.test.ts
  • test/integration/test/mongo/migration-psl-authoring.test.ts
  • test/integration/test/namespaced-accessors-e2e.integration.test.ts
💤 Files with no reviewable changes (1)
  • packages/2-sql/4-lanes/sql-builder/src/types/db.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/2-sql/2-authoring/contract-ts/test/enum-type.codec-encoding.test.ts
  • test/integration/test/contract-space-fixture-mongo/descriptor.test.ts
🚧 Files skipped from review as they are similar to previous changes (16)
  • packages/2-mongo-family/1-foundation/mongo-contract/src/validate-storage.ts
  • packages/2-mongo-family/9-family/src/core/contract-to-schema.ts
  • test/integration/test/mongo/migration-psl-authoring.test.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-schema.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-unbound-namespace.ts
  • packages/2-sql/1-core/contract/test/namespace-entry-registry.test.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/contract-types.ts
  • packages/3-targets/3-targets/postgres/test/postgres-schema.test.ts
  • packages/2-sql/1-core/contract/src/ir/sql-unbound-namespace.ts
  • packages/2-sql/1-core/contract/src/ir/build-sql-namespace.ts
  • packages/3-targets/3-targets/sqlite/src/core/sqlite-unbound-database.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/build-mongo-namespace.ts
  • packages/3-mongo-target/1-mongo-target/src/core/mongo-target-database.ts
  • packages/2-sql/1-core/contract/test/sql-namespace-entries.test.ts
  • packages/2-sql/9-family/test/namespace-hydration-registry.test.ts
  • packages/2-sql/9-family/src/core/ir/sql-contract-serializer-base.ts

@wmadden-electric
wmadden-electric requested a review from wmadden June 11, 2026 18:58
wmadden and others added 16 commits June 11, 2026 21:43
…QLite namespace concretions

Core types, class constructors, non-enumerable prototype getters, and
family helpers (namespaceTables/namespaceValueSets) are in place.
Partial call-site migration: sql-contract, emitter, and a subset of
authoring tests migrated. Remaining call sites in sql-family, sql-builder,
sql-runtime, and remaining authoring tests follow in the next commit.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…lueSet to helpers/getters

Replace every `.entries.table`, `.entries.type`, and `.entries.valueSet` dot-
access on IR instances with `namespaceTables(ns)` / `namespaceValueSets(ns)`
(for structural `SqlNamespace`) or the typed class getters `ns.table` /
`ns.type` / `ns.valueSet` (for `PostgresSchema`/`SqliteDatabase` concrete
instances). Production code and test code across SQL-family, postgres,
sqlite, and extension packages.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…open-dict entries

The earlier refactor narrowed the parameter to SqlStorage, breaking a test
helper that passes a minimal structural type. Restore the generic StorageLike
type with `namespaces: Record<string, unknown>` and cast each namespace entry
to SqlNamespace inside the function body.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The closed `{ entries: { table } }` shape in db.ts broke whole-workspace
typecheck after D1 widened SqlNamespace['entries'] to the open dict.
Introduce a local `NamespaceEntries` alias and a `TablesInNamespace<NS>`
helper that conditions on whether `entries['table']` is a table map,
falling back to the empty-but-typed record when absent.  All derived
helpers (TableNamesAcrossNamespaces, TableInAnyNamespace, Namespace) now
go through that helper instead of the hard-coded `entries.table` path.

Also migrate pgvector/test/descriptor.test.ts:51 from the closed shape
cast to the open-dict cast so extension-pgvector typechecks clean.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… sqlite (ADR 224)

D1 introduced bare `as` casts in postgres-schema.ts and sqlite-unbound-database.ts.
Replace each with `blindCast<T, 'reason'>` to satisfy the no-bare-casts policy and
the CI cast ratchet (finding 2 from D1 round 1 review).

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…oncretions (ADR 224)

Adds one negative test per concretion — buildSqlNamespace, PostgresSchema, SqliteDatabase —
asserting that passing an unrecognised entries key throws an error matching /unknown entity kind/.
Finding 3 from D1 round 1 review.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…elpers (ADR 224)

The open-dict widening in D1 caused TS4111 errors in three integration-test files that
accessed .entries.table directly via dot notation. Migrate to namespaceTables() and
bracket notation to satisfy the noPropertyAccessFromIndexSignature rule.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ons helper

MongoTargetDatabase/MongoTargetUnboundDatabase and the mongo-family
foundation (build-mongo-namespace, mongo-storage, mongo-unbound-namespace)
now store entries as the open Readonly<Record<string, Readonly<Record<string,
unknown>>>> dictionary per ADR 224.

- Construction dispatch by entries key: 'collection' → MongoCollection;
  unknown key throws naming the kind
- Freeze discipline: inner map → outer entries → node (freezeNode)
- Non-enumerable prototype getter get collection() on MongoTargetDatabase
  and MongoBoundNamespace; derives from entries via blindCast
- MongoTargetDatabase.kind becomes non-enumerable (defineProperty) — wire
  stable: serializer writes 'mongo-database' explicitly
- Family helper namespaceCollections(ns) exported from @prisma-next/mongo-contract
  for generic/structural call sites, mirroring namespaceTables
- MongoStorageShape.entries widened to open dict; MongoUnboundNamespace
  updated to open shape
- validate-storage.ts, mongo-target-contract-serializer.ts migrated
- Tests: exact-shape, deep-freeze, getter derivation, dispatch-by-key,
  unknown-kind toThrow naming the kind (mongo-target-database-entries.test.ts)

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
All production and test call sites reading entries.collection now use
the two canonical read styles from the spec:

- Typed family/target code uses the class getter (db.collection[...])
  or namespaceCollections() helper for generic MongoNamespace-typed reads
- Generic walker code uses entries['collection'] bracket notation

Files migrated: mongo-emitter, family-mongo (contract-to-schema,
serializer-base, schema-verifier-base, verify-mongo-schema), contract-ts
authoring tests, retail-store migrations, and integration test fixtures.

MongoStorageShape.entries widened to open dict; MongoCollection import
removed from contract-types (no longer needed there).

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…aceCollections helper (ADR 224)

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…pen-dict migrated call sites

- Remove stale `biome-ignore lint/performance/noDelete` comment from emitter-hook test; the
  `entries['table']!` access no longer triggers noDelete
- Fix `noNonNullAssertion` in verify-sql-schema.ts and validators.ts: hoist namespace
  lookup into a local variable rather than using `!` inline

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ilders (ADR 224)

Four bare `as` casts in the namespace construction loops that the D1/D2
reviewers flagged but deferred as carryover — the SQL and Mongo family
builders each had a `rawMap as Record<...>` pattern that D1 r2's
postgres/sqlite cleanup missed. Replaced with `blindCast<T, 'reason'>` to
match the pattern already present in postgres-schema.ts.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ers (ADR 224)

The enum2 test added by PR #805 used closed-shape `.entries.table?.` and
`.entries.valueSet?.` dot access, which fails TS4111 after D1 widened
`SqlNamespace.entries` to an index-signature record. Migrate to
`namespaceTables()` / `namespaceValueSets()` helpers, matching the
canonical style established in D1.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Replace `namespaceSlotEntrySchema` + hardcoded `table?`/`type?`/`valueSet?`
entries fields with a registry-driven approach:

**validators.ts**
- `BUILTIN_ENTRY_SCHEMAS` maps entries key → per-value arktype schema
  (`'table'` → `StorageTableSchema`, `'valueSet'` → `StorageValueSetSchema`).
- `createNamespaceEntrySchema` iterates `Object.entries(entries)`, looks up
  the registered schema per key, then validates each inner-map value
  individually. An unregistered key fails validation naming the kind.
- Remove `namespaceSlotEntrySchema` and the discriminator-keyed fragments
  approach entirely.

**sql-contract-serializer-base.ts**
- `hydrateEntriesKind(key, innerMap)` dispatches by entries key instead of
  iterating hard-coded slots. Returns `undefined` for unknown keys to
  fail closed; subclasses override to handle additional keys.
- Always injects an empty `table` key into the output if absent.

**postgres-contract-serializer.ts**
- `POSTGRES_VALIDATOR_REGISTRY` registers `'type'` → `PostgresEnumTypeSchema`
  (per-value schema, not inner-map wrapper).
- Override `hydrateEntriesKind` handles `'type'` → enum factory dispatch;
  delegates to super for `'table'`/`'valueSet'`.
- Remove the old slot-specific `rawEntries['type']` extraction from
  `hydrateSqlNamespaceEntry`.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…rity test

SqlContractSerializer (family-sql/ir) has an empty registry and cannot
hydrate Postgres-specific kinds (enums) registered by D3. Replace it
with PostgresContractSerializer, matching the pattern used in all other
demo test files.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…izer in integration tests

PostgresSchema (used by @prisma-next/postgres/contract-builder and
PostgresContractSerializer.hydrateSqlNamespaceEntry) always injects an
empty `"type": {}` entry into namespace entries. D3's registry-driven
validation now rejects unknown entries keys; the base SqlContractSerializer
has an empty registry and rejects "type". Any test that passes a
Postgres in-memory contract or an emitted-by-Postgres JSON contract to
SqlContractSerializer now fails.

Fix: replace SqlContractSerializer with PostgresContractSerializer in
the 16 integration test files that use Postgres contracts (in-memory
builder or emitted-by-Postgres JSON). Consistent with the pattern
already used in examples/prisma-next-demo and other demo test files.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Will Madden <[email protected]>

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 10

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/3-targets/3-targets/postgres/src/core/migrations/planner-strategies.ts (1)

733-799: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Preserve namespaceId throughout check-constraint planning.

This strategy is still matching live checks and handled issues by bare tableName, even though the surrounding planner moved to explicit namespace coordinates. In a contract with auth.users and public.users, ctx.schema.tables[tableName] and the ${tableName}\0${constraint} key can compare the contract checks for one namespace against the live checks for the other, then consume the wrong issue. Please qualify both the schema lookup and the handled-issue key with the resolved namespace/DDL schema before emitting add/drop calls.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/3-targets/3-targets/postgres/src/core/migrations/planner-strategies.ts`
around lines 733 - 799, The code currently matches and consumes check issues
using bare tableName which mixes namespaces; update all lookups and
handledIssueKeys keys to include the resolved namespace/DDL schema so checks are
qualified by namespace. Specifically: when computing schemaTable use
resolveDdlSchemaForNamespace(ctx, namespaceId) (you already have ddlSchema) to
index ctx.schema.tables by namespace-qualified name (or include ddlSchema in the
lookup), and change every issueKey construction (`${tableName}�${...}`) to
include ddlSchema (e.g. `${ddlSchema}�${tableName}�${constraintName}`) before
pushing AddCheckConstraintCall/DropCheckConstraintCall and before adding to
handledIssueKeys; also update the final issues.filter key computation to build
the same ddlSchema-qualified key so only issues in the same namespace are
consumed. Ensure collectContractChecks, AddCheckConstraintCall and
DropCheckConstraintCall invocations still receive ddlSchema as they do now.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/1-framework/1-core/framework-components/src/ir/storage.ts`:
- Around line 73-76: The lookup currently returns inherited prototype properties
because it returns kindMap[coord.entityName] directly; change the lookup in the
function that uses entries and kindMap (the block using coord and blindCast) to
first verify the property is an own property (e.g.
Object.prototype.hasOwnProperty.call(kindMap, coord.entityName)) and if not,
return undefined; only then perform the blindCast of kindMap[coord.entityName]
so missing names (like "toString") do not surface inherited members.

In `@packages/2-mongo-family/1-foundation/mongo-contract/src/exports/index.ts`:
- Line 35: The package public API removed the buildMongoNamespaceMap export from
src/exports/index.ts causing a breaking change; restore the re-export by adding
buildMongoNamespaceMap back to the exports surface (alongside
buildMongoNamespace) and ensure it points to its implementation (e.g., the
module that previously defined buildMongoNamespaceMap), or if removal is
intentional, explicitly document the breaking change in the release notes and
add a deprecation/upgrade notice; locate the symbols buildMongoNamespaceMap and
buildMongoNamespace in the codebase to update src/exports/index.ts accordingly.

In
`@packages/2-mongo-family/1-foundation/mongo-contract/src/ir/build-mongo-namespace.ts`:
- Around line 23-30: The factory currently only rejects unknown entry kinds when
taking the unbound-singleton shortcut, letting inputs like entries: { typo:
{...} } pass into MongoBoundNamespace; update static fromCollectionsInput to
validate input.entries and throw a descriptive error if any keys other than
'collection' are present (when hasUnknownKinds is true) before constructing
MongoBoundNamespace or returning MongoUnboundNamespace; apply the same
validation to the other factory/path referenced around lines 39-53 so both
construction paths consistently reject unsupported kinds (refer to
MongoNamespaceCollectionsInput, fromCollectionsInput, MongoBoundNamespace and
MongoUnboundNamespace).

In
`@packages/2-mongo-family/1-foundation/mongo-contract/test/mongo-storage.test.ts`:
- Around line 92-120: Replace the permissive assertions with expectations that
buildMongoNamespace fails for unregistered kinds: update the three tests to call
buildMongoNamespace and assert it throws an error indicating an unknown kind
(e.g. check that the thrown error is defined and either error.name ===
'UnknownKindError' or error.message.includes('unknown kind')), and remove
assertions that the bogus entry is preserved or that the unbound singleton is
returned (replace the latter with an assertion that the call throws rather than
returning MongoUnboundNamespace.instance); reference buildMongoNamespace,
UNBOUND_NAMESPACE_ID and MongoUnboundNamespace.instance to locate the tests to
change.

In `@packages/2-sql/1-core/contract/src/validators.ts`:
- Around line 236-239: The loop that applies packSchemas currently does
registry.set(kind, schema) which allows packs to overwrite core entry kinds;
update the logic in the packSchemas application (the for (const [kind, schema]
of packSchemas) block) to first check for existing core registrations and reject
shadowing: either check registry.has(kind) and throw a clear error, or compare
kind against a defined set of CORE_ENTRY_KINDS (e.g., "table", "valueSet") and
throw if matched, so packs cannot silently overwrite core handlers; ensure the
thrown error includes the offending kind and stops registration instead of
calling registry.set.

In `@packages/2-sql/1-core/contract/test/sql-namespace-entries.test.ts`:
- Around line 136-182: The tests currently assert that buildSqlNamespace
preserves arbitrary unknown kinds (e.g., entries with key 'bogus'), but the
contract requires unregistered kinds to be rejected; update these tests to
expect construction/validation to throw a named error instead of carrying
unknown kinds. Specifically, change the cases that call buildSqlNamespace with
entries: { bogus: ... } to assert that buildSqlNamespace(...) throws (or returns
a rejected Promise) with the appropriate error, remove checks that expect the
unknown entry to be frozen or survive JSON round-trip, and for the
elementCoordinates/SqlStorage test either replace 'bogus' with a pack-registered
kind or assert that constructing SqlStorage/elementCoordinates with an unknown
kind fails; keep references to buildSqlNamespace,
UNBOUND_NAMESPACE_ID/SqlUnboundNamespace.instance, SqlStorage, and
elementCoordinates when updating the assertions.

In `@packages/2-sql/9-family/src/core/ir/sql-contract-serializer-base.ts`:
- Around line 228-233: Replace the bare TypeScript casts in the map over
Object.entries(innerMap) with the project's blindCast utility for consistency:
instead of using "table as StorageTableInput" and "innerMap as Record<string,
unknown>" use blindCast to convert innerMap and each table to the expected types
before constructing new StorageTable instances; update the mapping code that
produces new StorageTable(table ...) to call blindCast(table, StorageTableInput)
(and blindCast for innerMap) matching the valueSet branch's pattern so all casts
use blindCast consistently.

In `@packages/3-mongo-target/1-mongo-target/src/core/mongo-target-database.ts`:
- Around line 43-57: The constructor currently preserves any entries[kind] into
carried, allowing unknown/misspelled kinds to pass through; change it to
validate kinds and reject unknown ones by throwing an error when kind is not an
expected bucket (e.g., only 'collection' is supported). In the loop over
Object.entries(input.entries ?? {}), handle 'collection' as before (create
MongoCollection instances into collectionMap) but for any other kind throw a
descriptive Error (include the offending kind and possibly the allowed kinds)
instead of assigning to carried; use the existing symbols (input.entries,
blindCast, MongoCollection, carried, collection) to locate and update the logic
so invalid entry kinds fail at construction time.

In `@packages/3-targets/3-targets/sqlite/src/core/sqlite-unbound-database.ts`:
- Around line 36-55: The loop that only hydrates 'table' needs to also
materialize 'valueSet' entries into StorageValueSet instances instead of
carrying raw JSON: in sqlite-unbound-database.ts (the constructor that builds
this.entries) detect kind === 'valueSet' like kind === 'table', iterate the
rawMap, construct new StorageValueSet(...) for each entry (similar to how
StorageTable is built), freeze and assign it to a local valueSet variable, then
include valueSet in the final Object.freeze({ ...carried, table }) structure
(and remove it from carried) so the typed accessor (the SqliteDatabase/entries
accessor for valueSet) and buildSqliteNamespace() will see proper
StorageValueSet instances and not treat valueSet as an unknown kind; apply the
same change at the other indicated spots (around the other occurrences of the
table/carried handling).

---

Outside diff comments:
In
`@packages/3-targets/3-targets/postgres/src/core/migrations/planner-strategies.ts`:
- Around line 733-799: The code currently matches and consumes check issues
using bare tableName which mixes namespaces; update all lookups and
handledIssueKeys keys to include the resolved namespace/DDL schema so checks are
qualified by namespace. Specifically: when computing schemaTable use
resolveDdlSchemaForNamespace(ctx, namespaceId) (you already have ddlSchema) to
index ctx.schema.tables by namespace-qualified name (or include ddlSchema in the
lookup), and change every issueKey construction (`${tableName}�${...}`) to
include ddlSchema (e.g. `${ddlSchema}�${tableName}�${constraintName}`) before
pushing AddCheckConstraintCall/DropCheckConstraintCall and before adding to
handledIssueKeys; also update the final issues.filter key computation to build
the same ddlSchema-qualified key so only issues in the same namespace are
consumed. Ensure collectContractChecks, AddCheckConstraintCall and
DropCheckConstraintCall invocations still receive ddlSchema as they do now.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 7006da99-d08c-4c60-9021-4c7406645532

📥 Commits

Reviewing files that changed from the base of the PR and between 57c65da and f872697.

📒 Files selected for processing (121)
  • docs/architecture docs/adrs/ADR 221 - Contract IR two planes with uniform entity coordinate and pack-contributed entity kinds.md
  • docs/architecture docs/subsystems/1. Data Contract.md
  • docs/architecture docs/subsystems/2. Contract Emitter & Types.md
  • docs/architecture docs/subsystems/5. Adapters & Targets.md
  • docs/reference/typescript-patterns.md
  • examples/mongo-demo/test/blog.test.ts
  • examples/mongo-demo/test/cache-middleware.test.ts
  • examples/mongo-demo/test/crud-lifecycle.test.ts
  • examples/mongo-demo/test/query-builder-writes.test.ts
  • examples/prisma-next-demo/migrations/app/20260422T0748_migration/migration.ts
  • examples/prisma-next-demo/src/app/ContractView.test.tsx
  • examples/prisma-next-demo/src/app/main.tsx
  • examples/prisma-next-demo/test/control-client.integration.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-demo/test/migration-integrity.test.ts
  • examples/retail-store/migrations/app/20260513T0505_initial/migration.ts
  • examples/retail-store/migrations/app/20260513T0508_backfill_product_status/migration.ts
  • examples/retail-store/test/migration.test.ts
  • examples/retail-store/test/setup.ts
  • examples/supabase/test/skeleton.integration.test.ts
  • packages/1-framework/1-core/framework-components/src/exports/ir.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/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/build-mongo-namespace.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-storage.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-unbound-namespace.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/validate-storage.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/element-coordinates.test.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/mongo-storage.test.ts
  • packages/2-mongo-family/2-authoring/contract-psl/src/interpreter.ts
  • packages/2-mongo-family/2-authoring/contract-ts/src/contract-builder.ts
  • packages/2-mongo-family/2-authoring/contract-ts/test/contract-builder.control-policy.test.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/2-authoring/contract-ts/test/contract-builder.storage-hash-pin.test.ts
  • packages/2-mongo-family/3-tooling/emitter/src/index.ts
  • packages/2-mongo-family/9-family/src/core/contract-to-schema.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/test/mongo-contract-serializer-base.test.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/build-sql-namespace.ts
  • packages/2-sql/1-core/contract/src/ir/sql-storage.ts
  • packages/2-sql/1-core/contract/src/ir/sql-unbound-namespace.ts
  • packages/2-sql/1-core/contract/src/resolve-storage-table.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/build-sql-namespace-map.test.ts
  • packages/2-sql/1-core/contract/test/check-constraint.test.ts
  • packages/2-sql/1-core/contract/test/control-field.test.ts
  • packages/2-sql/1-core/contract/test/element-coordinates.test.ts
  • packages/2-sql/1-core/contract/test/namespace-entry-registry.test.ts
  • packages/2-sql/1-core/contract/test/sql-namespace-entries.test.ts
  • packages/2-sql/1-core/contract/test/storage-value-set.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.enum2.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.namespaces.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.polymorphism.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.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/test/check-constraint.authoring.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract-builder.cross-namespace-same-table.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.integration.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract.logic.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/enum-type.authoring.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/enum-type.codec-encoding.test.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.structure.test.ts
  • packages/2-sql/4-lanes/sql-builder/src/runtime/resolve-table.ts
  • packages/2-sql/4-lanes/sql-builder/src/types/db.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-mapping-validation.test.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/schema-verify/verify-sql-schema.ts
  • packages/2-sql/9-family/test/namespace-hydration-registry.test.ts
  • packages/2-sql/9-family/test/value-set-roundtrip.test.ts
  • packages/3-extensions/pgvector/test/descriptor.test.ts
  • packages/3-extensions/postgres/test/psl-namespace-qualifier-routing.test.ts
  • packages/3-extensions/sql-orm-client/src/collection-contract.ts
  • packages/3-extensions/sql-orm-client/test/mutation-executor.test.ts
  • packages/3-extensions/sql-orm-client/test/unbound-tables.ts
  • packages/3-extensions/supabase/test/contract-handles.test.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-database.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-database-entries.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-target-database.test.ts
  • packages/3-targets/3-targets/postgres/src/core/authoring.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/control-policy.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/postgres-contract-serializer.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-enum-type-schema.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-schema.ts
  • packages/3-targets/3-targets/postgres/src/exports/types.ts
  • packages/3-targets/3-targets/postgres/test/control-field.test.ts
  • packages/3-targets/3-targets/postgres/test/element-coordinates.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/sqlite/src/core/migrations/planner-strategies.ts
  • packages/3-targets/3-targets/sqlite/src/core/sqlite-unbound-database.ts
  • packages/3-targets/3-targets/sqlite/test/element-coordinates.test.ts
  • packages/3-targets/3-targets/sqlite/test/sqlite-contract-serializer-hydration.test.ts
  • packages/3-targets/3-targets/sqlite/test/sqlite-contract-serializer.test.ts
  • packages/3-targets/3-targets/sqlite/test/sqlite-unbound-database.test.ts
  • packages/3-targets/6-adapters/postgres/src/core/sql-renderer.ts
  • packages/3-targets/6-adapters/postgres/test/adapter.test.ts
✅ Files skipped from review due to trivial changes (12)
  • examples/prisma-next-demo/test/control-client.integration.test.ts
  • examples/retail-store/test/setup.ts
  • examples/mongo-demo/test/query-builder-writes.test.ts
  • packages/3-targets/3-targets/postgres/src/exports/types.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/issue-planner.ts
  • examples/mongo-demo/test/cache-middleware.test.ts
  • docs/reference/typescript-patterns.md
  • examples/mongo-demo/test/crud-lifecycle.test.ts
  • packages/1-framework/1-core/framework-components/src/exports/ir.ts
  • docs/architecture docs/subsystems/1. Data Contract.md
  • docs/architecture docs/subsystems/5. Adapters & Targets.md
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-unbound-namespace.ts
🚧 Files skipped from review as they are similar to previous changes (67)
  • examples/prisma-next-demo/migrations/app/20260422T0748_migration/migration.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/validate-storage.ts
  • packages/2-mongo-family/9-family/src/core/ir/mongo-schema-verifier-base.ts
  • packages/3-targets/3-targets/sqlite/test/sqlite-contract-serializer-hydration.test.ts
  • packages/3-extensions/sql-orm-client/test/mutation-executor.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/ts-psl-parity.test.ts
  • packages/2-sql/9-family/src/core/migrations/contract-to-schema-ir.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.test.ts
  • packages/2-sql/1-core/contract/src/types.ts
  • packages/2-sql/1-core/contract/src/index-type-validation.ts
  • packages/2-mongo-family/3-tooling/emitter/src/index.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.structure.test.ts
  • packages/2-sql/1-core/contract/test/storage-value-set.test.ts
  • packages/2-mongo-family/9-family/src/core/contract-to-schema.ts
  • packages/2-sql/1-core/contract/test/build-sql-namespace-map.test.ts
  • packages/3-extensions/pgvector/test/descriptor.test.ts
  • packages/3-targets/6-adapters/postgres/test/adapter.test.ts
  • packages/3-targets/3-targets/postgres/src/core/authoring.ts
  • packages/3-targets/3-targets/sqlite/test/element-coordinates.test.ts
  • packages/2-mongo-family/2-authoring/contract-ts/test/contract-builder.control-policy.test.ts
  • packages/3-extensions/supabase/test/contract-handles.test.ts
  • packages/2-sql/1-core/contract/src/ir/sql-unbound-namespace.ts
  • packages/2-sql/9-family/src/core/control-instance.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-enum-type-schema.ts
  • packages/2-sql/2-authoring/contract-ts/test/enum-type.codec-encoding.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.namespaces.test.ts
  • packages/2-sql/9-family/test/namespace-hydration-registry.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/unbound-tables.ts
  • packages/2-mongo-family/9-family/src/core/ir/mongo-contract-serializer-base.ts
  • packages/2-sql/4-lanes/sql-builder/src/runtime/resolve-table.ts
  • packages/2-sql/9-family/test/value-set-roundtrip.test.ts
  • packages/2-sql/1-core/contract/test/namespace-entry-registry.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-target-contract-serializer.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract.integration.test.ts
  • packages/2-mongo-family/2-authoring/contract-ts/test/contract-builder.dsl.test.ts
  • packages/2-sql/9-family/src/core/schema-verify/verify-sql-schema.ts
  • packages/3-targets/3-targets/postgres/test/postgres-contract-serializer.test.ts
  • packages/3-extensions/sql-orm-client/src/collection-contract.ts
  • packages/2-sql/2-authoring/contract-psl/test/psl-ts-namespace-parity.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.polymorphism.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/check-constraint.authoring.test.ts
  • packages/2-sql/2-authoring/contract-ts/src/build-contract.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract.logic.test.ts
  • packages/1-framework/1-core/framework-components/test/element-coordinates.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-target-database.test.ts
  • packages/3-targets/3-targets/sqlite/src/core/migrations/planner-strategies.ts
  • packages/2-mongo-family/2-authoring/contract-ts/test/contract-builder.polymorphism.test.ts
  • packages/3-extensions/sql-orm-client/test/unbound-tables.ts
  • packages/2-sql/5-runtime/test/codec-mapping-validation.test.ts
  • packages/3-targets/6-adapters/postgres/src/core/sql-renderer.ts
  • docs/architecture docs/adrs/ADR 221 - Contract IR two planes with uniform entity coordinate and pack-contributed entity kinds.md
  • examples/prisma-next-demo/test/migration-integrity.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/enum-type.authoring.test.ts
  • packages/2-sql/1-core/contract/src/ir/build-sql-namespace.ts
  • packages/2-sql/3-tooling/emitter/src/index.ts
  • packages/2-sql/5-runtime/src/sql-context.ts
  • packages/2-sql/5-runtime/src/codecs/validation.ts
  • packages/2-sql/2-authoring/contract-psl/test/unbound-tables.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/contract-types.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract-builder.cross-namespace-same-table.test.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-contract-serializer.ts
  • docs/architecture docs/subsystems/2. Contract Emitter & Types.md
  • packages/2-sql/4-lanes/sql-builder/src/types/db.ts
  • packages/3-mongo-target/1-mongo-target/src/core/mongo-target-contract-serializer.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-storage.ts
  • packages/3-targets/3-targets/postgres/src/core/postgres-schema.ts

wmadden-electric and others added 10 commits June 12, 2026 13:37
The constant name claimed it was a table but it was a name→table map.
Remove the misleadingly named constant and inline the value at its
single use site, consistent with how MongoUnboundNamespace already
handles its empty collection map.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Signed-off-by: willbot <[email protected]>
kindMap[coord.entityName] reads through the prototype, so
'toString'/'constructor' returned the Object prototype's methods instead
of undefined. Add an Object.hasOwn guard to mirror how elementCoordinates
already uses Object.keys (own keys only). Add a test proving 'toString'
and 'constructor' return undefined.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Signed-off-by: willbot <[email protected]>
createSqlEntrySchemaRegistry silently overwrote 'table'/'valueSet'
if a pack passed those same keys. Add a fail-fast throw naming the
colliding kind, with a test that verifies 'table' and 'valueSet'
both trigger the error while a non-colliding key ('type') is accepted.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Signed-off-by: willbot <[email protected]>
The previous check (typeof==='object' && !null && !Array.isArray) let
Map/Date/class instances through. A Date passed as an inner entries map
appeared as an empty map and silently validated as a valid empty namespace
kind. Restrict to prototype===Object.prototype||null. Tests verify Date
and Map are now rejected in the entries validation path.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Signed-off-by: willbot <[email protected]>
The table branch of hydrateEntriesKind used two bare 'as' casts while the
valueSet branch already used blindCast. Convert both table casts to
blindCast with honest reasons, making both branches consistent.

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

Previously hydrateMongoContract checked for undefined return and threw,
making the error handling split across caller and hook. This change:

1. Moves the unknown-kind throw into hydrateEntriesKind (adds nsId param)
   so the hook is the single per-kind authority — it throws instead of
   returning undefined.
2. Removes the redundant collection destructure-and-re-blindCast from
   hydrateMongoContract; the hook already constructs MongoCollection
   instances, so entriesOutput flows through uniformly via a single cast
   to MongoNamespaceEntries.
3. Removes the duplicated object-guard from the collection branch; the
   contract schema validates the inner map before hydration runs.

Behavior is wire-identical; existing tests cover the unknown-kind error path.

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

The hydration path only ever receives raw JSON — parseSqlContractStructure
runs before hydrateSqlStorage, so namespaces are always plain Records, never
NamespaceBase instances. Traced callers: hydrateSqlStorage is the only call
site; its input is always JSON-parsed, never a materialized class.

Removed dead branches from:
- hydrateSqlNamespaceMap (line 167: instanceof guard before buildSqlNamespace)
- hydrateSqlNamespaceEntry base (line 184: early return for NamespaceBase)
- postgres-contract-serializer.ts (line 113: same dead guard in override)
- sqlite-contract-serializer.ts (line 23: same dead guard in override)

Updated method signatures: removed Namespace union from raw param type
(now Record<string, unknown>) and return type (now SqlNamespaceTablesInput).
Added blindCast at the call site in hydrateSqlStorage where the static type
says SqlNamespace but the runtime value is still pre-hydration plain JSON.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Signed-off-by: willbot <[email protected]>
… hydration path"

This reverts commit d101ea5.

Signed-off-by: willbot <[email protected]>
…ration

The hydration path receives raw JSON; parseSqlContractStructure runs
before hydrateSqlStorage, so namespaces are always plain Records at the
point hydrateSqlNamespaceEntry is called. The input-side instanceof guards
were unreachable in all three classes.

Removed dead instanceof NamespaceBase input guards from:
- hydrateSqlNamespaceEntry base (input can never be a NamespaceBase)
- postgres-contract-serializer.ts override (same)
- sqlite-contract-serializer.ts override (same)

The output-side instanceof check in hydrateSqlNamespaceMap is intentional
and kept: Postgres' override returns a PostgresSchema (NamespaceBase subclass),
so the caller must detect that and skip buildSqlNamespace for it.

Caller evidence: hydrateSqlStorage is the only call site; its input is
always the result of validateSqlContractFully which parses raw JSON.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Signed-off-by: willbot <[email protected]>
…res red)

Item G removed instanceof NamespaceBase guards from the SQL hydration
path; CI Fixtures went red (supabase/paradedb namespaces emit
postgres-schema + type instead of sql-namespace). Reverting to the
pre-G serializer state; the instanceof comment stays open for a
wire-safe approach.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: willbot <[email protected]>
@wmadden-electric
wmadden-electric force-pushed the tml-2887-open-entries-dictionary branch from dd87579 to 979caa6 Compare June 12, 2026 11:37
@wmadden-electric
wmadden-electric requested a review from wmadden June 12, 2026 11:44

@wmadden wmadden left a comment

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.

Preemptively approved.

@wmadden-electric
wmadden-electric added this pull request to the merge queue Jun 12, 2026
Merged via the queue into main with commit f35545b Jun 12, 2026
20 checks passed
@wmadden-electric
wmadden-electric deleted the tml-2887-open-entries-dictionary branch June 12, 2026 14:38
wmadden-electric added a commit that referenced this pull request Jun 15, 2026
Adopt #812 (TML-2887) open-entries model: entries[kind][name],
kind-keyed registry, no extensionEntities/entrySlotName/slot concept.
Slice 1 RLS integration preserved via open entries registration.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden-electric added a commit that referenced this pull request Jun 15, 2026
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden-electric added a commit that referenced this pull request Jun 15, 2026
…merge

- Pass codecLookup to parsePslDocument in the PSL provider (dropped in #812)
- Restore fallback to target.authoring.createNamespace in the interpreter
  (dropped in #812, breaks policy_select lowering via prismaContract)
- Regenerate supabase/demo/cloudflare-worker contract fixtures

Co-Authored-By: Claude Sonnet 4.6 <[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 Jun 15, 2026
wmadden-electric added a commit that referenced this pull request Jun 15, 2026
unwrapQuotedString was stripping PSL outer quotes but not unescaping
inner \" sequences, so the contract stored the predicate with literal
backslash-quote characters instead of actual double-quotes. The RLS
renderer interpolates the predicate raw into USING(), so PostgreSQL
received \"userId\" (invalid SQL) instead of "userId" (valid quoted
identifier).

Fix: add .replace(/\\"/g, '"') after the slice in unwrapQuotedString.

Also regen supabase/contract.{json,d.ts} (correct predicate +
updated storageHash), update the test to match the new wire name and
corrected column name (userId → "userId"), and regen cloudflare-worker
and prisma-next-demo contracts for #812 entries shape.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
paulwer pushed a commit to paulwer/prisma-next that referenced this pull request Jun 15, 2026
…llel registries) (prisma#826)

**Decision:** every storage entity kind — `table`, `valueSet`, postgres
`type`, Mongo `collection`, the future RLS `policy` — is described by
one **descriptor** that carries all of its behaviors: how it validates,
how it constructs from input, how it hydrates from JSON. The framework
reads that one descriptor everywhere it needs to act on a kind, so there
is no per-kind branching anywhere. Pure refactor — zero wire change.

## At a glance

A kind, described once:

```ts
export const tableEntityKind: EntityKindDescriptor<StorageTableInput, StorageTable> = {
  kind: 'table',
  schema: StorageTableSchema,                 // how it validates
  construct: (input) => new StorageTable(input), // how it builds (construction AND hydration)
};
```

A target adds a kind the same way — `typeEntityKind` in the postgres
package, `kind: 'type'` — and composes it in:

```ts
composeSqlEntityKinds([typeEntityKind])   // family kinds (table, valueSet) + this pack's kind
```

Everything that acts on entries — validation, namespace construction,
deserialization — reads that descriptor set. One loop, no switch:

```ts
constructEntries(entries, kinds, 'carry')  // build known kinds via their descriptor; carry unknown kinds untouched
```

## The problem

Before this PR, acting on an entity kind meant *three* separate places
hardcoding the same kind list:

1. **Validation** — a registry of per-kind arktype schemas (shipped by
prisma#812).
2. **Construction** — `if (kind === 'table') new StorageTable(v) else if
'valueSet' … else carry`, copied across the SQL and Mongo namespace
classes.
3. **Hydration** — the same switch again, in the serializer bases.

Three parallel string-keyed dispatchers for one concept. Adding a kind
meant editing all three; the construction/hydration ones were
type-erased `(unknown) => unknown` factories that needed a cast per
kind. (An earlier round of this PR built construction as a fourth
registry mirroring validation — see Alternatives for why that was the
wrong shape and got reworked.)

## The change

**One descriptor per kind.** `EntityKindDescriptor<Input, Node>`
(`framework-components`) carries `kind`, `schema`, and `construct(input:
Input): Node`. Construction and hydration are the *same* operation —
every IR constructor already accepts both the authoring-input and
raw-JSON shapes — so one typed `construct` serves both, and the per-kind
duplication is gone.

**Type-safe, so the casts disappear.** `construct` is typed (`Input →
Node`); the only cast in the whole mechanism is a single documented
boundary cast inside the shared `constructEntries` loop (the `unknown`
entries value → the kind's `Input`, sound because authoring passes that
input type and hydration runs after `validateStorage`). The descriptors
and the composition are cast-free. `schema` is `Type<unknown>` rather
than `Type<Input>` precisely so a kind whose wire shape can't be
expressed as its input type (e.g. `table`, whose `bigint`/`Date` column
defaults aren't DSL-expressible) needs no declaration cast.

**One composition, one source of truth.** `composeSqlEntityKinds` /
`composeMongoEntityKinds` build the descriptor set from family built-ins
+ pack contributions, with one collision throw (a pack can't shadow a
core kind). Validation is now a *view* over that set, not a separate
registry — `createSqlEntrySchemaRegistry` is deleted. No module-scoped
registry singletons: each concretion composes its set at the seam
(`PostgresSchema` adds `type`; `SqliteDatabase` gets a table-only set,
which is how it keeps carrying `valueSet` raw).

**Folded-in prisma#812 review cleanups.** The duplicate
`isRecord`/`isPlainRecord` guards collapse to one canonical strict guard
in the foundation layer; the known-kind membership check is a `Set`.

## Changes

- **Framework** — `EntityKindDescriptor` + the shared
`constructEntries(entries, kinds, 'carry'|'fail')` loop; canonical
`isPlainRecord`.
- **SQL** — `tableEntityKind`/`valueSetEntityKind` +
`composeSqlEntityKinds`; `validators.ts` derives its schema view from
the descriptor set; `build-sql-namespace`, the serializer base,
`PostgresSchema` (`typeEntityKind`), and `SqliteDatabase` all dispatch
through `constructEntries`. The schemas moved out of `validators.ts` so
descriptors can own them without a cycle.
- **Mongo** — `collectionEntityKind` + `composeMongoEntityKinds`; the
namespace classes and serializer base dispatch through
`constructEntries`; the per-target `hydrateEntriesKind` override hook is
gone.

## Wire stability

Behavior-preserving refactor. Each concretion constructs exactly the
kinds it did before (SQLite carries `valueSet` raw; unknown kinds
freeze-and-carry; always-present keys and fail-closed hydration —
`constructEntries(…, 'fail')` — preserved). `fixtures:check` byte-clean;
round-trip tests unchanged.

## Why it matters

This makes "every entity kind is treated by kind, no special-casing"
true *everywhere*, not just in validation. Concretely: the RLS branch
(prisma#771) adds its `policy` kind by declaring one `policyEntityKind`
descriptor and composing it in — no `else if (kind === 'policy')` branch
in any constructor, validator, or serializer.

## Alternatives considered

- **A construction registry mirroring the validation registry** (this
PR's first attempt). A separate `createSqlEntryConstructionRegistry` of
`(unknown) => unknown` factories keyed by string. Rejected in review:
it's a *third* parallel registry for one concept, the `unknown`-erased
factories force a cast per kind, and it ignores that these are entities
the codebase already models with descriptors. The descriptor unifies all
three concerns and restores the types.
- **Papering over the type errors with casts.** When the erased
registry's variance broke the cross-package typecheck, the quick fix was
a `blindCast` per descriptor + inline "stub" descriptors to break an
import cycle. Rejected — that reintroduces exactly the casts this PR
removes. The real fixes were a one-line variance fix (`schema:
Type<unknown>`) and relocating the schemas to break the cycle.
- **`EntityKindDescriptor.schema: Type<Input>`.** Rejected: a kind's
wire shape isn't always expressible as its input type (`table`'s
`bigint`/`Date` defaults), so this forces a declaration-site cast on
every descriptor. `Type<unknown>` carries the schema without it;
`construct`'s signature carries the input type.
- **Extending the ADR 225 `AuthoringEntityTypeDescriptor`.** Rejected:
that descriptor keys by authoring `discriminator` (`postgres-enum`) on
the lowering axis and carries an authoring context; this keys by
`entries` key (`type`) on the deserialize axis with no such context.
Different concerns — a sibling type. The postgres pack *derives* its
`typeEntityKind` from the authoring descriptor's schema + constructor
rather than redeclaring.

**Linear:** TML-2890 — follow-up A to TML-2887.

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

* **New Features**
* Added new public package exports for `entity-kinds` (Mongo and SQL
contract packages) and exposed `is-plain-record` for wider reuse.

* **Refactor**
* Standardized how namespace `entries` are hydrated across SQL and Mongo
using a descriptor-driven approach, improving consistency and
unknown-kind handling.
* Shifted SQL contract validation from registry-based to
descriptor-based logic.

* **Tests**
* Added coverage for SQL and Mongo entity kind hydration/validation
behavior.

* **Documentation**
  * Updated the review guide rules for `blindCast` usage.

* **Chores**
  * Expanded exports/barrel wiring to match the new modules.
<!-- 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 <[email protected]>
paulwer pushed a commit to paulwer/prisma-next that referenced this pull request Jul 12, 2026
…s now abstract (prisma#864)

## What & why

The SQL family carried a **placeholder** namespace concretion —
`SqlBoundNamespace` (kind `'sql-namespace'`), built by
`buildSqlNamespace` from the misnamed `SqlNamespaceTablesInput` — used
as a fallback when no target `createNamespace` was wired. It existed
only to serve contracts built without a target, which is why the
**supabase extension emitted `kind: 'sql-namespace'` instead of the
correct `'postgres-schema'`**.

## Decision

There is no real-world contract without a target, so the placeholder is
**deleted, not demoted**. `SqlNamespace` is now an **abstract class**;
only target concretions (`PostgresSchema`, `SqliteDatabase`) are ever
instantiated; `createNamespace` is **required** on `ContractDefinition`.

## What changed

- Deleted `SqlBoundNamespace` / `buildSqlNamespace` /
`buildSqlNamespaceMap` / `fromTablesInput` / `SqlUnboundNamespace` / the
`'sql-namespace'` kind. Renamed the `SqlNamespaceTablesInput` misnomer →
`SqlNamespaceInput` (it's the `createNamespace` factory *input*, not a
tables-only type).
- `SqlNamespace` is abstract. `SqlStorageInput.namespaces` stays
**nominal** (construction requires real concretions), while
`SqlStorage.namespaces`'s *read* type is the structural
`SqlNamespaceShape` so emitted `.d.ts` contract literals stay assignable
(preserving the prisma#812 "emitted literals satisfy structurally" property
that the nominal-class change would otherwise have broken).
- The serializer base's `__unbound__` slot is materialized by a
**target-provided override** (no family-level unbound singleton; no
layering violation). The "is this a hydrated concretion?" check is a
**realm-safe structural guard** (`isMaterializedSqlNamespace` — `typeof
qualifyTable === 'function'`) rather than `instanceof NamespaceBase`,
which false-negatives across the built-dist bundle boundary (the item-G
realm-safety concern the ticket flagged).
- Tests that need a namespace use a test-only concrete
`createTestSqlNamespace` (`@prisma-next/sql-contract/test-support`).
Production has **no** constructable family namespace.

## Wire change (isolated)

The only emitted-artifact delta is `kind: 'sql-namespace'` →
`'postgres-schema'` in the generated `.d.ts` (supabase, paradedb,
examples, fixtures). `contract.json` was already correct.
`fixtures:check` is byte-clean.

## Verification

- Merged current `main` (TML-2916 namespace-defaulting + v0.14.0).
- `typecheck --force` 138/138; `test:packages` and `test:e2e` green;
`test:integration` clean modulo known parallel-load flakes + one
network-dependent init-journey; `fixtures:check` byte-clean; `lint` /
`lint:deps` clean; grep-clean of all deleted symbols.
- Internal opus reviewer pass; its must-fixes all addressed (removed
dead `defaultNamespaceId` surface; eliminated two avoidable `blindCast`s
by typing `createNamespace` as `=> SqlNamespace`; fixed a stale comment;
switched a SQLite test off a Postgres-flavored dummy to the real
concretion).

Follow-up B to TML-2887. The remaining follow-up is TML-2892
(migration-author accessor).

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

---------

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants