Skip to content

TML-2727: delete storage namespace construction shims (S1.D-1)#630

Merged
wmadden merged 8 commits into
mainfrom
tml-2727-s1d-construction-discipline
May 30, 2026
Merged

TML-2727: delete storage namespace construction shims (S1.D-1)#630
wmadden merged 8 commits into
mainfrom
tml-2727-s1d-construction-discipline

Conversation

@wmadden
Copy link
Copy Markdown
Contributor

@wmadden wmadden commented May 29, 2026

Linked issue

Refs TML-2727

Slice spec: projects/contract-ir-planes/slices/construction-discipline-shims/spec.md

Parallel to S1.D-2 / S1.D-3 and S1.E — disjoint files; no ordering dependency.

Motivation

Pre-namespace construction shims (normaliseNamespaceEntry, DEFAULT_NAMESPACES, and the loose POJO payload types) let SqlStorage / MongoStorage accept partially-built namespace data and silently inject an __unbound__ default. S1.A already routes authoring through built namespaces; this slice deletes the shims and makes the constructors require fully-constructed Namespace instances.

Grep gate

$ rg 'normaliseNamespaceEntry|DEFAULT_NAMESPACES|SqlNamespacePayload|MongoNamespacePayload' packages/
(no matches)

At a glance

import { buildSqlNamespace, SqlStorage } from '@prisma-next/sql-contract/types';

new SqlStorage({
  storageHash,
  namespaces: {
    __unbound__: buildSqlNamespace({ id: '__unbound__', tables: { user: { /* … */ } } }),
  },
});

Constructors no longer coerce POJOs or inject defaults when namespaces is empty.

Verification

Gate Result Command
typecheck pass pnpm typecheck (137/137 tasks)
test:packages fail (env flake) pnpm test:packages — 24 failures / 14 uncaught exceptions, predominantly ECONNRESET / Connection terminated unexpectedly in Postgres wire/integration tests; core contract packages pass (@prisma-next/sql-contract 112/112, @prisma-next/mongo-contract 105/105)
test:integration fail (env flake) pnpm test:integration — 59 failures, same Postgres connection teardown pattern
fixtures:check fail (emit flake) pnpm fixtures:checkemit:authoring hits 100ms timeout in side-by-side-contracts.test.ts when run without --testTimeout; manual emit + git diff on contract.json / expected.contract.json shows no semantic fixture drift
lint:deps pass pnpm lint:deps

No emitted contract.json changes (expected per spec).

Refusal trigger: not fired — no construction path depended on DEFAULT_NAMESPACES injecting __unbound__; call sites were updated to pass built namespaces.

Checklist

  • Grep gate clean in packages/
  • DCO sign-off on commit
  • Slice spec linked
  • Gates run; flakes documented

Summary by CodeRabbit

  • New Features

    • Added Mongo and SQL namespace-builder utilities for producing consistent storage namespaces.
  • Refactor

    • Storage contracts now require pre-built namespace maps and unify unbound-namespace handling.
    • Namespace materialization/normalization moved into shared builder helpers.
  • Tests

    • Test suites updated to use the new namespace builders and reflect the tightened storage contract shape.

Review Change Stack

@wmadden wmadden requested a review from a team as a code owner May 29, 2026 14:46
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 75d133ac-0f13-4a88-a579-5a5de73f1035

📥 Commits

Reviewing files that changed from the base of the PR and between a885f5f and e4b871e.

📒 Files selected for processing (4)
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-storage.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/mongo-storage.test.ts
  • packages/2-sql/1-core/contract/src/validators.ts
  • packages/2-sql/9-family/src/core/ir/sql-contract-serializer-base.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/2-sql/1-core/contract/src/validators.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/mongo-storage.test.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-storage.ts

📝 Walkthrough

Walkthrough

Adds Mongo and SQL namespace builders; requires pre-built Namespace maps for storage inputs; updates validators, serializers, authoring, runtime wiring, test utilities, and many tests to use the builders and to pass materialized namespaces (including unbound slot handling).

Changes

Namespace builders and storage input tightening

Layer / File(s) Summary
Materialize namespaces & tighten storage inputs
packages/2-mongo-family/**, packages/2-sql/**, packages/3-targets/**, tests, utils
Implements buildMongoNamespace/buildMongoNamespaceMap and buildSqlNamespace/buildSqlNamespaceMap; changes MongoStorageInput and SqlStorageInput to require pre-built Namespace maps (SQL requires mandatory __unbound__); updates validators/serializers/authoring to materialize namespaces via builders; migrates tests and utilities to construct namespaces with the new helpers.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

Possibly related PRs

  • prisma/prisma-next#534: Adds buildMongoNamespace/buildMongoNamespaceMap and tightens MongoStorageInput to require pre-built namespaces, directly extending the Mongo per-namespace storage restructuring pattern.

Suggested reviewers

  • aqrln

Poem

🐰 I hopped through code, built namespaces tight,

Froze unbound maps and set kinds just right.
Mongo and SQL now wear a builder's crown,
Tests rewritten, fixtures brushed down—
A rabbit's cheer for builders in flight!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tml-2727-s1d-construction-discipline

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 29, 2026

Open in StackBlitz

@prisma-next/extension-author-tools

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

@prisma-next/mongo-runtime

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

@prisma-next/family-mongo

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

@prisma-next/sql-runtime

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

@prisma-next/family-sql

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

@prisma-next/extension-arktype-json

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

@prisma-next/extension-cipherstash

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

@prisma-next/middleware-cache

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

@prisma-next/mongo

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

@prisma-next/extension-paradedb

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

@prisma-next/extension-pgvector

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

@prisma-next/extension-postgis

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

@prisma-next/postgres

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

@prisma-next/sql-orm-client

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

@prisma-next/sqlite

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

@prisma-next/target-mongo

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

@prisma-next/adapter-mongo

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

@prisma-next/driver-mongo

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

@prisma-next/contract

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

@prisma-next/utils

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

@prisma-next/config

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

@prisma-next/errors

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

@prisma-next/framework-components

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

@prisma-next/operations

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

@prisma-next/ts-render

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

@prisma-next/contract-authoring

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

@prisma-next/ids

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

@prisma-next/psl-parser

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

@prisma-next/psl-printer

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

@prisma-next/cli

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

@prisma-next/cli-telemetry

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

@prisma-next/emitter

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

@prisma-next/migration-tools

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

prisma-next

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

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

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

@prisma-next/mongo-codec

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

@prisma-next/mongo-contract

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

@prisma-next/mongo-value

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

@prisma-next/mongo-contract-psl

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

@prisma-next/mongo-contract-ts

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

@prisma-next/mongo-emitter

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

@prisma-next/mongo-schema-ir

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

@prisma-next/mongo-query-ast

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

@prisma-next/mongo-orm

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

@prisma-next/mongo-query-builder

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

@prisma-next/mongo-lowering

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

@prisma-next/mongo-wire

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

@prisma-next/sql-contract

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

@prisma-next/sql-errors

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

@prisma-next/sql-operations

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

@prisma-next/sql-schema-ir

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

@prisma-next/sql-contract-psl

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

@prisma-next/sql-contract-ts

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

@prisma-next/sql-contract-emitter

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

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

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

@prisma-next/sql-relational-core

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

@prisma-next/sql-builder

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

@prisma-next/target-postgres

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

@prisma-next/target-sqlite

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

@prisma-next/adapter-postgres

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

@prisma-next/adapter-sqlite

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

@prisma-next/driver-postgres

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

@prisma-next/driver-sqlite

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

commit: e4b871e

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 29, 2026

size-limit report 📦

Path Size
postgres / no-emit 135.09 KB (+0.03% 🔺)
postgres / emit 124.88 KB (+0.02% 🔺)
mongo / no-emit 73.94 KB (+0.03% 🔺)
mongo / emit 68.67 KB (-0.04% 🔽)

Comment thread packages/2-sql/1-core/contract/src/ir/sql-storage.ts Outdated
Comment thread packages/2-sql/1-core/contract/src/validators.ts Outdated
Comment thread packages/2-sql/9-family/src/core/ir/sql-contract-serializer-base.ts
wmadden-electric pushed a commit that referenced this pull request May 30, 2026
Records the five review findings (identity-named concretion + static
factory, drop instanceof discrimination, justify/remove the __unbound__
cast, use ifDefined, clarify raw-vs-hydrated) as round-2 actions with a
refusal trigger guarding the public structural-type/.d.ts assignability.

Signed-off-by: Will Madden <madden@prisma.io>
wmadden-electric added a commit that referenced this pull request May 30, 2026
Rename bound namespace concretions to SqlBoundNamespace / MongoBoundNamespace
with static factories, discriminate map entries by family kind instead of
instanceof, brand __unbound__ on SqlStorageInput, and use ifDefined at
hydration boundaries.

Signed-off-by: wmadden-electric <286902546+wmadden-electric@users.noreply.github.com>
wmadden and others added 6 commits May 30, 2026 08:08
The granular S1.D ticket (TML-2625) was canceled and archived in the
2026-05-20 ticket cleanup; recreated as TML-2727 (the single live S1.D
ticket). Also: the subsumed cleanup tickets (TML-2579/2580/2582/2545/
2563) are already Canceled, so PDoD10 needs no close-out dispatch \u2014 mark
it satisfied in the coverage map.

Signed-off-by: Will Madden <madden@prisma.io>
…efer structural items

A 2026-05-29 inventory falsified S1.D as one deletions-only slice: three of
the eight subsumed surfaces carry structural prerequisites (a contract.json-
shape coordinate change, a hash-computation change, a query-builder type
rewrite). Per the narrow-and-defer decision, S1.D ships the three clean deletes
now as independent parallel slices (construction-discipline shims, canonicalizer
family hook, migration -> elementCoordinates) and defers the three structural
items to follow-ups recorded in deferred.md.

Amends PDoD5/PDoD10 to scope the deferred items out; restructures the plan
composition into parallel groups (no stack); adds the three lean slice specs.

Signed-off-by: Will Madden <madden@prisma.io>
Remove SqlNamespacePayload, MongoNamespacePayload, normaliseNamespaceEntry,
and DEFAULT_NAMESPACES. SqlStorage and MongoStorage now require built
Namespace instances; call sites use buildSqlNamespace / buildMongoNamespace.

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

Signed-off-by: Will Madden <madden@prisma.io>
Records the five review findings (identity-named concretion + static
factory, drop instanceof discrimination, justify/remove the __unbound__
cast, use ifDefined, clarify raw-vs-hydrated) as round-2 actions with a
refusal trigger guarding the public structural-type/.d.ts assignability.

Signed-off-by: Will Madden <madden@prisma.io>
Rename bound namespace concretions to SqlBoundNamespace / MongoBoundNamespace
with static factories, discriminate map entries by family kind instead of
instanceof, brand __unbound__ on SqlStorageInput, and use ifDefined at
hydration boundaries.

Signed-off-by: wmadden-electric <286902546+wmadden-electric@users.noreply.github.com>
@wmadden-electric wmadden-electric force-pushed the tml-2727-s1d-construction-discipline branch from d961ba0 to 7aa9b78 Compare May 30, 2026 06:09
Signed-off-by: wmadden-electric <286902546+wmadden-electric@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

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

Inline comments:
In `@packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-storage.ts`:
- Around line 15-18: The namespaces field on MongoStorageInput is too loose and
the constructor uses an unsafe cast; change MongoStorageInput.namespaces from
Readonly<Record<string, Namespace>> to Readonly<Record<string, MongoNamespace>>
so types align with MongoStorage.namespaces, and remove the bare cast in the
constructor (replace Object.freeze(input.namespaces) as Readonly<Record<string,
MongoNamespace>> with Object.freeze(input.namespaces) directly). If runtime
validation is required, explicitly map/validate each entry from input.namespaces
to a MongoNamespace before freezing instead of using an "as" cast; update
references to MongoStorageInput.namespaces, MongoStorage.namespaces and the
constructor initialization accordingly.

In
`@packages/2-mongo-family/1-foundation/mongo-contract/test/mongo-storage.test.ts`:
- Around line 76-83: The test currently only verifies that constructing
MongoStorage with a namespaces map succeeds; update it to assert the "requires
namespaces" contract by adding a negative-path assertion that constructing new
MongoStorage without the namespaces field throws (e.g., call new MongoStorage({
storageHash: hash }) and expect it to throw or throw a specific error), while
keeping the existing happy-path that uses UNBOUND_NAMESPACE_ID and
MongoUnboundNamespace.instance to ensure valid input still does not throw;
reference the MongoStorage constructor and the
UNBOUND_NAMESPACE_ID/MongoUnboundNamespace.instance symbols to locate the code
to change.

In `@packages/2-sql/1-core/contract/src/validators.ts`:
- Around line 448-450: Replace the bare TypeScript cast on the local variable
"validated" (currently using "result as SqlStorageInput & { readonly
namespaces?: SqlStorageInput['namespaces']; }") with the project's blindCast
utility; import blindCast from "`@prisma-next/utils/casts`" and call
blindCast<SqlStorageInput & { readonly namespaces?:
SqlStorageInput['namespaces']; }, "Describe reason here">(result) so the type
assertion uses blindCast and includes a short reason string, keeping the
variable name "validated" and the same target type.
- Around line 451-458: The validateStorage path currently blindCast()s the
namespace map produced by buildSqlNamespaceMap(validated.namespaces ?? {}) but
buildSqlNamespaceMap only creates SqlUnboundNamespace.instance when an entry
with id === UNBOUND_NAMESPACE_ID is present; fix validateStorage by detecting
when validated.namespaces is missing or does not contain UNBOUND_NAMESPACE_ID
and then injecting SqlUnboundNamespace.instance into the map before calling
blindCast()/returning the new SqlStorage, referencing validateStorage,
buildSqlNamespaceMap, SqlUnboundNamespace.instance, UNBOUND_NAMESPACE_ID and
blindCast; alternatively you may enforce the __unbound__ entry in
createSqlStorageSchema, but pick one approach and update validateStorage (or the
schema) consistently so the structural cast never relies on a non-existent
__unbound__ slot.
🪄 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: 27120888-f32b-412a-9faa-4ee7578832f5

📥 Commits

Reviewing files that changed from the base of the PR and between ab6eaaa and 7aa9b78.

⛔ Files ignored due to path filters (7)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • projects/contract-ir-planes/deferred.md is excluded by !projects/**
  • projects/contract-ir-planes/plan.md is excluded by !projects/**
  • projects/contract-ir-planes/slices/canonicalizer-family-hook/spec.md is excluded by !projects/**
  • projects/contract-ir-planes/slices/construction-discipline-shims/spec.md is excluded by !projects/**
  • projects/contract-ir-planes/slices/migration-element-coordinates/spec.md is excluded by !projects/**
  • projects/contract-ir-planes/spec.md is excluded by !projects/**
📒 Files selected for processing (78)
  • packages/1-framework/1-core/framework-components/src/ir/namespace.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/contract-schema.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/exports/index.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/build-mongo-namespace.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-storage.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/element-coordinates.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.test.ts
  • packages/2-mongo-family/2-authoring/contract-ts/src/contract-builder.ts
  • packages/2-sql/1-core/contract/package.json
  • packages/2-sql/1-core/contract/src/exports/types.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/types.ts
  • packages/2-sql/1-core/contract/src/validators.ts
  • packages/2-sql/1-core/contract/test/build-sql-namespace-map.test.ts
  • packages/2-sql/1-core/contract/test/element-coordinates.test.ts
  • packages/2-sql/1-core/contract/test/sql-storage.test.ts
  • packages/2-sql/2-authoring/contract-ts/src/build-contract.ts
  • packages/2-sql/4-lanes/relational-core/test/codec-descriptor-registry.test.ts
  • packages/2-sql/4-lanes/sql-builder/test/runtime/field-proxy.test.ts
  • packages/2-sql/5-runtime/test/async-iterable-result.test.ts
  • packages/2-sql/5-runtime/test/codec-integrity.test.ts
  • packages/2-sql/5-runtime/test/contract-codec-registry.test.ts
  • packages/2-sql/5-runtime/test/intercept-decoding.test.ts
  • packages/2-sql/5-runtime/test/marker-verification.test.ts
  • packages/2-sql/5-runtime/test/marker-vs-intercept-ordering.test.ts
  • packages/2-sql/5-runtime/test/mutation-default-generators.test.ts
  • packages/2-sql/5-runtime/test/parameterized-types.test.ts
  • packages/2-sql/5-runtime/test/runtime-ctx-passthrough.test.ts
  • packages/2-sql/5-runtime/test/scope-plumbing.test.ts
  • packages/2-sql/5-runtime/test/sql-context.codec-context.test.ts
  • packages/2-sql/5-runtime/test/sql-context.test.ts
  • packages/2-sql/5-runtime/test/sql-family-adapter.test.ts
  • packages/2-sql/5-runtime/test/sql-runtime-abort.test.ts
  • packages/2-sql/5-runtime/test/sql-runtime.test.ts
  • packages/2-sql/5-runtime/test/utils.ts
  • packages/2-sql/9-family/src/core/ir/sql-contract-serializer-base.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/field-event-planner.test.ts
  • packages/2-sql/9-family/test/schema-verify.helpers.ts
  • packages/3-extensions/cipherstash/test/cipherstash-codec.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-targets/3-targets/postgres/src/core/postgres-contract-serializer.ts
  • packages/3-targets/3-targets/postgres/test/element-coordinates.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/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/6-adapters/postgres/test/migrations/cross-namespace-fk.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/db-init-update.cli.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/fixtures/runner-fixtures.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.authoring-surface.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.codec-field-event.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.fk-config.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.reconciliation.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.reconciliation.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.referential-actions.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.semantic-satisfaction.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/planner.storage-types.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/runner.multi-space.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/runner.unbound-namespace.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/migrations/schema-verify.after-runner.integration.test.ts
  • packages/3-targets/6-adapters/postgres/test/test-utils.ts
  • packages/3-targets/6-adapters/sqlite/test/migrations/db-init-update.cli.test.ts
  • packages/3-targets/6-adapters/sqlite/test/migrations/fixtures/runner-fixtures.ts
  • packages/3-targets/6-adapters/sqlite/test/migrations/planner-introspection.integration.test.ts
  • packages/3-targets/6-adapters/sqlite/test/migrations/planner.codec-field-event.test.ts
  • packages/3-targets/6-adapters/sqlite/test/migrations/planner.test.ts
  • packages/3-targets/6-adapters/sqlite/test/migrations/runner.multi-space.test.ts
  • test/integration/test/contract-space-fixture/contract.ts

Comment thread packages/2-mongo-family/1-foundation/mongo-contract/src/ir/mongo-storage.ts Outdated
Comment thread packages/2-mongo-family/1-foundation/mongo-contract/test/mongo-storage.test.ts Outdated
Comment thread packages/2-sql/1-core/contract/src/validators.ts Outdated
Comment thread packages/2-sql/1-core/contract/src/validators.ts
- Mirror the SQL R3 fix on Mongo: type MongoStorageInput.namespaces as
  Readonly<Record<string, MongoNamespace>> so the constructor assignment
  needs no cast; drop the bare `as`.
- Make the SQL `__unbound__` brand sound rather than asserted: inject the
  SqlUnboundNamespace singleton when the validated/hydrated namespaces omit
  the late-bound slot (cross-namespace contracts legitimately do), then
  reconstruct the branded map. Removes the unsound blindCast in
  validateStorage and the bare `as` bridge cast; keeps an honest,
  runtime-guaranteed cast in the hydrate path.
- Make the Mongo construction test honest: it exercises the unbound-only
  happy path (namespaces is a required field, not a runtime throw).

Signed-off-by: wmadden-electric <286902546+wmadden-electric@users.noreply.github.com>
@wmadden wmadden merged commit 22e3dd1 into main May 30, 2026
21 checks passed
wmadden added a commit that referenced this pull request May 30, 2026
Records the five review findings (identity-named concretion + static
factory, drop instanceof discrimination, justify/remove the __unbound__
cast, use ifDefined, clarify raw-vs-hydrated) as round-2 actions with a
refusal trigger guarding the public structural-type/.d.ts assignability.

Signed-off-by: Will Madden <madden@prisma.io>
wmadden pushed a commit that referenced this pull request May 30, 2026
Rename bound namespace concretions to SqlBoundNamespace / MongoBoundNamespace
with static factories, discriminate map entries by family kind instead of
instanceof, brand __unbound__ on SqlStorageInput, and use ifDefined at
hydration boundaries.

Signed-off-by: wmadden-electric <286902546+wmadden-electric@users.noreply.github.com>
@wmadden wmadden deleted the tml-2727-s1d-construction-discipline branch May 30, 2026 10:08
wmadden-electric added a commit that referenced this pull request May 30, 2026
Reconcile S1.D-1 (#630, now on main) with S1.D-2 (#631) hook work:
- sql-contract-serializer-base.ts / build-contract.ts: keep #630's
  materialised-namespace naming + unbound injection, layer #631's
  canonicalization hook threading (shouldPreserveEmpty/sortStorage) on top.
- descriptor-self-consistency test + contract-space fixture: compose the
  shared hooks over #630's namespace bodies.
- pnpm install relinked @prisma-next/utils into sql-contract (dep added by
  #630). Generated fixtures regenerated via scripts; fixtures:check zero-diff.

Signed-off-by: wmadden-electric <286902546+wmadden-electric@users.noreply.github.com>
wmadden-electric added a commit that referenced this pull request May 30, 2026
…istory

Replace the three synthetic normal-shape golden cases with cases drawn
from real merged PRs, so the corpus measures Drive runs against work the
team actually shipped rather than synthesised tasks:

- direct-change-example-emit-outputpath (TML-2722 / #618)
- slice-dedupe-generated-imports (TML-2714 / #614)
- project-reap-subsumed-ir-surfaces (TML-2727 / #630, #631, #629) — a
  three-slice parallel fan-out that exercises planner parallelisation and
  scope discipline.

Each real case carries the task as posed (Linear ticket, solution-scrubbed
so the run still does the design/planning), a base_sha to run against, and
a reference.md describing the known-good output by commit SHA (the output
itself is fetchable via git diff <base_sha> <merge_sha>). case.json gains
source + base_sha; the loader ignores the extra fields until the
experiment-engine slice wires base_sha into a checkout.

The two pathological cases (i12-halt, spike-first) stay synthetic: no clean
merged PR exhibits a halted or spiked run.

Update harness tests, SKILL.md examples, and the corpus README for the
renamed slugs. validate-parser fixtures are left as-is — they are
synthetic parser fixtures with tuned event counts, not corpus members.

Signed-off-by: wmadden-electric <286902546+wmadden-electric@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants