fix(namespaces): per-namespace typed resolution for sql.<ns>.<table> and orm.<ns>.<Model>#803
fix(namespaces): per-namespace typed resolution for sql.<ns>.<table> and orm.<ns>.<Model>#803SevInf wants to merge 24 commits into
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughGenerated contract field maps were restructured to be namespace-scoped (e.g., ChangesNamespace-aware type maps and accessors
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
|
8ae10f7 to
189b20d
Compare
size-limit report 📦
|
@prisma-next/extension-author-tools
@prisma-next/mongo-runtime
@prisma-next/family-mongo
@prisma-next/sql-runtime
@prisma-next/family-sql
@prisma-next/extension-arktype-json
@prisma-next/middleware-cache
@prisma-next/mongo
@prisma-next/extension-paradedb
@prisma-next/extension-pgvector
@prisma-next/extension-postgis
@prisma-next/postgres
@prisma-next/sql-orm-client
@prisma-next/sqlite
@prisma-next/extension-supabase
@prisma-next/target-mongo
@prisma-next/adapter-mongo
@prisma-next/driver-mongo
@prisma-next/contract
@prisma-next/utils
@prisma-next/config
@prisma-next/errors
@prisma-next/framework-components
@prisma-next/operations
@prisma-next/ts-render
@prisma-next/contract-authoring
@prisma-next/ids
@prisma-next/psl-parser
@prisma-next/psl-printer
@prisma-next/cli
@prisma-next/cli-telemetry
@prisma-next/emitter
@prisma-next/migration-tools
prisma-next
@prisma-next/vite-plugin-contract-emit
@prisma-next/mongo-codec
@prisma-next/mongo-contract
@prisma-next/mongo-value
@prisma-next/mongo-contract-psl
@prisma-next/mongo-contract-ts
@prisma-next/mongo-emitter
@prisma-next/mongo-schema-ir
@prisma-next/mongo-query-ast
@prisma-next/mongo-orm
@prisma-next/mongo-query-builder
@prisma-next/mongo-lowering
@prisma-next/mongo-wire
@prisma-next/sql-contract
@prisma-next/sql-errors
@prisma-next/sql-operations
@prisma-next/sql-schema-ir
@prisma-next/sql-contract-psl
@prisma-next/sql-contract-ts
@prisma-next/sql-contract-emitter
@prisma-next/sql-lane-query-builder
@prisma-next/sql-relational-core
@prisma-next/sql-builder
@prisma-next/target-postgres
@prisma-next/target-sqlite
@prisma-next/adapter-postgres
@prisma-next/adapter-sqlite
@prisma-next/driver-postgres
@prisma-next/driver-sqlite
commit: |
|
|
||
| test('the public-namespace users facet can select its unique column `email`', () => { | ||
| const row = db.public.users.select('id', 'email').build(); | ||
| expectTypeOf(row).not.toBeNever(); |
There was a problem hiding this comment.
Use specific type here
66fab18 to
dfce81a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@skills/upgrade/prisma-next-upgrade/upgrades/0.13-to-0.14/instructions.md`:
- Around line 245-266: Remove the transient ticket/PR identifiers from the
upgrade guide text (specifically remove references to "TML-2886", "TML-2550",
and "PR `#813`") and replace them with stable, descriptive phrasing such as
"internal change: typed ALTER TABLE behavior" or "internal change: per-namespace
typed resolution"; add a short parenthetical saying "see changelog/release notes
for ticket/PR links" so readers can find details, and move the actual IDs and
links into the changelog or release notes instead of keeping them in
instructions.md.
🪄 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: f9e93313-9bf7-4647-88e1-90b9d8ba8158
⛔ Files ignored due to path filters (12)
examples/bundle-size/src/mongo/generated/contract.d.tsis excluded by!**/generated/**examples/bundle-size/src/postgres/generated/contract.d.tsis excluded by!**/generated/**packages/2-sql/4-lanes/sql-builder/test/fixtures/generated/contract.d.tsis excluded by!**/generated/**packages/3-extensions/sql-orm-client/test/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/e2e/framework/test/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/e2e/framework/test/sqlite/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/integration/test/mongo/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/integration/test/namespaced-accessors/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/integration/test/namespaced-accessors/fixtures/generated/contract.jsonis excluded by!**/generated/**test/integration/test/sql-builder/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/integration/test/sql-orm-client/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/integration/test/sql-orm-client/fixtures/polymorphism/generated/contract.d.tsis excluded by!**/generated/**
📒 Files selected for processing (82)
.gitignoreapps/telemetry-backend/src/prisma/contract.d.tsexamples/mongo-blog-leaderboard/src/contract.d.tsexamples/mongo-demo/migrations/app/20260409T1030_migration/end-contract.d.tsexamples/mongo-demo/migrations/app/20260415_add-posts-author-index/end-contract.d.tsexamples/mongo-demo/migrations/app/20260415_add-posts-author-index/start-contract.d.tsexamples/mongo-demo/src/contract.d.tsexamples/multi-extension-monorepo/app/src/contract.d.tsexamples/multi-extension-monorepo/packages/audit/src/contract.d.tsexamples/multi-extension-monorepo/packages/feature-flags/src/contract.d.tsexamples/paradedb-demo/src/prisma/contract.d.tsexamples/prisma-next-cloudflare-worker/src/prisma/contract.d.tsexamples/prisma-next-demo-sqlite/src/prisma/contract.d.tsexamples/prisma-next-demo/migrations/app/20260422T0720_initial/end-contract.d.tsexamples/prisma-next-demo/migrations/app/20260422T0742_migration/end-contract.d.tsexamples/prisma-next-demo/migrations/app/20260422T0742_migration/start-contract.d.tsexamples/prisma-next-demo/migrations/app/20260422T0748_migration/end-contract.d.tsexamples/prisma-next-demo/migrations/app/20260422T0748_migration/start-contract.d.tsexamples/prisma-next-demo/migrations/app/20260605T1145_mti_variant_link_columns/end-contract.d.tsexamples/prisma-next-demo/migrations/app/20260605T1145_mti_variant_link_columns/start-contract.d.tsexamples/prisma-next-demo/migrations/app/20260610T0000_add_priority_enum/end-contract.d.tsexamples/prisma-next-demo/migrations/app/20260610T0000_add_priority_enum/start-contract.d.tsexamples/prisma-next-demo/migrations/app/20260610T2216_set_priority_default/end-contract.d.tsexamples/prisma-next-demo/migrations/app/20260610T2216_set_priority_default/start-contract.d.tsexamples/prisma-next-demo/src/prisma/contract.d.tsexamples/prisma-next-demo/test/demo-dx.types.test.tsexamples/prisma-next-postgis-demo/migrations/app/20260512T1309_migration/end-contract.d.tsexamples/prisma-next-postgis-demo/src/prisma/contract.d.tsexamples/react-router-demo/src/prisma/contract.d.tsexamples/retail-store/migrations/app/20260513T0505_initial/end-contract.d.tsexamples/retail-store/migrations/app/20260513T0507_add_product_category_index/end-contract.d.tsexamples/retail-store/migrations/app/20260513T0507_add_product_category_index/start-contract.d.tsexamples/retail-store/migrations/app/20260513T0508_backfill_product_status/end-contract.d.tsexamples/retail-store/migrations/app/20260513T0508_backfill_product_status/start-contract.d.tsexamples/retail-store/src/contract.d.tsexamples/retail-store/src/data/events.tsexamples/retail-store/src/data/products.tsexamples/retail-store/src/data/users.tsexamples/supabase/src/contract.d.tspackages/1-framework/3-tooling/emitter/src/domain-type-generation.tspackages/1-framework/3-tooling/emitter/src/generate-contract-dts.tspackages/1-framework/3-tooling/emitter/test/generate-contract-dts.multi-namespace.test.tspackages/2-mongo-family/1-foundation/mongo-contract/src/contract-types.tspackages/2-mongo-family/1-foundation/mongo-contract/src/exports/index.tspackages/2-mongo-family/1-foundation/mongo-contract/test/contract-types.test-d.tspackages/2-mongo-family/1-foundation/mongo-contract/test/fixtures/orm-contract.d.tspackages/2-mongo-family/5-query-builders/orm/src/field-accessor.tspackages/2-mongo-family/5-query-builders/orm/src/types.tspackages/2-sql/1-core/contract/src/types.tspackages/2-sql/2-authoring/contract-ts/src/contract-types.tspackages/2-sql/2-authoring/contract-ts/test/enum-type.factory-form.test.tspackages/2-sql/2-authoring/contract-ts/test/enum-type.field-output.test.tspackages/2-sql/4-lanes/relational-core/src/types.tspackages/2-sql/4-lanes/relational-core/test/compute-column-js-type-namespace.types.test-d.tspackages/2-sql/4-lanes/sql-builder/src/runtime/table-proxy-impl.tspackages/2-sql/4-lanes/sql-builder/src/types/db.tspackages/2-sql/4-lanes/sql-builder/src/types/table-proxy.tspackages/2-sql/4-lanes/sql-builder/test/enum-type.field-output.test-d.tspackages/2-sql/4-lanes/sql-builder/test/types/namespace-unique-fields.types.test-d.tspackages/2-sql/4-lanes/sql-builder/test/types/namespaced-db.types.test-d.tspackages/2-sql/9-family/test/compute-column-js-type.test-d.tspackages/3-extensions/paradedb/src/contract.d.tspackages/3-extensions/pgvector/src/contract.d.tspackages/3-extensions/postgis/src/contract.d.tspackages/3-extensions/postgres/test/namespaced-facade.types.test-d.tspackages/3-extensions/sql-orm-client/src/collection-internal-types.tspackages/3-extensions/sql-orm-client/src/collection.tspackages/3-extensions/sql-orm-client/src/orm.tspackages/3-extensions/sql-orm-client/src/types.tspackages/3-extensions/sql-orm-client/test/annotations.types.test-d.tspackages/3-extensions/sql-orm-client/test/enum-type.field-output.test-d.tspackages/3-extensions/sql-orm-client/test/generated-contract-types.test-d.tspackages/3-extensions/sql-orm-client/test/orm-namespace-unique-fields.types.test-d.tspackages/3-extensions/sqlite/test/namespaced-facade.types.test-d.tspackages/3-extensions/supabase/src/contract/contract.d.tsskills/extension-author/prisma-next-extension-upgrade/upgrades/0.13-to-0.14/instructions.mdskills/upgrade/prisma-next-upgrade/upgrades/0.13-to-0.14/instructions.mdtest/integration/package.jsontest/integration/test/fixtures/contract.d.tstest/integration/test/namespaced-accessors-e2e.integration.test.tstest/integration/test/namespaced-accessors/fixtures/contract.tstest/integration/test/namespaced-accessors/fixtures/prisma-next.config.ts
✅ Files skipped from review due to trivial changes (14)
- packages/3-extensions/pgvector/src/contract.d.ts
- examples/mongo-demo/migrations/app/20260415_add-posts-author-index/start-contract.d.ts
- examples/prisma-next-postgis-demo/migrations/app/20260512T1309_migration/end-contract.d.ts
- examples/mongo-demo/src/contract.d.ts
- packages/3-extensions/postgres/test/namespaced-facade.types.test-d.ts
- examples/retail-store/src/contract.d.ts
- examples/prisma-next-demo-sqlite/src/prisma/contract.d.ts
- examples/prisma-next-demo/migrations/app/20260422T0748_migration/start-contract.d.ts
- test/integration/test/fixtures/contract.d.ts
- examples/mongo-blog-leaderboard/src/contract.d.ts
- skills/extension-author/prisma-next-extension-upgrade/upgrades/0.13-to-0.14/instructions.md
- examples/multi-extension-monorepo/packages/feature-flags/src/contract.d.ts
- examples/prisma-next-demo/migrations/app/20260422T0748_migration/end-contract.d.ts
- examples/paradedb-demo/src/prisma/contract.d.ts
🚧 Files skipped from review as they are similar to previous changes (62)
- packages/2-sql/2-authoring/contract-ts/test/enum-type.factory-form.test.ts
- test/integration/test/namespaced-accessors/fixtures/prisma-next.config.ts
- examples/prisma-next-postgis-demo/src/prisma/contract.d.ts
- packages/2-mongo-family/1-foundation/mongo-contract/src/exports/index.ts
- examples/retail-store/migrations/app/20260513T0508_backfill_product_status/start-contract.d.ts
- examples/retail-store/src/data/users.ts
- examples/mongo-demo/migrations/app/20260409T1030_migration/end-contract.d.ts
- packages/3-extensions/postgis/src/contract.d.ts
- examples/prisma-next-demo/migrations/app/20260422T0742_migration/end-contract.d.ts
- packages/3-extensions/sql-orm-client/test/annotations.types.test-d.ts
- examples/prisma-next-demo/migrations/app/20260610T2216_set_priority_default/end-contract.d.ts
- packages/3-extensions/sql-orm-client/src/collection-internal-types.ts
- packages/1-framework/3-tooling/emitter/src/domain-type-generation.ts
- test/integration/package.json
- examples/retail-store/migrations/app/20260513T0508_backfill_product_status/end-contract.d.ts
- apps/telemetry-backend/src/prisma/contract.d.ts
- examples/multi-extension-monorepo/app/src/contract.d.ts
- packages/3-extensions/sql-orm-client/src/orm.ts
- examples/retail-store/src/data/products.ts
- packages/2-mongo-family/5-query-builders/orm/src/types.ts
- examples/prisma-next-cloudflare-worker/src/prisma/contract.d.ts
- packages/3-extensions/paradedb/src/contract.d.ts
- examples/prisma-next-demo/migrations/app/20260605T1145_mti_variant_link_columns/end-contract.d.ts
- packages/2-sql/4-lanes/sql-builder/test/types/namespaced-db.types.test-d.ts
- examples/mongo-demo/migrations/app/20260415_add-posts-author-index/end-contract.d.ts
- packages/2-sql/4-lanes/sql-builder/test/enum-type.field-output.test-d.ts
- packages/2-mongo-family/1-foundation/mongo-contract/test/contract-types.test-d.ts
- .gitignore
- examples/prisma-next-demo/test/demo-dx.types.test.ts
- examples/prisma-next-demo/migrations/app/20260610T0000_add_priority_enum/start-contract.d.ts
- packages/2-mongo-family/1-foundation/mongo-contract/test/fixtures/orm-contract.d.ts
- examples/retail-store/migrations/app/20260513T0505_initial/end-contract.d.ts
- packages/2-sql/2-authoring/contract-ts/src/contract-types.ts
- examples/prisma-next-demo/migrations/app/20260605T1145_mti_variant_link_columns/start-contract.d.ts
- packages/1-framework/3-tooling/emitter/src/generate-contract-dts.ts
- examples/prisma-next-demo/src/prisma/contract.d.ts
- packages/2-sql/4-lanes/sql-builder/test/types/namespace-unique-fields.types.test-d.ts
- examples/multi-extension-monorepo/packages/audit/src/contract.d.ts
- examples/react-router-demo/src/prisma/contract.d.ts
- packages/2-mongo-family/5-query-builders/orm/src/field-accessor.ts
- packages/3-extensions/supabase/src/contract/contract.d.ts
- examples/prisma-next-demo/migrations/app/20260610T0000_add_priority_enum/end-contract.d.ts
- examples/prisma-next-demo/migrations/app/20260422T0720_initial/end-contract.d.ts
- examples/prisma-next-demo/migrations/app/20260610T2216_set_priority_default/start-contract.d.ts
- packages/2-sql/1-core/contract/src/types.ts
- packages/2-sql/4-lanes/sql-builder/src/types/db.ts
- packages/2-sql/2-authoring/contract-ts/test/enum-type.field-output.test.ts
- packages/1-framework/3-tooling/emitter/test/generate-contract-dts.multi-namespace.test.ts
- examples/retail-store/migrations/app/20260513T0507_add_product_category_index/start-contract.d.ts
- examples/supabase/src/contract.d.ts
- packages/2-sql/4-lanes/relational-core/src/types.ts
- examples/retail-store/migrations/app/20260513T0507_add_product_category_index/end-contract.d.ts
- examples/prisma-next-demo/migrations/app/20260422T0742_migration/start-contract.d.ts
- packages/3-extensions/sql-orm-client/test/orm-namespace-unique-fields.types.test-d.ts
- examples/retail-store/src/data/events.ts
- packages/2-sql/4-lanes/sql-builder/src/runtime/table-proxy-impl.ts
- test/integration/test/namespaced-accessors-e2e.integration.test.ts
- packages/2-sql/4-lanes/relational-core/test/compute-column-js-type-namespace.types.test-d.ts
- packages/2-mongo-family/1-foundation/mongo-contract/src/contract-types.ts
- packages/2-sql/4-lanes/sql-builder/src/types/table-proxy.ts
- packages/3-extensions/sql-orm-client/src/collection.ts
- packages/3-extensions/sql-orm-client/src/types.ts
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 1
🤖 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 `@skills/upgrade/prisma-next-upgrade/upgrades/0.13-to-0.14/instructions.md`:
- Around line 245-266: Remove the transient ticket/PR identifiers from the
upgrade guide text (specifically remove references to "TML-2886", "TML-2550",
and "PR `#813`") and replace them with stable, descriptive phrasing such as
"internal change: typed ALTER TABLE behavior" or "internal change: per-namespace
typed resolution"; add a short parenthetical saying "see changelog/release notes
for ticket/PR links" so readers can find details, and move the actual IDs and
links into the changelog or release notes instead of keeping them in
instructions.md.
🪄 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: f9e93313-9bf7-4647-88e1-90b9d8ba8158
⛔ Files ignored due to path filters (12)
examples/bundle-size/src/mongo/generated/contract.d.tsis excluded by!**/generated/**examples/bundle-size/src/postgres/generated/contract.d.tsis excluded by!**/generated/**packages/2-sql/4-lanes/sql-builder/test/fixtures/generated/contract.d.tsis excluded by!**/generated/**packages/3-extensions/sql-orm-client/test/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/e2e/framework/test/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/e2e/framework/test/sqlite/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/integration/test/mongo/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/integration/test/namespaced-accessors/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/integration/test/namespaced-accessors/fixtures/generated/contract.jsonis excluded by!**/generated/**test/integration/test/sql-builder/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/integration/test/sql-orm-client/fixtures/generated/contract.d.tsis excluded by!**/generated/**test/integration/test/sql-orm-client/fixtures/polymorphism/generated/contract.d.tsis excluded by!**/generated/**
📒 Files selected for processing (82)
.gitignoreapps/telemetry-backend/src/prisma/contract.d.tsexamples/mongo-blog-leaderboard/src/contract.d.tsexamples/mongo-demo/migrations/app/20260409T1030_migration/end-contract.d.tsexamples/mongo-demo/migrations/app/20260415_add-posts-author-index/end-contract.d.tsexamples/mongo-demo/migrations/app/20260415_add-posts-author-index/start-contract.d.tsexamples/mongo-demo/src/contract.d.tsexamples/multi-extension-monorepo/app/src/contract.d.tsexamples/multi-extension-monorepo/packages/audit/src/contract.d.tsexamples/multi-extension-monorepo/packages/feature-flags/src/contract.d.tsexamples/paradedb-demo/src/prisma/contract.d.tsexamples/prisma-next-cloudflare-worker/src/prisma/contract.d.tsexamples/prisma-next-demo-sqlite/src/prisma/contract.d.tsexamples/prisma-next-demo/migrations/app/20260422T0720_initial/end-contract.d.tsexamples/prisma-next-demo/migrations/app/20260422T0742_migration/end-contract.d.tsexamples/prisma-next-demo/migrations/app/20260422T0742_migration/start-contract.d.tsexamples/prisma-next-demo/migrations/app/20260422T0748_migration/end-contract.d.tsexamples/prisma-next-demo/migrations/app/20260422T0748_migration/start-contract.d.tsexamples/prisma-next-demo/migrations/app/20260605T1145_mti_variant_link_columns/end-contract.d.tsexamples/prisma-next-demo/migrations/app/20260605T1145_mti_variant_link_columns/start-contract.d.tsexamples/prisma-next-demo/migrations/app/20260610T0000_add_priority_enum/end-contract.d.tsexamples/prisma-next-demo/migrations/app/20260610T0000_add_priority_enum/start-contract.d.tsexamples/prisma-next-demo/migrations/app/20260610T2216_set_priority_default/end-contract.d.tsexamples/prisma-next-demo/migrations/app/20260610T2216_set_priority_default/start-contract.d.tsexamples/prisma-next-demo/src/prisma/contract.d.tsexamples/prisma-next-demo/test/demo-dx.types.test.tsexamples/prisma-next-postgis-demo/migrations/app/20260512T1309_migration/end-contract.d.tsexamples/prisma-next-postgis-demo/src/prisma/contract.d.tsexamples/react-router-demo/src/prisma/contract.d.tsexamples/retail-store/migrations/app/20260513T0505_initial/end-contract.d.tsexamples/retail-store/migrations/app/20260513T0507_add_product_category_index/end-contract.d.tsexamples/retail-store/migrations/app/20260513T0507_add_product_category_index/start-contract.d.tsexamples/retail-store/migrations/app/20260513T0508_backfill_product_status/end-contract.d.tsexamples/retail-store/migrations/app/20260513T0508_backfill_product_status/start-contract.d.tsexamples/retail-store/src/contract.d.tsexamples/retail-store/src/data/events.tsexamples/retail-store/src/data/products.tsexamples/retail-store/src/data/users.tsexamples/supabase/src/contract.d.tspackages/1-framework/3-tooling/emitter/src/domain-type-generation.tspackages/1-framework/3-tooling/emitter/src/generate-contract-dts.tspackages/1-framework/3-tooling/emitter/test/generate-contract-dts.multi-namespace.test.tspackages/2-mongo-family/1-foundation/mongo-contract/src/contract-types.tspackages/2-mongo-family/1-foundation/mongo-contract/src/exports/index.tspackages/2-mongo-family/1-foundation/mongo-contract/test/contract-types.test-d.tspackages/2-mongo-family/1-foundation/mongo-contract/test/fixtures/orm-contract.d.tspackages/2-mongo-family/5-query-builders/orm/src/field-accessor.tspackages/2-mongo-family/5-query-builders/orm/src/types.tspackages/2-sql/1-core/contract/src/types.tspackages/2-sql/2-authoring/contract-ts/src/contract-types.tspackages/2-sql/2-authoring/contract-ts/test/enum-type.factory-form.test.tspackages/2-sql/2-authoring/contract-ts/test/enum-type.field-output.test.tspackages/2-sql/4-lanes/relational-core/src/types.tspackages/2-sql/4-lanes/relational-core/test/compute-column-js-type-namespace.types.test-d.tspackages/2-sql/4-lanes/sql-builder/src/runtime/table-proxy-impl.tspackages/2-sql/4-lanes/sql-builder/src/types/db.tspackages/2-sql/4-lanes/sql-builder/src/types/table-proxy.tspackages/2-sql/4-lanes/sql-builder/test/enum-type.field-output.test-d.tspackages/2-sql/4-lanes/sql-builder/test/types/namespace-unique-fields.types.test-d.tspackages/2-sql/4-lanes/sql-builder/test/types/namespaced-db.types.test-d.tspackages/2-sql/9-family/test/compute-column-js-type.test-d.tspackages/3-extensions/paradedb/src/contract.d.tspackages/3-extensions/pgvector/src/contract.d.tspackages/3-extensions/postgis/src/contract.d.tspackages/3-extensions/postgres/test/namespaced-facade.types.test-d.tspackages/3-extensions/sql-orm-client/src/collection-internal-types.tspackages/3-extensions/sql-orm-client/src/collection.tspackages/3-extensions/sql-orm-client/src/orm.tspackages/3-extensions/sql-orm-client/src/types.tspackages/3-extensions/sql-orm-client/test/annotations.types.test-d.tspackages/3-extensions/sql-orm-client/test/enum-type.field-output.test-d.tspackages/3-extensions/sql-orm-client/test/generated-contract-types.test-d.tspackages/3-extensions/sql-orm-client/test/orm-namespace-unique-fields.types.test-d.tspackages/3-extensions/sqlite/test/namespaced-facade.types.test-d.tspackages/3-extensions/supabase/src/contract/contract.d.tsskills/extension-author/prisma-next-extension-upgrade/upgrades/0.13-to-0.14/instructions.mdskills/upgrade/prisma-next-upgrade/upgrades/0.13-to-0.14/instructions.mdtest/integration/package.jsontest/integration/test/fixtures/contract.d.tstest/integration/test/namespaced-accessors-e2e.integration.test.tstest/integration/test/namespaced-accessors/fixtures/contract.tstest/integration/test/namespaced-accessors/fixtures/prisma-next.config.ts
✅ Files skipped from review due to trivial changes (14)
- packages/3-extensions/pgvector/src/contract.d.ts
- examples/mongo-demo/migrations/app/20260415_add-posts-author-index/start-contract.d.ts
- examples/prisma-next-postgis-demo/migrations/app/20260512T1309_migration/end-contract.d.ts
- examples/mongo-demo/src/contract.d.ts
- packages/3-extensions/postgres/test/namespaced-facade.types.test-d.ts
- examples/retail-store/src/contract.d.ts
- examples/prisma-next-demo-sqlite/src/prisma/contract.d.ts
- examples/prisma-next-demo/migrations/app/20260422T0748_migration/start-contract.d.ts
- test/integration/test/fixtures/contract.d.ts
- examples/mongo-blog-leaderboard/src/contract.d.ts
- skills/extension-author/prisma-next-extension-upgrade/upgrades/0.13-to-0.14/instructions.md
- examples/multi-extension-monorepo/packages/feature-flags/src/contract.d.ts
- examples/prisma-next-demo/migrations/app/20260422T0748_migration/end-contract.d.ts
- examples/paradedb-demo/src/prisma/contract.d.ts
🚧 Files skipped from review as they are similar to previous changes (62)
- packages/2-sql/2-authoring/contract-ts/test/enum-type.factory-form.test.ts
- test/integration/test/namespaced-accessors/fixtures/prisma-next.config.ts
- examples/prisma-next-postgis-demo/src/prisma/contract.d.ts
- packages/2-mongo-family/1-foundation/mongo-contract/src/exports/index.ts
- examples/retail-store/migrations/app/20260513T0508_backfill_product_status/start-contract.d.ts
- examples/retail-store/src/data/users.ts
- examples/mongo-demo/migrations/app/20260409T1030_migration/end-contract.d.ts
- packages/3-extensions/postgis/src/contract.d.ts
- examples/prisma-next-demo/migrations/app/20260422T0742_migration/end-contract.d.ts
- packages/3-extensions/sql-orm-client/test/annotations.types.test-d.ts
- examples/prisma-next-demo/migrations/app/20260610T2216_set_priority_default/end-contract.d.ts
- packages/3-extensions/sql-orm-client/src/collection-internal-types.ts
- packages/1-framework/3-tooling/emitter/src/domain-type-generation.ts
- test/integration/package.json
- examples/retail-store/migrations/app/20260513T0508_backfill_product_status/end-contract.d.ts
- apps/telemetry-backend/src/prisma/contract.d.ts
- examples/multi-extension-monorepo/app/src/contract.d.ts
- packages/3-extensions/sql-orm-client/src/orm.ts
- examples/retail-store/src/data/products.ts
- packages/2-mongo-family/5-query-builders/orm/src/types.ts
- examples/prisma-next-cloudflare-worker/src/prisma/contract.d.ts
- packages/3-extensions/paradedb/src/contract.d.ts
- examples/prisma-next-demo/migrations/app/20260605T1145_mti_variant_link_columns/end-contract.d.ts
- packages/2-sql/4-lanes/sql-builder/test/types/namespaced-db.types.test-d.ts
- examples/mongo-demo/migrations/app/20260415_add-posts-author-index/end-contract.d.ts
- packages/2-sql/4-lanes/sql-builder/test/enum-type.field-output.test-d.ts
- packages/2-mongo-family/1-foundation/mongo-contract/test/contract-types.test-d.ts
- .gitignore
- examples/prisma-next-demo/test/demo-dx.types.test.ts
- examples/prisma-next-demo/migrations/app/20260610T0000_add_priority_enum/start-contract.d.ts
- packages/2-mongo-family/1-foundation/mongo-contract/test/fixtures/orm-contract.d.ts
- examples/retail-store/migrations/app/20260513T0505_initial/end-contract.d.ts
- packages/2-sql/2-authoring/contract-ts/src/contract-types.ts
- examples/prisma-next-demo/migrations/app/20260605T1145_mti_variant_link_columns/start-contract.d.ts
- packages/1-framework/3-tooling/emitter/src/generate-contract-dts.ts
- examples/prisma-next-demo/src/prisma/contract.d.ts
- packages/2-sql/4-lanes/sql-builder/test/types/namespace-unique-fields.types.test-d.ts
- examples/multi-extension-monorepo/packages/audit/src/contract.d.ts
- examples/react-router-demo/src/prisma/contract.d.ts
- packages/2-mongo-family/5-query-builders/orm/src/field-accessor.ts
- packages/3-extensions/supabase/src/contract/contract.d.ts
- examples/prisma-next-demo/migrations/app/20260610T0000_add_priority_enum/end-contract.d.ts
- examples/prisma-next-demo/migrations/app/20260422T0720_initial/end-contract.d.ts
- examples/prisma-next-demo/migrations/app/20260610T2216_set_priority_default/start-contract.d.ts
- packages/2-sql/1-core/contract/src/types.ts
- packages/2-sql/4-lanes/sql-builder/src/types/db.ts
- packages/2-sql/2-authoring/contract-ts/test/enum-type.field-output.test.ts
- packages/1-framework/3-tooling/emitter/test/generate-contract-dts.multi-namespace.test.ts
- examples/retail-store/migrations/app/20260513T0507_add_product_category_index/start-contract.d.ts
- examples/supabase/src/contract.d.ts
- packages/2-sql/4-lanes/relational-core/src/types.ts
- examples/retail-store/migrations/app/20260513T0507_add_product_category_index/end-contract.d.ts
- examples/prisma-next-demo/migrations/app/20260422T0742_migration/start-contract.d.ts
- packages/3-extensions/sql-orm-client/test/orm-namespace-unique-fields.types.test-d.ts
- examples/retail-store/src/data/events.ts
- packages/2-sql/4-lanes/sql-builder/src/runtime/table-proxy-impl.ts
- test/integration/test/namespaced-accessors-e2e.integration.test.ts
- packages/2-sql/4-lanes/relational-core/test/compute-column-js-type-namespace.types.test-d.ts
- packages/2-mongo-family/1-foundation/mongo-contract/src/contract-types.ts
- packages/2-sql/4-lanes/sql-builder/src/types/table-proxy.ts
- packages/3-extensions/sql-orm-client/src/collection.ts
- packages/3-extensions/sql-orm-client/src/types.ts
🛑 Comments failed to post (1)
skills/upgrade/prisma-next-upgrade/upgrades/0.13-to-0.14/instructions.md (1)
245-266:
⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAvoid transient ticket IDs in the upgrade guide.
This note embeds
TML-2550andPR#813`` in durable docs, which will age poorly. Keep the stable upgrade guidance here and move ticket/PR references to changelog or release notes.Based on learnings: durable docs should not reference transient project artifacts.
🤖 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 `@skills/upgrade/prisma-next-upgrade/upgrades/0.13-to-0.14/instructions.md` around lines 245 - 266, Remove the transient ticket/PR identifiers from the upgrade guide text (specifically remove references to "TML-2886", "TML-2550", and "PR `#813`") and replace them with stable, descriptive phrasing such as "internal change: typed ALTER TABLE behavior" or "internal change: per-namespace typed resolution"; add a short parenthetical saying "see changelog/release notes for ticket/PR links" so readers can find details, and move the actual IDs and links into the changelog or release notes instead of keeping them in instructions.md.Source: Learnings
…inate ExtractTableToModel, ExtractColumnToField, and ComputeColumnJsType now take a required namespace coordinate and resolve table->model->column within the per-namespace domain and storage blocks (domain.namespaces[NsId].models, storage.namespaces[NsId].entries.table) instead of scanning the flat cross-namespace model map. The output JS type is derived from the per-namespace storage column codecId via CodecTypes, so a bare table name shared across namespaces resolves to each namespace own column rather than the per-namespace intersection. Adds a type-test proving a two-namespace contract whose same bare table name carries different columns per namespace resolves each namespace own column type, and never for a column absent in that namespace. Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
The refined (typeParam-applied) output/input field types previously lived
only in a flat, first-name-wins {model: {field}} map, so per-namespace
resolution either lost the refinement or collapsed same-named models across
namespaces. Nest the emitted FieldOutputTypes/FieldInputTypes by namespace
coordinate ({ns: {model: {field}}}), mirroring how domain.namespaces[ns] is
already emitted and reusing the existing per-model renderOutputTypeFor
refinement, so a parameterized column keeps its refined type (e.g. Vector<N>,
Char<36>) under its own namespace.
- emitter: add generateFieldTypesMapsByNamespace wrapping the per-model
builder per namespace; wire it into generate-contract-dts.
- sql-contract: TypeMaps / FieldOutputTypesOf / FieldInputTypesOf accept the
three-level nested shape.
- Regenerate all emitted contract.d.ts fixtures to the nested baseline. Only
the .d.ts type shape changes; contract.json data and hashes are unchanged.
Mongo is single-namespace and nests harmlessly under __unbound__; its row
inference reads ContractModelDefinitions + codecs, not these maps, and its
two-level MongoTypeMaps constraint still accepts the nested shape.
Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…ce-nested FieldOutputTypes ComputeColumnJsType now resolves a column to its refined JS output via the emitter-emitted namespace-nested FieldOutputTypes[NsId][Model][Field] map, keyed by the required namespace coordinate, replacing the interim codec-base path. The table->model and column->field mapping is resolved per-namespace from domain.namespaces[NsId].models; a storage column not backed by a model field falls back to a codec-output lookup, and a column absent in the namespace resolves to never. This preserves parameterized codec refinements (e.g. Vector<N>, Char<N>) that the codec-base path dropped, while keeping same-bare-table-name collisions resolving each namespace own field. - relational-core type-test: assert a parameterized column keeps its refined type per-namespace (not the bare codec output) and the collision resolves each namespace own field. - family-sql direct test: rework to the namespace-aware signature with refined expectations plus a codec-fallback case. Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
TableProxy now carries a required namespace-coordinate type parameter (TableProxy<C, NsId, Name>); Namespace<C, NsId> threads NsId into each table proxy. The proxy derives its selectable columns (scope) from the exact per-namespace storage table (storage.namespaces[NsId].entries.table[Name]) rather than the cross-namespace UnboundTables union, and its column output/input types from the namespace coordinate via ComputeColumnJsType / FieldOutputTypes[NsId] / FieldInputTypes[NsId] / domain.namespaces[NsId]. So a bare table name shared across namespaces resolves to each namespace own columns: each namespace unique column is selectable through its own facet, and the other namespace unique column is not. UnboundTables / TableInAnyNamespace remain defined for other consumers; only the facet column resolution stops depending on them. The runtime TableProxyImpl implements TableProxy<C, string, Name, ...> (namespace coordinate erased at runtime, already threaded as namespaceId). - commit the now-green namespace-unique-fields anchor type-test. - update namespaced-db type-test to the coordinate-keyed signature. Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
… coordinate The OrmNamespace mapping threads the namespace coordinate into the row of each model collection: ModelCollection resolves InferRootRow at the namespace coordinate, so a bare model name shared across namespaces resolves each namespace its own fields (the per-namespace domain.namespaces[NsId] block + the nested FieldOutputTypes[NsId] map) rather than the flat first-name-wins ContractModelDefinitions map. The resolution chain in types.ts (ModelDef / FieldsOf / ModelTableName / FieldColumnName / NamespaceTableDef / ResolvedStorageColumn / FieldJsType / DefaultModelRow / InferRootRow + where/numeric helpers) now takes an optional namespace coordinate (defaulting to the model storage own namespace via ResolvedNsId), and the read row resolves its field types directly from the emitter nested FieldOutputTypes[ns][model][field] map (carrying value objects + refined codecs + nullability), falling back to the codec path for fields absent from that map. This also fixes FieldStorageJsType, which called the pre-coordinate ComputeColumnJsType signature. - commit the now-green orm-namespace-unique-fields anchor type-test. - nest the manual FieldOutputTypes fixtures in generated-contract-types to the namespace-keyed shape the emitter now emits. Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…-namespace Thread the namespace coordinate carried on CollectionTypeState.nsId through the create/update/where input helpers so a model reached via orm.<ns>.<Model> resolves its fields within its own namespace, matching the read row. Under a same-bare-model-name collision each namespace facet now accepts its own fields and rejects the other namespace's, instead of the flat first-name-wins ModelsOf map governing input resolution. A directly-constructed collection keeps nsId: never, so single-namespace input shapes are unchanged. Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…nd namespace Re-point MongoModelsMap at the contract's sole domain namespace (domain.namespaces[UNBOUND_NAMESPACE_ID].models) via the framework sentinel, and route RootModelName and InferModelRow through it so no Mongo type reads the flat ContractModelDefinitions union directly. Reconcile the D1 emitter change that nests FieldOutputTypes/FieldInputTypes by namespace id: add MongoUnboundFieldOutputTypes/MongoUnboundFieldInputTypes, which read the per-model refined map under UNBOUND_NAMESPACE_ID (falling back to a pre-nesting flat map). ResolvedModelRow, ResolvedOutputRow and ResolvedInputRow consume these so a Mongo refined row (including any parameterized field) no longer silently degrades to the codec fallback when the emitted map is namespace-nested. Inferred row types are unchanged. Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
D1 nested the emitted FieldOutputTypes/FieldInputTypes by namespace and regenerated the SQL + example contract.d.ts, but missed this mongo test fixture. Re-emit it via the orm-fixture generator so its TypeMaps match the current emitter (per-model maps now nested under __unbound__). Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…pe helpers With the mongo fixture now on the nested TypeMaps shape, every emitted contract nests its field-type maps by namespace, so the pre-nesting flat-map fallback in MongoUnboundFieldOutputTypes/MongoUnboundFieldInputTypes is unreachable. Resolve to never (read by the row resolvers as no refined map -> codec fallback) instead of reading a flat map. Drop the now-obsolete flat back-compat type-test. Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
The framework TypeMaps FieldOutputTypes/FieldInputTypes slots are nested by namespace id (Record<string, Record<string, Record<string, unknown>>>), but the SQL TS-authoring contract type still produced a flat model->field map, so SqlContractResult no longer satisfied the constraint. Nest the per-model map under the target default storage namespace (matching how BuiltStorage lumps every model under that coordinate). Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
TableProxy gained a leading NsId type parameter, and the emitted FieldInputTypes/FieldOutputTypes are now nested by namespace id. Update the postgres/sqlite namespaced-facade type-tests to the TableProxy<C, NsId, Name> arity, and index the retail-store example data helpers through the unbound namespace coordinate. Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Author (via buildSqlContractFromDefinition) and emit a same-bare-table-name
two-namespace contract: public.users {id,email} + auth.users {id,token} with a
cross-namespace FK public.profile.user_id -> auth.users.id and a public.Profile
.user relation to auth.User. Emitting it to a committed contract.json +
contract.d.ts gives the namespaced-accessors integration test a precise
per-namespace Contract type to type-check against. Wired into the package emit
so fixtures:check re-emits it deterministically.
Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Un-ignore namespaced-accessors/fixtures/generated (mirroring the mongo fixture exception) and commit the emitted contract.json + contract.d.ts so the namespaced-accessors integration test type-checks against the precise per-namespace Contract and fixtures:check can detect drift. Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…s + relations Un-casting the namespaced e2e test surfaced three facet-resolution gaps the runtime-view casts had hidden: - CollectionModelName read the flat ModelsOf map, which keys a cross-namespace union to its shared names and dropped a model unique to one namespace (e.g. public.Profile) under a same-bare-name collision. Read the union of every namespace block. - updateCount did not thread State[nsId] into its DefaultModelRow, so a facet collections updateCount resolved the flat (collision-collapsed) row. - The relation/include chain (ModelRelations -> RelationsOf -> RelationNames / RelatedModelName / RelationCardinality / IsToManyRelation / IncludeRelationValue) read flat ModelDef, so a facet could not name its relations, and a cross-namespace include resolved the related row at the parent namespace. Thread an additive NsId coordinate (default never preserves the non-facet shape) and resolve the included row at the relations target namespace via a new RelationTargetNamespace. Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
… Contract
Drive postgres<Contract>({ contractJson }) from the committed two-namespace
fixture and drop the blindCast SqlView/OrmView/LoweredAdapter views. db.sql and
db.orm are now precisely typed per-namespace: public.users exposes email and
auth.users exposes token (and the reverse is a compile error, asserted with
ts-expect-error), and the cross-namespace Profile.user include resolves the
auth.User row. Runtime assertions are unchanged.
Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…n (F1) The no-coordinate (NsId = never) branch of ModelDef, AllModelRelationEntries, and the VariantRow/VariantModelRow model-name guards still read the flat ContractModelDefinitions / ModelsOf map, a reachable path that violated the required-coordinate invariant. Resolve those by scanning every domain.namespaces[ns].models block instead (the same flat-map-free scan used by CollectionModelName): for a single-namespace contract the scan of the sole namespace is byte-for-byte identical to the old flat read. Remove the ModelsOf alias and the ContractModelDefinitions import so no internal resolver reads the flat map. Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Mains enum work (#769) renders enum value unions into the field-type maps; our slice nests those maps by namespace id. Reconcile the enum type-tests to the nested shape: index ExtractFieldOutputTypes/InputTypes through the default namespace (public) or the fixtures __unbound__ coordinate, and pass the NsId coordinate to ContractToQC. Enum value unions still resolve per-namespace; no flat-map read reintroduced. Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…pe-test after rebase Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…structions Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…regression anchor Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
| nsId, | ||
| blindCast< | ||
| Record<string, ContractModel>, | ||
| 'ns.models is a ContractModel record in the emitted IR' |
There was a problem hiding this comment.
That does not really answer the question of why type cast is needed. Why isn't ns.models compatible with Record<string, ContractModel>?
| // so we check that emailAddress is present (it must appear twice: in the flatten and | ||
| // in the per-namespace auth block) and that roleLabel only appears once (per-namespace | ||
| // public block only, not in the flattened top-level models). | ||
| // The flattened top-level models type is still first-name-wins (auth's User), but the |
There was a problem hiding this comment.
Why do we still have flattened top level models?
| TQueryOperationTypes extends Record<string, unknown> = Record<string, never>, | ||
| TFieldOutputTypes extends Record<string, Record<string, unknown>> = Record<string, never>, | ||
| TFieldInputTypes extends Record<string, Record<string, unknown>> = Record<string, never>, | ||
| TFieldOutputTypes extends Record<string, Record<string, Record<string, unknown>>> = Record< |
There was a problem hiding this comment.
Can we split Record<string, Record<string, Record<string, unknown>> to a separate named type and use it here and below?
| return this.#toJoined().lateralJoin(alias, builder); | ||
| }, | ||
| ) as TableProxy<C, Name, Alias, AvailableScope, QC>['lateralJoin']; | ||
| ) as TableProxy<C, string, Name, Alias, AvailableScope, QC>['lateralJoin']; |
There was a problem hiding this comment.
Why aren't we forwarding NsId here?
| NsId extends string, | ||
| TableName extends string, | ||
| > = | ||
| C extends Contract<SqlStorage> |
There was a problem hiding this comment.
Expand TableProxyContract to not have to do this check
| ModelName extends string, | ||
| ColumnName extends string, | ||
| > = | ||
| C extends Contract<SqlStorage> |
There was a problem hiding this comment.
Expand TableProxyContract to not have to do this check
| : Record<string, never> | ||
| : Record<string, never> | ||
| > = | ||
| C extends Contract<SqlStorage> |
There was a problem hiding this comment.
Expand TableProxyContract to not have to do this check
| }; | ||
| }; | ||
|
|
||
| // Field-type maps are nested by namespace coordinate; this fixture's models |
There was a problem hiding this comment.
I have eyes, I can see that, I don't need this comment
… (ADR 224/225) Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
3a960a9 to
3058eae
Compare
- contract: extract NamespacedFieldTypeMap and reuse it for the TypeMaps output/input params and their *Of extractors (pure refactor). - emitter: eliminate the ns.models blindCasts by typing the model-emit helpers (generateModelsType / generateFieldTypesMapsByNamespace / FieldTypeParamsResolver) and the EmissionSpi to ContractModelBase, the type ApplicationDomainNamespace.models actually carries. ContractModel adds nothing structurally over ContractModelBase, so this is behaviour- identical and drops the casts. - sql-builder: carry domain on TableProxyContract so FindModelForTable / FindFieldForColumn index C directly without a Contract<SqlStorage> guard. ResolvedColumnTypes keeps the guard (documented): it is required by ComputeColumnJsType, whose constraint lives in sql-relational-core. - sql-builder: thread NsId through TableProxyImpl so as()/lateralJoin/ outerLateralJoin forward the real coordinate instead of hardcoding string; the runtime Proxy boundary still defaults NsId to string (no static literal), now documented. - tests: delete a redundant comment; answer "why keep the flat models" inline in the multi-namespace emitter test. Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…tire the last TableProxyContract guard Define the minimal ColumnResolutionContract (per-namespace domain.models + storage.entries.table; the refined field-output map is read structurally via the optional TypeMaps phantom key) and relax ComputeColumnJsType and its six helper aliases from Contract<SqlStorage> to it. Every emitted Contract<SqlStorage> satisfies the shape, as does sql-builder TableProxyContract, so ResolvedColumnTypes indexes C directly and drops its C extends Contract<SqlStorage> guard -- the last of the three. Resolution stays per-namespace; no flat map is read. Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Fixes the namespaced DSL/ORM accessors dropping the namespace coordinate at the type level: when two namespaces declared the same bare table/model name with different fields, neither namespace’s unique fields were usable in queries (runtime worked, typechecks failed).
Root cause
The emitted contract carried per-namespace
domain/storageblocks, but the DSL/ORM type machinery resolved field/column types through the flat, first-name-wins maps (ContractModelDefinitions/ModelsOf,UnboundTables-union, flatFieldOutputTypes). The facet types (Namespace<C,NsId>,OrmNamespace<C,_,NsId>) carried the coordinate but dropped it when delegating toTableProxy/Collection.Approach (emitter-first)
Made the emitted output/input TypeMaps namespace-aware (
FieldOutputTypes[ns][model][field]), mirroring howdomain.namespacesis already emitted, then re-anchored every SQL resolution path onto the namespace coordinate. This keeps typeParam-refined outputs (Vector<N>,Char<N>) correct AND per-namespace, and makes the flat maps vestigial internally.FieldOutputTypes/FieldInputTypesby namespace; all SQL fixtures regenerated.TableProxy/Collectioncarry a requiredNsId; column/field/model types resolve fromdomain.namespaces[NsId]+storage.namespaces[NsId]+ nestedFieldOutputTypes[NsId]. No internal resolution reads the flat map.MongoModelsMapreads its sole (__unbound__) namespace; row resolution reconciled with the nested maps.updateCount, cross-namespaceinclude).Validation
Workspace typecheck 138/138;
pnpm test:packages10042 passed (0 type errors; the only failures are sandbox-environmental — mongo-memory-server binary fetch + CLI spawn timeouts); namespaced integration 2/2 (real DB, cross-namespace FK);pnpm fixtures:checkclean;pnpm lint:depsclean. Two committed type-anchors + a two-namespace integration fixture prove per-namespace resolution; a consolidated review passed (one must-fix found + fixed: the last flat-map read on the non-facet branch).Follow-ups (out of scope)
Retiring
ContractModelDefinitions/ the publicModelsexport entirely (now internally vestigial). Spec + dispatch history underprojects/explicit-namespace-dsl/specs/namespace-coordinate-typed-resolution.spec.md.Summary by CodeRabbit
New Features
Refactor
Tests
Documentation
Chores