Repository navigation
TML-2751: wire symmetric domain plane (domain.namespaces) - #653
Conversation
ADR 221 prescribed flat namespace keys under each plane, which mixes
plane-level metadata (storageHash, SQL storage.types) into the open
namespace map. Amend to { metadata?, namespaces } per plane, move the
grounding example codec alias to storage.types, and state explicitly
that framework domain has no types member.
Replan umbrella S2 as domain-plane wiring only (storage unchanged on
main). Add symmetric-domain-plane slice spec/plan. Cancels the flatten
direction attempted in closed PR #649.
Signed-off-by: Will Madden <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Replace flat root models/valueObjects with domain.namespaces.<nsId> slices in the Contract type, canonical emission, validation, and test factories. Add contractModels/contractValueObjects helpers and legacy JSON normalization for deserialize paths. Signed-off-by: Will Madden <[email protected]>
Mirror storage elementCoordinates over domain.namespaces without reserved-key denylists; export from the IR surface. Signed-off-by: Will Madden <[email protected]>
Wire SQL builders, PSL interpreter, arktype schema, and emitters to the domain plane envelope; remove erroneous domain.types spillover to storage.types only. Signed-off-by: Will Madden <[email protected]>
Align Mongo schema, builder output, and deserializer normalization with the symmetric domain plane shape. Signed-off-by: Will Madden <[email protected]>
Align testing factories and unit tests with DomainPlane typing after the domain.namespaces substrate change. Signed-off-by: Will Madden <[email protected]>
Merge value-object entries across domain.namespaces at the type level so family packages can infer VO maps without a flat contract.valueObjects root. Signed-off-by: Will Madden <[email protected]>
Use contractModels in validateMongoStorage and update mongo-contract tests for the domain envelope shape and InferModelRow typing. Signed-off-by: Will Madden <[email protected]>
Read codec aliases from storage.types only, add contractModels helpers in PSL/TS tests, and fix emitter type generation for the domain plane envelope. Signed-off-by: Will Madden <[email protected]>
contractModels and contractValueObjects accept either domain.namespaces or pre-envelope flat models/valueObjects so emitters and tests can migrate incrementally without breaking IR builders that still pass flat shapes. Signed-off-by: Will Madden <[email protected]>
Use ContractModelsMap for type-level model maps, contractModels and contractValueObjects at runtime, and normalizeLegacyDomainRoot for JSON fixtures still on the flat root. Relational-core column typing reads models through ContractModelsMap so FieldOutputTypes resolve again. Signed-off-by: Will Madden <[email protected]>
Update in-repo tests, examples, and integration parity fixtures to read models and value objects through domain.namespaces (or normalizeLegacyDomainRoot for hand-authored JSON). Regenerated emitted contract.json and contract.d.ts artifacts across examples, extensions, and test fixtures. Signed-off-by: Will Madden <[email protected]>
Wire TestContract through MongoContract<Storage, Models> with an explicit __unbound__ namespace so ContractModelsMap keeps literal model keys. Resolve nested value-object shapes via ContractValueObjectsMap instead of legacy flat contract.valueObjects. Signed-off-by: Will Madden <[email protected]>
Use contractModels() and modelsFromCanonicalContract() where tests previously asserted flat contract.models. Update emitter canonicalization expectations for domain-before-storage key order. Signed-off-by: Will Madden <[email protected]>
Use bracket access for decoded row fields, compare User InferModelRow to FieldOutputTypes, and assert polymorphic variant values via a type alias. Signed-off-by: Will Madden <[email protected]>
Narrow ContractBase.domain to __unbound__ with models and valueObjects so ContractValueObjectsMap resolves for InferModelRow. Regenerate orm-contract fixture and split User VO assertion to FieldOutputTypes. Signed-off-by: Will Madden <[email protected]>
Type decode fixture contracts through MongoContract<Storage, Models> and use bracket field access in decode integration tests for index-signature safety. Signed-off-by: Will Madden <[email protected]>
Signed-off-by: Will Madden <[email protected]>
The spec still described the EA-era numbering (S2 = runtime qualification, S3 = explicit DSL) while the plan had been rewritten to a different numbering (S2 = domain plane). The two documents disagreed about what every S-number meant. Replace the numbering with descriptive unit names (domain-plane, public-by-default, runtime-qualification, explicit-dsl) and bring the spec into sync with the plan. Signed-off-by: Will Madden <[email protected]>
FindModelForTable and FindFieldForColumn still read flat contract.models; after the domain envelope move, that mapping was empty and insert() row types collapsed to never. Use ContractModelsMap instead. Signed-off-by: Will Madden <[email protected]>
Regenerate tracked contract typings after domain.namespaces emission. Fix mongo contract-builder model typing and DSL test accessors. Signed-off-by: Will Madden <[email protected]>
Inline Contract literals use buildDomainPlaneFromFlat; type tests use ContractModelsMap and bracket namespace access; refresh value-object mongo contract fixture to the domain envelope shape. Signed-off-by: Will Madden <[email protected]>
Align tracked contract typings with domain.namespaces emission output. Signed-off-by: Will Madden <[email protected]>
|
Important Review skippedToo many files! This PR contains 292 files, which is 142 over the limit of 150. To get a review, narrow the scope: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (8)
📒 Files selected for processing (292)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…plane Signed-off-by: Will Madden <[email protected]> # Conflicts: # examples/cipherstash-integration/src/prisma/contract.d.ts # examples/cipherstash-integration/src/prisma/contract.json # packages/3-extensions/cipherstash/migrations/20260601T0000_install_eql_bundle/migration.json # packages/3-extensions/cipherstash/migrations/refs/head.json # packages/3-extensions/cipherstash/src/contract.d.ts # packages/3-extensions/cipherstash/src/contract.json # test/integration/test/authoring/parity/cipherstash-encrypted-bigint/expected.contract.json # test/integration/test/authoring/parity/cipherstash-encrypted-boolean/expected.contract.json # test/integration/test/authoring/parity/cipherstash-encrypted-date/expected.contract.json # test/integration/test/authoring/parity/cipherstash-encrypted-double/expected.contract.json # test/integration/test/authoring/parity/cipherstash-encrypted-json/expected.contract.json # test/integration/test/authoring/parity/cipherstash-encrypted-string/expected.contract.json
Narrow legacy flat-root access in contractModels helpers, drop the incorrect domain.types path in sql-runtime, and align test fixtures with domain.namespaces after CipherStash removal on main. Signed-off-by: Will Madden <[email protected]>
@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/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: |
size-limit report 📦
|
Make domainPlaneOf generic so createContract infers DomainPlane<TModels> without casts in testing-factories; reword domain doc comment; delete orphan basic-contract.json and drop its snapshot-scan exclusion. Signed-off-by: Will Madden <[email protected]>
Hand-migrate snapshot-read-shapes fixtures to domain.namespaces; regenerate multi-extension-monorepo contracts and sync extension head refs; add emit script for fixtures:check; remove stale duplicate sqlite prisma artefacts. Signed-off-by: Will Madden <[email protected]>
Move root models/valueObjects under domain.namespaces.__unbound__ across remaining checked-in migration snapshots, package test fixtures, and integration value-object fixtures; fix sql-contract-ts null-relations edge-case to target domain directly. Signed-off-by: Will Madden <[email protected]>
Re-attest pgvector, postgis, and paradedb baseline migrationHash values after canonical JSON hashing drift from main. Remove stale Contract imports in sql-contract-emitter hook tests that fail lint --error-on-warnings. Signed-off-by: Will Madden <[email protected]>
Replace forbidden non-null assertions with explicit undefined checks so contract package lint passes --error-on-warnings in CI. Signed-off-by: Will Madden <[email protected]>
Validate migration ref snapshots against domain.namespaces instead of top-level models. Update integration and demo tests for the symmetric domain envelope, and re-sync audit/feature-flags contract-space migration bookends after canonical hashing drift. Signed-off-by: Will Madden <[email protected]>
Use UNBOUND_NAMESPACE_ID in ContractView tests. Trim trailing newlines on extension contract.json files so fixtures:check matches contract emit output. Signed-off-by: Will Madden <[email protected]>
Generic domain-plane parameter lets contractModels return the contract's TModels so generated contract.d.ts usage typechecks in integration tests. Signed-off-by: Will Madden <[email protected]>
wmadden
left a comment
There was a problem hiding this comment.
There's still some weird logic that looks like back compat shims
…ain rename, structural identity key, evict test helper) Signed-off-by: Will Madden <[email protected]>
Replace colon-joined coordinate strings with nested maps so model identity stays unambiguous when names contain ":". Signed-off-by: Will Madden <[email protected]>
DomainPlane becomes ApplicationDomain, DomainNamespace becomes ApplicationDomainNamespace, and domainPlaneOf becomes applicationDomainOf. The contract field stays `domain`. Signed-off-by: Will Madden <[email protected]>
Evict the test-only domain authoring helper from the contract production surface into @prisma-next/test-utils. Contract package tests import it via a relative path to avoid a Turbo build cycle; all other call sites use the test-utils export. Depends on @prisma-next/contract for ApplicationDomain types. Signed-off-by: Will Madden <[email protected]>
…c reach The foundation contract package cannot depend on @prisma-next/test-utils (test-utils depends on contract), so its own tests cannot import the shared applicationDomainOf via the package name. Replace the brittle 5-level relative reach into test-utils/src with a tiny local copy, keeping package boundaries one-way. Signed-off-by: Will Madden <[email protected]>
The @prisma-next/contract/types resolve alias became unused once the package tests switched to a local test helper; remove it and the now-unused imports. Signed-off-by: Will Madden <[email protected]>
The round-2 contract rework left dead profileHash value imports in test helpers; biome's --error-on-warnings turns them into lint failures. Signed-off-by: Will Madden <[email protected]>
…ng-factories, relocate domain error) Signed-off-by: Will Madden <[email protected]>
…ractValidationError Move the domain namespace resolution error class into the centralized contract-validation-error module so domain-envelope stays structural only. Signed-off-by: Will Madden <[email protected]>
Move createContract/createSqlContract out of contract/src and drop the @prisma-next/contract/testing subpath. Contract package tests keep a local duplicate helper; other packages import from test-utils via the existing @prisma-next/contract/hashing subpath for hash computation. Signed-off-by: Will Madden <[email protected]>
The emitter's test/utils.ts imported createContract from the @prisma-next/test-utils root, whose index re-exports server helpers that pull in @prisma/dev (a devDependency). When the emitter test bundle is built, that drags @prisma/dev into emitter/dist/test/utils.mjs, so integration tests (contract-imports, cli.emit) fail at runtime with "Cannot find package '@prisma/dev'". Add a dedicated ./contract-factories leaf entry/export to test-utils and import createContract from that subpath instead. The leaf only depends on @prisma-next/contract and @prisma-next/utils, keeping @prisma/dev out of the emitter test bundle. Signed-off-by: Will Madden <[email protected]>
…pondence (#723) Harden `scripts/check-upgrade-coverage.mjs` so the upgrade-coverage gate verifies **entry↔substrate correspondence per PR**, not just that the in-flight transition directory exists. ## Why The gate only asserted that `upgrades/<M>-to-<M+1>/` exists when a PR touched a cluster's substrate (`examples/` → user skill; `packages/3-extensions/` → extension-author skill). Once any earlier PR created that directory, a later PR could introduce a real breaking change with **no** upgrade entry and still pass — which is exactly how the `domain-plane` slice (#653 / TML-2751) shipped a breaking change with no entries. The gate was necessary-but-not-sufficient; the missing-entry case was left to human review. ## Change Layered a per-PR correspondence check on top of the existing directory-existence precondition (which is unchanged, as are the new-entries rule, the coverage-chain logic, and the `--mode`/`--prev`/`--head` interface). When `git diff <base>..HEAD` touches a cluster's substrate: 1. That cluster's in-flight `instructions.md` **must be in the PR's changed files** — forcing a deliberate per-PR act, so a prior PR's entry can no longer cover a later PR. 2. Its frontmatter `changes:` **must be a present array** — either a real entry, or an explicit `changes: []` no-op (the documented escape hatch for genuinely incidental substrate diffs such as dev-dep bumps). A new exported `parseChangesFrontmatter` handles the YAML spellings (`changes: []`, non-empty flow arrays `[a, b]`, and block sequences regardless of which key leads each entry). Missing/malformed `changes:` while substrate is touched → violation. ## Scope / verification - Two-file diff: the script + its test. - `node --test scripts/check-upgrade-coverage.test.mjs` → 45/45 (15 new, including all six correspondence cases + flow/block-order parser cases). `pnpm check:upgrade-coverage --mode pr` passes on this branch; biome clean. - Additive hardening only — no existing rule weakened; incidental diffs remain satisfiable via `changes: []`. Refs: TML-2764 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Added comprehensive test coverage for upgrade documentation validation and frontmatter parsing. * **Chores** * Enhanced validation to enforce stricter requirements for documenting changes in upgrade paths. * Improved error messages for missing or malformed upgrade documentation declarations. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: wmadden-electric <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-authored-by: wmadden-electric <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]> Co-authored-by: Will Madden <[email protected]>
Linked issue
Refs TML-2751
At a glance
Before — models lived at the contract root:
{ "target": "postgres", "models": { "User": { "fields": { "id": { "nullable": false, "type": { "kind": "scalar", "codecId": "pg/int4@1" } } }, "storage": { "table": "user", "fields": { "id": { "column": "id" } } } } }, "storage": { "namespaces": { "__unbound__": { "tables": { "user": { } } } } } }After — the application plane is symmetric with storage; models and value objects sit under
domain.namespaces:{ "target": "postgres", "domain": { "namespaces": { "__unbound__": { "models": { "User": { "fields": { "id": { "nullable": false, "type": { "kind": "scalar", "codecId": "pg/int4@1" } } }, "storage": { "table": "user", "fields": { "id": { "column": "id" } } } } }, "valueObjects": { } } } }, "storage": { "namespaces": { "__unbound__": { "tables": { "user": { } } } } } }storage.namespacesis unchanged in shape and responsibility. The framework domain plane has nodomain.typesbucket (SQL storage types stay onstorageonly).Why
ADR 221 calls for symmetric plane envelopes: both storage and domain carry a
namespacessegment so extension packs and multi-namespace authoring compose the same way at each plane. Consumers stop reading flatcontract.models/contract.valueObjects; runtime and DSL code usecontract.domain.namespacesand helpers such ascontractModels()/ContractModelsMap.What changed
domain.namespaces.contract.d.tsinclude the domain envelope.contractModels,ContractModelsMap, andContractValueObjectsMapare the supported access paths; legacy flat domain roots are normalized at the boundary only.insert()/ update row typing resolves models viaContractModelsMap(fixesneverrows when onlydomainis populated).pnpm fixtures:checkpasses.Alternatives considered
PR #649 explored flattening storage (lifting tables out of
storage.namespaces). That direction was abandoned in favour of this symmetric envelope: keepstorage.namespacesas-is, adddomain.namespacesfor models/value objects, and avoidSTORAGE_PLANE_RESERVED_KEYSor other storage reshaping.Testing performed
pnpm fixtures:checktest/integrationpackagepnpm typecheckpnpm test:packages— last run: type errors clean; a few PGlite/MMS integration flakes in@prisma-next/adapter-postgresand unrelated packages (re-run on CI)pnpm test:integration— not re-run end-to-end in this session after typecheck green; pretest build includes postgis demo (insert typing fixed via sql-builder)Checklist
domain.typeson framework contractsSTORAGE_PLANE_RESERVED_KEYSexamples/orpackages/3-extensions/source API changes requiring consumer migrations)