TML-2891: delete the SQL family placeholder namespace; SqlNamespace is now abstract#864
Conversation
…createNamespace - Convert SqlNamespace from structural type alias to abstract class extending NamespaceBase; targets (PostgresSchema, SqliteDatabase, SqlUnboundNamespace, SqlBoundNamespace) now extend SqlNamespace - Make ContractDefinition.createNamespace required; remove buildSqlNamespace fallbacks from build-contract.ts and all authoring chain types (ContractInput, BoundDefinitionInput, ContractScaffold, contract-dsl, contract-lowering, contract-psl interpreter + provider) - Fix supabase and paradedb configs to supply postgresCreateNamespace - Add createNamespace to emptyContract options interface - Remove buildSqlNamespace fallback + instanceof guard from SqlContractSerializerBase.hydrateSqlNamespaceMap; throw instead - Remove buildSqlNamespaceMap call from validateStorage; use blindCast to pass validated namespace map without materializing IR Tests are expected to be red (Phase 2 fixes them). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
The previous validateStorage constructed `new SqlStorage({...})` and
blindCast raw validated JSON into `SqlStorageInput["namespaces"]`. Since
SqlNamespace is now a nominal abstract class, those raw objects are not
SqlNamespace instances — the cast was an unsound fake materialization of
the family namespace, exactly what this ticket forbids.
Make validateStorage validate-and-throw, returning void; construct
nothing. No validation is lost: the arktype StorageSchema (storageHash,
types, per-namespace entries via createNamespaceEntrySchema) is what
actually validates, and the SqlStorage constructor ran no namespace/table
checks. All semantic checks live in validateStorageSemantics /
validateSqlStorageConsistency / validateModelStorageReferences /
validateContractDomain, driven from validateSqlContractFully over the raw
validated entries. Every caller uses expect(...).toThrow()/not.toThrow()
and ignores the return, so void is compatible.
Drop the now-unused SqlStorageInput and ifDefined imports; SqlStorage is
now type-only.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
…buildSqlNamespace Replaces every `buildSqlNamespace` / `buildSqlNamespaceMap` / `SqlNamespaceTablesInput` / `'sql-namespace'` reference in the 35 test files across packages/3-targets and packages/3-extensions with the appropriate target factory: - Postgres tests → `postgresCreateNamespace` from `@prisma-next/target-postgres/types` (or relative `../../src/core/postgres-schema` inside the target package itself) - SQLite tests → `sqliteCreateNamespace` from `@prisma-next/target-sqlite/control` (or relative `../../src/core/sqlite-unbound-database` inside the target package) - `SqlUnboundNamespace.instance` → `PostgresUnboundSchema.instance` (pgvector) or `SqliteUnboundDatabase.instance` (sqlite target authoring-surface test) - `kind: 'sql-namespace'` in test-d type fixtures → `kind: 'schema'` (the actual Postgres namespace kind) - `buildSqlNamespaceMap(namespaces)` (pgvector planner.behavior) replaced with `namespaces ??` fallback since callers pass already-constructed SqlNamespace instances Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…ntract Adds a concrete `TestSqlNamespace extends SqlNamespace` for use in tests that need to instantiate a namespace without going through a real target. Exports `createTestSqlNamespace(input)` from `@prisma-next/sql-contract/test-support` with the package.json export and tsdown entry point. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…estSqlNamespace Replaces all buildSqlNamespace call sites in packages/2-sql/** tests with createTestSqlNamespace imported from @prisma-next/sql-contract/test-support. Removes hand-rolled StubNamespace classes in contract-ts tests. Deletes build-sql-namespace-map.test.ts (tests a function deleted in Phase 3). Signed-off-by: willbot <w.a.madden+machine@gmail.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…amespace API All 39 test files in @prisma-next/sql-contract-ts now pass createNamespace to defineContract/buildSqlContractFromDefinition. Also adds SqlNamespaceShape interface so generated contract.d.ts JSON shapes satisfy Contract<SqlStorage> without requiring qualifyTable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
… and postgres serializer tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…nd cli fixture tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…hase-1 createNamespace API Adds createNamespace to all remaining callsites across integration tests, e2e harness, example configs, and the Postgres/SQLite facade define-contract implementations. Also adds kind: string to SqlNamespaceShape so it satisfies the Namespace interface structurally. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…dSqlNamespace; make SqlNamespace abstract
- Remove build-sql-namespace.ts and sql-unbound-namespace.ts
- SqlNamespace abstract; only PostgresSchema, SqliteDatabase, TestSqlNamespace instantiated
- All call sites updated to use target-specific factories (postgresCreateNamespace, sqliteCreateNamespace, createTestSqlNamespace)
- Emitter's sql-namespace kind fallback branch replaced with a hard throw
- Regenerate fixture .d.ts files: 'sql-namespace' → target-specific kinds ('postgres-schema', 'sqlite-namespace', 'test-sql-namespace')
Co-Authored-By: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
…ment - family-sql/test: introduce TestSqlContractSerializer (via src/core/ir/ + test-utils export) that overrides hydrateSqlNamespaceEntry to produce TestSqlNamespace; use it in namespace-hydration, cross-reference-roundtrip, and value-set-roundtrip tests - adapter-postgres, adapter-sqlite, pgvector tests: switch from SqlContractSerializer (family-sql/ir) to TestSqlContractSerializer (family-sql/test-utils) - emitter test fixture: revert createTestSqlNamespace in namespacedSqlStorage back to plain objects with explicit kind:'test-sql-namespace'; emitter only reads namespace.kind/id/entries as JSON, not class methods - sqlite.ts runtime: switch from SqlContractSerializer to SqliteContractSerializer so JSON deserialization produces proper SqliteDatabase namespace instances Co-Authored-By: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…ctSerializer SqlContractSerializer (family-sql/ir) now throws when deserializing plain JSON namespace objects — it requires a target-specific override. All test sites that don't need target-specific namespace behaviour switch to TestSqlContractSerializer from family-sql/test-utils. Co-Authored-By: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
… integration tests The emitter now throws when it encounters a namespace without a `kind` property. Two tests in contract-imports.test.ts constructed inline IR with plain namespace objects (no `kind`) before calling emit(). Add `kind: 'schema' as const` to match what PostgresSchema carries, and also fix a data bug where `post` table was at the wrong nesting level (sibling of `user` instead of inside `entries.table`). Co-Authored-By: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
The previous session removed the inline TestSqlContractSerializer class and replaced it with an import, but dropped the `Contract` type import from `@prisma-next/contract/types` that was used in the cast at lines 37 and 49. Co-Authored-By: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…onfig mappings The tsconfig paths in the contract-imports tests pointed to dist/types.d.mts but the file lives at dist/exports/types.d.mts (the package uses a nested exports/ directory in dist). Fix both path mappings that reference this file. Co-Authored-By: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…tract-imports tsconfig Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…0.14.0) Resolves 10 merge conflicts: - Generated .d.ts fixtures: taken from rerere cache (regenerated in next commit) - sql-contract-serializer-base.ts: rerere preserved this branch's throw + unboundNamespace seam; TML-2916 changes auto-merged cleanly - contract-builder.namespaces.test.ts: rerere kept both sides (this branch's createTestSqlNamespace usage + TML-2916's __unbound__ undefined assertions) - postgres-contract-serializer.test.ts: rerere preserved this branch's UNBOUND_NAMESPACE_ID-based probe using postgresCreateNamespace Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Updates examples/supabase/src/contract.{d.ts,json} to reflect the
v0.14.0 extension version bump from main; all other fixtures were
already up to date after the merge conflict resolution.
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
…lt; add defaultNamespaceId to TestSqlContractSerializer `PostgresResult` and `SqliteResult` were changed to use `PostgresDefinition` / `SqliteDefinition` as the type argument to `buildBoundContract`, which pulled in `naming?: NamingConfig` from the scaffold type. The conditional type `DefinitionColumnNaming` then inferred `'identity' | 'snake_case'` from the optional field's declared type, widening all column names to include snake_case variants and breaking DSL type-inference tests. Restore the minimal inline shape (types/models/extensionPacks/createNamespace) that excludes `naming`, matching the pre-TML-2891 shape. Also adds the missing `defaultNamespaceId` getter to `TestSqlContractSerializer` (required by the abstract base after TML-2916 introduced the abstract member). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…te transaction test
createContract<SqlStorage>({ target: 'sqlite' }) without a storage
override produces DEFAULT_FRAMEWORK_STORAGE = { namespaces: {} }, so
sqlBuilder's proxy returns undefined for __unbound__ and tx.sql is
undefined. The ORM builder reads from contract.domain.namespaces
(always populated by createContract), which is why tx.orm was defined
while tx.sql was not.
Replace the createContract call with an explicit Contract<SqlStorage>
that carries a real __unbound__ SqlStorage namespace via
createTestSqlNamespace, matching the pattern already used in
supabase-runtime.test.ts.
Co-Authored-By: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
…emplate Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…erializedSqlNamespace guard
All four instanceof NamespaceBase checks in the serializer pipeline —
sql-contract-serializer-base (two sites), SqliteContractSerializer, and
PostgresContractSerializer — used class identity, which fails in the built
dist when @prisma-next/target-sqlite and @prisma-next/family-sql each
carry a separate copy of @prisma-next/framework-components.
Replace with isMaterializedSqlNamespace(x), a structural guard that
checks typeof x?.qualifyTable === 'function'. Every SqlNamespace
subclass (PostgresSchema, SqliteDatabase, TestSqlNamespace) implements
qualifyTable; raw SqlNamespaceInput ({id, entries}) does not. The guard
is purely structural so it is realm-safe.
Also fix the sqlite transaction e2e test: it was importing SqlContractSerializer
from @prisma-next/family-sql/ir (the base, with no hydrateSqlNamespaceEntry
override), which cannot deserialize namespace entries from raw JSON. Switch
to TestSqlContractSerializer from @prisma-next/family-sql/test-utils,
matching every other sqlite e2e test.
Co-Authored-By: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
…s SqlNamespace, fix transaction test FIX 1: Delete dead `protected abstract get defaultNamespaceId()` from SqlContractSerializerBase and all overrides in SqlContractSerializer, TestSqlContractSerializer, PostgresContractSerializer, and SqliteContractSerializer. No call site read `this.defaultNamespaceId` anywhere in the codebase. FIX 2: Narrow `createNamespace` return type from `Namespace` to `SqlNamespace` across all authoring seams: ContractDefinition, ContractInput, BoundDefinitionInput, emptyContract, PrismaContractOptions, PslInterpreterInput, and the two extension defineContract wrappers (Postgres and SQLite). Remove the two now-unnecessary blindCasts in build-contract.ts that existed only because the return type was too wide. FIX 3: Rewrite the stale validators.ts comment that referenced a `__unbound__` brand and `hydrateSqlStorage` injection path — neither exists; the unbound slot is injected by ensureUnboundNamespaceSlot in build-contract.ts. FIX 4: Switch @prisma-next/sqlite transaction.test.ts `__unbound__` slot from createTestSqlNamespace (Postgres-style quoting) to sqliteCreateNamespace (the real SQLite concretion). NIT 1: Replace `'kind' in result` guard in TestSqlContractSerializer with the canonical isMaterializedSqlNamespace check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
|
Important Review skippedToo many files! This PR contains 310 files, which is 160 over the limit of 150. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (310)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Resolves 6 conflicts keeping both TML-2891 changes (no placeholder namespace, createNamespace required) and TML-2794 M:N additions: - validators.ts: take our pure structural validateStorage; add main's StorageColumn for validateRelationThroughConsistency; drop SqlUnboundNamespace and SqlStorageInput (not needed on this branch). - interpreter.ts: take main's new CST/symbol-table imports; keep our SqlNamespaceInput/SqlNamespace types (SqlNamespaceTablesInput deleted); drop unused Namespace import. - provider.ts: take main's buildSymbolTable/parse/rangeToPslSpan imports; keep our SqlNamespace/SqlNamespaceInput types; drop unused Namespace. - fixtures.ts: take main's SymbolTable/buildSymbolTable/parse imports; keep our createTestSqlNamespace/SqlNamespace/SqlNamespaceInput; drop buildSqlNamespace (deleted) and unused Namespace import. - composed-mutation-defaults.test.ts: import both createTestNamespace (our branch, used for createNamespace factory) and symbolTableInputFromParseArgs (main, used for parse input). - ts-psl-parity.test.ts: import both createTestNamespace and symbolTableInputFromParseArgs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Will Madden <madden@prisma.io> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
@prisma-next/extension-author-tools
@prisma-next/mongo-runtime
@prisma-next/family-mongo
@prisma-next/sql-runtime
@prisma-next/family-sql
@prisma-next/extension-arktype-json
@prisma-next/middleware-cache
@prisma-next/mongo
@prisma-next/extension-paradedb
@prisma-next/extension-pgvector
@prisma-next/extension-postgis
@prisma-next/postgres
@prisma-next/sql-orm-client
@prisma-next/sqlite
@prisma-next/extension-supabase
@prisma-next/target-mongo
@prisma-next/adapter-mongo
@prisma-next/driver-mongo
@prisma-next/contract
@prisma-next/utils
@prisma-next/config
@prisma-next/errors
@prisma-next/framework-components
@prisma-next/operations
@prisma-next/ts-render
@prisma-next/contract-authoring
@prisma-next/ids
@prisma-next/psl-parser
@prisma-next/psl-printer
@prisma-next/cli
@prisma-next/cli-telemetry
@prisma-next/config-loader
@prisma-next/emitter
@prisma-next/language-server
@prisma-next/migration-tools
prisma-next
@prisma-next/vite-plugin-contract-emit
@prisma-next/mongo-codec
@prisma-next/mongo-contract
@prisma-next/mongo-value
@prisma-next/mongo-contract-psl
@prisma-next/mongo-contract-ts
@prisma-next/mongo-emitter
@prisma-next/mongo-schema-ir
@prisma-next/mongo-query-ast
@prisma-next/mongo-orm
@prisma-next/mongo-query-builder
@prisma-next/mongo-lowering
@prisma-next/mongo-wire
@prisma-next/sql-contract
@prisma-next/sql-errors
@prisma-next/sql-operations
@prisma-next/sql-schema-ir
@prisma-next/sql-contract-psl
@prisma-next/sql-contract-ts
@prisma-next/sql-contract-emitter
@prisma-next/sql-lane-query-builder
@prisma-next/sql-relational-core
@prisma-next/sql-builder
@prisma-next/target-postgres
@prisma-next/target-sqlite
@prisma-next/adapter-postgres
@prisma-next/adapter-sqlite
@prisma-next/driver-postgres
@prisma-next/driver-sqlite
commit: |
size-limit report 📦
|
validateRelationThroughConsistency (added by TML-2794 on main) uses ifDefined but the import was absent after merge conflict resolution. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Will Madden <madden@prisma.io> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…-2928 TML-2891 made createNamespace required on ContractDefinition and InterpretPslDocumentToSqlContractInput. Several tests added on main after TML-2891 branched did not include createNamespace: - interpreter.relations.many-to-many.test.ts (TML-2794): add createTestNamespace to baseInput - config-types.test.ts (TML-2928): add createTestSqlNamespace to emptyContract() calls in the source format discriminator describe block - contract-builder.cross-namespace-same-table.test.ts (TML-2928): add createTestSqlNamespace to the SQLite buildSqlContractFromDefinition call - sql-orm-client test/contract-builder.ts: omit createNamespace from PostgresBaseScaffold (the defineContract factory always injects postgresCreateNamespace at runtime); add createNamespace to the PostgresResult type argument so buildBoundContract sees a valid BoundDefinitionInput and junction relation types resolve correctly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…nt:casts ratchet Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
… (in-operator, not isPlainRecord) Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…teNamespace/type changes; app incidental) Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…ches Removes the `if (isMaterializedSqlNamespace(raw)) return raw` guard in the postgres and sqlite contract serializer overrides, and the `if (isMaterializedSqlNamespace(result)) return result` check in TestSqlContractSerializer. The base class already handles the materialized case; the overrides can safely assume super returns a SqlNamespaceInput and proceed directly to building the target concretion. The base class pass-through (`hydrateSqlNamespaceEntry` in `sql-contract-serializer-base.ts`) is retained — the emit path feeds pre-hydrated Namespace instances through this method and the guard is live. The postcondition in `hydrateSqlNamespaceMap` is also retained. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Route enrichedIR through contractSerializer.serializeContract before passing to familyInstance.deserializeContract, so deserializeContract only ever receives raw JSON. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…ceives raw JSON or live-instance round-trips via JSON Remove `isMaterializedSqlNamespace(raw) return raw` from `hydrateSqlNamespaceEntry`. The pass-through was a workaround for callers that passed live `Contract<SqlStorage>` class instances into `deserializeContract` instead of raw JSON. This commit eliminates those callers: - `contract-emit.ts` (PSL path): serialize before deserialize - `sqlite.ts` `resolveContract`: branch on `contractJson` vs `contract` option - `control-instance.ts` `deserializeWithTargetSerializer`: use `isPlainRecord` to detect live instances and serialize first when `targetSerializer` is present - Integration tests (`cli.emit-parity-fixtures`, `side-by-side-contracts`): insert `contractSerializer.serializeContract` before `deserializeContract` Where the public `deserializeContract` API is called with live instances directly (e.g. runtime tests, `family.sign-database`), `hydrateSqlNamespaceEntry` now does a `JSON.parse(JSON.stringify(raw))` round-trip on non-plain-record namespace inputs rather than returning them unchanged. This keeps the public API usable while ensuring every namespace goes through the same hydration path. Also regenerates 13 mongo example/fixture `contract.d.ts` files from `mongo-namespace` → `mongo-database` (pre-existing kind rename, now reflected in fixtures:check). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Will Madden <madden@prisma.io> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…ialize built IR first Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Resolves conflicts in sql-storage.ts (imports), types.ts exports, interpreter.ts (createNamespace call), provider.ts (imports + call), postgres-contract-serializer (imports), test files, runner-fixtures, and upgrade instructions. Preserves both TML-2891's SqlNamespaceInput rename (from SqlNamespaceTablesInput) and main's new SqlAuthoringContributions / isSqlAuthoringContributions / RLS entity kind additions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…NamespaceShape→SqlNamespace (interface) The abstract class takes the Base suffix per the NamespaceBase convention. The clean name SqlNamespace now belongs to the structural interface, matching how consumers read namespace values from SqlStorage.namespaces. - sql-storage.ts: class SqlNamespace→SqlNamespaceBase, interface SqlNamespaceShape→SqlNamespace - SqlStorageInput.namespaces: Record<string,SqlNamespaceBase> (construction type) - SqlStorage.namespaces: Record<string,SqlNamespace> (structural read type) - isMaterializedSqlNamespace: returns x is SqlNamespaceBase - All extends/factory-return uses updated to SqlNamespaceBase - PSL interpreter: simplified createNamespaceWithExtensions (createNamespace is now required) - SqlNamespaceShape→SqlNamespace in per-model-namespace test Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…te all importers - Delete `@prisma-next/sql-contract/test-support` and `@prisma-next/family-sql/test-utils` exports - Move `TestSqlNamespace`/`createTestSqlNamespace` to `packages/2-sql/1-core/contract/test/test-support.ts` - Move `TestSqlContractSerializer` to `packages/2-sql/9-family/test/test-sql-contract-serializer.ts` - Update 62 test files to import via cross-package relative paths - Widen `rootDir` in affected tsconfig files to cover the cross-package import depth - Add vitest `resolve.alias` in `sql-contract`, `9-family`, and `contract-ts` to redirect `@prisma-next/sql-contract/*` imports to source so `instanceof` checks use the same class object - Delete obsolete test "throws when ... no createNamespace factory" (now a compile-time constraint) - Remove stale `createTestNamespace` re-export from `contract-psl/test/fixtures.ts` Co-Authored-By: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…epoint top-level test imports Replace the broad vitest resolve aliases (reverted to match main) with realm-independent structural guards, matching the existing isMaterializedSqlNamespace / isStorageTypeInstance pattern: - Add isStorageTable / isStorageValueSet in sql-contract, exported from types - 9-family production migration/verify code uses the guards instead of instanceof StorageTable / StorageValueSet (fixes cross-realm false negatives when a contract is built by a different copy of sql-contract) - Convert the affected helper-built test assertions to the structural guards - Restore typecheck-only rootDir widening (tsconfig.json, --noEmit) so test files that import a sibling package test helper by relative path resolve; this mirrors the existing sql-orm-client precedent on main and does not affect emitted dist (build uses tsconfig.prod.json without test/) - Repoint top-level test/e2e and test/integration imports off the deleted @prisma-next/family-sql/test-utils and @prisma-next/sql-contract/test-support specifiers; the contract-imports synthetic file now exercises the real published PostgresContractSerializer Co-Authored-By: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…e-sql-family-placeholder-namespace-concretion
…e-sql-family-placeholder-namespace-concretion
…ports typecheck The cli test fixtures import the relocated createTestSqlNamespace helper from packages/2-sql/1-core/contract/test/test-support by relative path. tsconfig.test.json inherited rootDir "." from tsconfig.json, so tsc flagged the sibling-package source as outside rootDir (TS6059). Widen the typecheck-only rootDir to packages/, matching the existing precedent (postgres-adapter rootDir ../../.., contract-ts rootDir ../..). Build uses tsconfig.prod.json and is unaffected. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…dSqlNamespace TML-2911 (#846) merged in two new adapter-postgres tests that build a SqlStorage namespace via buildSqlNamespace, which this branch deletes. Repoint them to the createTestSqlNamespace helper (same SqlNamespaceInput shape, returns the SqlNamespaceBase concretion SqlStorage.namespaces requires), matching the sibling tests in this package. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…ion kind TML-2886 (#841) and TML-2911 (#846) merged in tests that build SQL-storage namespaces in the pre-TML-2891 kind-less form { id, entries }. This branch makes a namespace kind required (every namespace is a target concretion). Inject kind: test-sql-namespace for entries-form namespaces in the emitter fixture normalizeRootSqlStorage, and add it to the three namespace literals in storage-column-many.test.ts. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
validateStorage now validates-only (returns void); it previously returned a hydrated SqlStorage built from the deleted placeholder namespace machinery. The two merged TML-2911 round-trip tests captured its return; read the round-tripped column from the JSON-parsed value instead. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…ted dist + real serializer The synthetic contract-imports test compiles a generated temp project against workspace dist via tsconfig path maps. Two maps were wrong: sql-contract types pointed at a nonexistent dist/exports/ subdir (it emits to top-level dist/), and the switch to the real PostgresContractSerializer import (@prisma-next/target-postgres/runtime) lacked an explicit .d.mts mapping (the /* glob does not resolve a bare subpath under moduleResolution:bundler). Point both at the real dist declarations. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
What & why
The SQL family carried a placeholder namespace concretion —
SqlBoundNamespace(kind'sql-namespace'), built bybuildSqlNamespacefrom the misnamedSqlNamespaceTablesInput— used as a fallback when no targetcreateNamespacewas wired. It existed only to serve contracts built without a target, which is why the supabase extension emittedkind: '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.
SqlNamespaceis now an abstract class; only target concretions (PostgresSchema,SqliteDatabase) are ever instantiated;createNamespaceis required onContractDefinition.What changed
SqlBoundNamespace/buildSqlNamespace/buildSqlNamespaceMap/fromTablesInput/SqlUnboundNamespace/ the'sql-namespace'kind. Renamed theSqlNamespaceTablesInputmisnomer →SqlNamespaceInput(it's thecreateNamespacefactory input, not a tables-only type).SqlNamespaceis abstract.SqlStorageInput.namespacesstays nominal (construction requires real concretions), whileSqlStorage.namespaces's read type is the structuralSqlNamespaceShapeso emitted.d.tscontract literals stay assignable (preserving the TML-2887: namespaceentriesbecomes an open, kind-keyed dictionary (ADR 224/225) #812 "emitted literals satisfy structurally" property that the nominal-class change would otherwise have broken).__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 thaninstanceof NamespaceBase, which false-negatives across the built-dist bundle boundary (the item-G realm-safety concern the ticket flagged).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.jsonwas already correct.fixtures:checkis byte-clean.Verification
main(TML-2916 namespace-defaulting + v0.14.0).typecheck --force138/138;test:packagesandtest:e2egreen;test:integrationclean modulo known parallel-load flakes + one network-dependent init-journey;fixtures:checkbyte-clean;lint/lint:depsclean; grep-clean of all deleted symbols.defaultNamespaceIdsurface; eliminated two avoidableblindCasts by typingcreateNamespaceas=> 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