Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughMoved emission SPI types out of the contract package into Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
9f5b649 to
3ff5055
Compare
34a38b3 to
f025a31
Compare
17dbaca to
6338a45
Compare
a731a7c to
a609b7d
Compare
@prisma-next/runtime-executor
@prisma-next/mongo-core
@prisma-next/mongo-orm
@prisma-next/mongo-runtime
@prisma-next/family-mongo
@prisma-next/sql-runtime
@prisma-next/extension-paradedb
@prisma-next/extension-pgvector
@prisma-next/postgres
@prisma-next/sql-orm-client
@prisma-next/target-mongo
@prisma-next/adapter-mongo
@prisma-next/driver-mongo
@prisma-next/contract-authoring
@prisma-next/contract-ts
@prisma-next/ids
@prisma-next/psl-parser
@prisma-next/psl-printer
@prisma-next/cli
@prisma-next/emitter
@prisma-next/migration-tools
@prisma-next/vite-plugin-contract-emit
@prisma-next/mongo-contract-psl
@prisma-next/mongo-query-ast
@prisma-next/mongo-emitter
@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/family-sql
@prisma-next/sql-lane-query-builder
@prisma-next/sql-relational-core
@prisma-next/sql-builder
@prisma-next/target-postgres
@prisma-next/adapter-postgres
@prisma-next/driver-postgres
@prisma-next/contract
@prisma-next/plan
@prisma-next/utils
@prisma-next/core-control-plane
@prisma-next/core-execution-plane
@prisma-next/config
@prisma-next/framework-components
@prisma-next/operations
commit: |
…ionHash from ContractBase executionHash belongs inside the execution section, not as a top-level contract field. This removes the TExecutionHash type parameter from ContractBase, DocumentContract, and SqlContract.
…endency Rewrote the detailed plan to reflect what tasks 3.10, 3.12, and 3.13 already completed. Key decisions: - Emission SPI types move to a new ./emission subpath (not lumped into ./control) for thematic coherence alongside ./authoring, ./components - Duplicate TypesImportSpec/RenderTypeContext consolidated to one home in framework-components - Shim removal (core-execution-plane, core-control-plane deprecated re-exports) deferred to follow-up task 5.11.1 to limit diff size - Must sequence after Phase A (5.A1-A6) due to overlapping consumer files in contract/types.ts and ~30 downstream import sites - Foundation layer (0-foundation/) done last as purely organizational - No overlap/conflict with M6 (which narrows TargetFamilyHook after)
Create ./emission subpath with TargetFamilyHook, ValidationContext, GenerateContractTypesOptions, TypeRenderContext, TypeRenderEntry, TypeRenderer, and ParameterizedCodecDescriptor. Consolidate duplicate TypesImportSpec and RenderTypeContext by re-exporting from their existing canonical locations in the package. Add @prisma-next/operations dependency for ValidationContext's OperationRegistry reference. Update control-descriptors.ts to import TargetFamilyHook from the local module instead of @prisma-next/contract.
…ts/emission Split imports in control-plane emission, framework emitter src and tests to import emission SPI types (TargetFamilyHook, ValidationContext, TypesImportSpec, etc.) from framework-components/emission instead of contract/types. Contract data types (Contract, ContractMarkerRecord) remain imported from contract/types. Add @prisma-next/framework-components dependency to @prisma-next/emitter.
…ssion Split imports in SQL emitter hook, family assembly, and control instance to import emission SPI types from framework-components/emission instead of contract/types.
…mission Split imports in Mongo emitter hook and tests. Add @prisma-next/framework-components dependency to @prisma-next/mongo-emitter.
Delete TargetFamilyHook, ValidationContext, GenerateContractTypesOptions, TypeRenderContext, TypeRenderEntry, TypeRenderer, ParameterizedCodecDescriptor, TypesImportSpec, and RenderTypeContext from contract/types.ts and its export barrel. These types now live in @prisma-next/framework-components/emission. Drop @prisma-next/operations dependency from contract — contract is now a true leaf package with no framework-domain dependencies.
Move utils, plan, and contract from 1-core/shared/ to 0-foundation/shared/. This makes contract a true leaf package in the architecture, sitting below the core layer where framework-components, operations, and config live. Add foundation layer to architecture.config.json with layerOrder preceding core, so lint:deps enforces that foundation packages cannot import from core or above.
Drop the pointless TypeRenderContext = RenderTypeContext alias from emission-types.ts. Consumers now import RenderTypeContext directly. Remove the simplified TypeRenderer union from emission-types.ts — the canonical 4-variant TypeRenderer from type-renderers.ts is now the single definition. The emission barrel re-exports it from type-renderers so consumers of ./emission still resolve it. This eliminates the name collision between ./emission and ./components subpaths.
The file contains only TypesImportSpec — give it a meaningful name instead of the generic grab-bag types.ts.
Delete target-family.ts (pure re-export shim with zero consumers) and remove the duplicate TargetFamilyHook/TypesImportSpec/ValidationContext re-exports from exports/index.ts. Consumers import these directly from @prisma-next/framework-components/emission.
Add a section to framework-components README explaining why emission SPI types live in the core layer rather than alongside their implementations. Record ADR 183 — SPI types live at the lowest consuming layer — as a cross-cutting architectural decision.
Remove all references to emission SPI types (TargetFamilyHook, ValidationContext, TypesImportSpec) which now live in @prisma-next/framework-components/emission. Remove stale dependency on @prisma-next/operations. Remove deleted subpath exports (./framework- components, ./ir). Fix relative links broken by the directory move from 1-core/shared/contract to 0-foundation/shared/contract. Add link to ADR 183.
Add executionHash() branded factory and export it alongside coreHash() and profileHash(). Fix test factories and test files that used unbranded strings or wrong hash constructors for executionHash fields. Fix createContract factory to accept execution input without executionHash (computed internally). Remove unused Contract imports from emitter tests.
Replace hand-written orm-contract.d.ts fixtures with emitter-generated
versions that align with the current Contract and MongoContract types.
Add relations:{} to orm-contract.json models that lacked it. Add
generate-orm-fixture.ts script for reproducible regeneration. Fix
integration test to use bracket notation for index-signature properties.
TargetFamilyHook was imported but unused after base branch removed the satisfies clause. Lockfile updated for moved contract package symlinks.
adc4eb5 to
e6f92bc
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/2-mongo-family/3-tooling/emitter/test/generate-orm-fixture.ts (1)
15-26: Consider using a factory function to avoid the type assertion.The
as Contractcast is necessary here because spreading JSON loses literal type information. While acceptable in test tooling, a factory function likecreateContract()could provide type safety and reduce the need for assertions.However, since this is a test fixture generator and not production code, the current approach is pragmatic.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/2-mongo-family/3-tooling/emitter/test/generate-orm-fixture.ts` around lines 15 - 26, The test fixture uses a typed variable "contract: Contract" and then forces a type with "as Contract" after spreading ormContractJson; remove this assertion by adding a small factory function (e.g., createContract) that accepts a Partial<Contract> or the raw ormContractJson plus overrides (target, profileHash, storage, capabilities, extensionPacks, meta) and returns a properly typed Contract; update the usage to call createContract({...}) instead of spreading and asserting so the return value is correctly typed without "as Contract" while preserving the same fields and values (reference the existing variable name "contract" and the Contract type).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/1-framework/0-foundation/shared/contract/README.md`:
- Line 48: The README currently points to the wrong SQL schema package path;
update the string "@prisma-next/sql-query/schemas/data-contract-sql-v1.json" to
the correct package name
"@prisma-next/sql-contract-ts/schemas/data-contract-sql-v1.json" in the README
so the SQL contracts reference the actual schema file (look for the sentence
containing For SQL contracts, use ... and replace the package path).
---
Nitpick comments:
In `@packages/2-mongo-family/3-tooling/emitter/test/generate-orm-fixture.ts`:
- Around line 15-26: The test fixture uses a typed variable "contract: Contract"
and then forces a type with "as Contract" after spreading ormContractJson;
remove this assertion by adding a small factory function (e.g., createContract)
that accepts a Partial<Contract> or the raw ormContractJson plus overrides
(target, profileHash, storage, capabilities, extensionPacks, meta) and returns a
properly typed Contract; update the usage to call createContract({...}) instead
of spreading and asserting so the return value is correctly typed without "as
Contract" while preserving the same fields and values (reference the existing
variable name "contract" and the Contract type).
🪄 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: 1133e5f3-13b5-4fa1-afa5-520c16d81b35
⛔ Files ignored due to path filters (3)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlprojects/contract-domain-extraction/plan.mdis excluded by!projects/**projects/contract-domain-extraction/plans/5.11-extract-framework-components-package-plan.mdis excluded by!projects/**
📒 Files selected for processing (108)
architecture.config.jsondocs/architecture docs/adrs/ADR 183 - SPI types live at the lowest consuming layer.mdpackages/1-framework/0-foundation/shared/contract/README.mdpackages/1-framework/0-foundation/shared/contract/biome.jsoncpackages/1-framework/0-foundation/shared/contract/package.jsonpackages/1-framework/0-foundation/shared/contract/schemas/data-contract-document-v1.jsonpackages/1-framework/0-foundation/shared/contract/src/canonicalization.tspackages/1-framework/0-foundation/shared/contract/src/contract-types.tspackages/1-framework/0-foundation/shared/contract/src/domain-types.tspackages/1-framework/0-foundation/shared/contract/src/exports/hashing.tspackages/1-framework/0-foundation/shared/contract/src/exports/testing.tspackages/1-framework/0-foundation/shared/contract/src/exports/types.tspackages/1-framework/0-foundation/shared/contract/src/exports/validate-contract.tspackages/1-framework/0-foundation/shared/contract/src/exports/validate-domain.tspackages/1-framework/0-foundation/shared/contract/src/hashing.tspackages/1-framework/0-foundation/shared/contract/src/testing-factories.tspackages/1-framework/0-foundation/shared/contract/src/types.tspackages/1-framework/0-foundation/shared/contract/src/validate-contract.tspackages/1-framework/0-foundation/shared/contract/src/validate-domain.tspackages/1-framework/0-foundation/shared/contract/test/canonicalization.test.tspackages/1-framework/0-foundation/shared/contract/test/contract-factories.test.tspackages/1-framework/0-foundation/shared/contract/test/contract-types.test-d.tspackages/1-framework/0-foundation/shared/contract/test/contract-types.test.tspackages/1-framework/0-foundation/shared/contract/test/domain-types.test.tspackages/1-framework/0-foundation/shared/contract/test/hashing.test.tspackages/1-framework/0-foundation/shared/contract/test/types.test.tspackages/1-framework/0-foundation/shared/contract/test/validate-contract.test.tspackages/1-framework/0-foundation/shared/contract/test/validate-domain.test.tspackages/1-framework/0-foundation/shared/contract/tsconfig.jsonpackages/1-framework/0-foundation/shared/contract/tsconfig.prod.jsonpackages/1-framework/0-foundation/shared/contract/tsdown.config.tspackages/1-framework/0-foundation/shared/contract/vitest.config.tspackages/1-framework/0-foundation/shared/plan/README.mdpackages/1-framework/0-foundation/shared/plan/biome.jsoncpackages/1-framework/0-foundation/shared/plan/package.jsonpackages/1-framework/0-foundation/shared/plan/src/errors.tspackages/1-framework/0-foundation/shared/plan/src/exports/errors.tspackages/1-framework/0-foundation/shared/plan/src/exports/types.tspackages/1-framework/0-foundation/shared/plan/src/index.tspackages/1-framework/0-foundation/shared/plan/src/types.tspackages/1-framework/0-foundation/shared/plan/test/errors.test.tspackages/1-framework/0-foundation/shared/plan/tsconfig.jsonpackages/1-framework/0-foundation/shared/plan/tsconfig.prod.jsonpackages/1-framework/0-foundation/shared/plan/tsdown.config.tspackages/1-framework/0-foundation/shared/plan/vitest.config.tspackages/1-framework/0-foundation/shared/utils/README.mdpackages/1-framework/0-foundation/shared/utils/biome.jsoncpackages/1-framework/0-foundation/shared/utils/package.jsonpackages/1-framework/0-foundation/shared/utils/src/abortable.tspackages/1-framework/0-foundation/shared/utils/src/array-equal.tspackages/1-framework/0-foundation/shared/utils/src/assertions.tspackages/1-framework/0-foundation/shared/utils/src/defined.tspackages/1-framework/0-foundation/shared/utils/src/exports/abortable.tspackages/1-framework/0-foundation/shared/utils/src/exports/array-equal.tspackages/1-framework/0-foundation/shared/utils/src/exports/assertions.tspackages/1-framework/0-foundation/shared/utils/src/exports/defined.tspackages/1-framework/0-foundation/shared/utils/src/exports/redact-db-url.tspackages/1-framework/0-foundation/shared/utils/src/exports/result.tspackages/1-framework/0-foundation/shared/utils/src/redact-db-url.tspackages/1-framework/0-foundation/shared/utils/src/result.tspackages/1-framework/0-foundation/shared/utils/test/abortable.test.tspackages/1-framework/0-foundation/shared/utils/test/array-equal.test.tspackages/1-framework/0-foundation/shared/utils/test/assertions.test.tspackages/1-framework/0-foundation/shared/utils/test/defined.test.tspackages/1-framework/0-foundation/shared/utils/test/redact-db-url.test.tspackages/1-framework/0-foundation/shared/utils/test/result.test.tspackages/1-framework/0-foundation/shared/utils/tsconfig.jsonpackages/1-framework/0-foundation/shared/utils/tsconfig.prod.jsonpackages/1-framework/0-foundation/shared/utils/tsdown.config.tspackages/1-framework/0-foundation/shared/utils/vitest.config.tspackages/1-framework/1-core/migration/control-plane/src/emission/emit.tspackages/1-framework/1-core/migration/control-plane/src/emission/types.tspackages/1-framework/1-core/shared/contract/README.mdpackages/1-framework/1-core/shared/framework-components/README.mdpackages/1-framework/1-core/shared/framework-components/package.jsonpackages/1-framework/1-core/shared/framework-components/src/control-descriptors.tspackages/1-framework/1-core/shared/framework-components/src/control-stack.tspackages/1-framework/1-core/shared/framework-components/src/emission-types.tspackages/1-framework/1-core/shared/framework-components/src/exports/emission.tspackages/1-framework/1-core/shared/framework-components/src/framework-components.tspackages/1-framework/1-core/shared/framework-components/src/types-import-spec.tspackages/1-framework/1-core/shared/framework-components/tsdown.config.tspackages/1-framework/3-tooling/emitter/package.jsonpackages/1-framework/3-tooling/emitter/src/domain-type-generation.tspackages/1-framework/3-tooling/emitter/src/exports/index.tspackages/1-framework/3-tooling/emitter/src/target-family.tspackages/1-framework/3-tooling/emitter/test/domain-type-generation.test.tspackages/1-framework/3-tooling/emitter/test/emitter.integration.test.tspackages/1-framework/3-tooling/emitter/test/emitter.roundtrip.test.tspackages/1-framework/3-tooling/emitter/test/emitter.test.tspackages/2-mongo-family/1-core/test/fixtures/orm-contract.d.tspackages/2-mongo-family/1-core/test/fixtures/orm-contract.jsonpackages/2-mongo-family/3-tooling/emitter/package.jsonpackages/2-mongo-family/3-tooling/emitter/src/index.tspackages/2-mongo-family/3-tooling/emitter/test/emitter-hook.e2e.test.tspackages/2-mongo-family/3-tooling/emitter/test/emitter-hook.generation.test.tspackages/2-mongo-family/3-tooling/emitter/test/generate-orm-fixture.tspackages/2-sql/2-authoring/contract-ts/src/build-contract.tspackages/2-sql/3-tooling/emitter/src/index.tspackages/2-sql/3-tooling/emitter/test/emitter-hook.generation.basic.test.tspackages/2-sql/3-tooling/emitter/test/emitter-hook.parameterized-types.test.tspackages/2-sql/3-tooling/emitter/test/emitter-hook.types.test.tspackages/2-sql/3-tooling/family/src/core/assembly.tspackages/2-sql/3-tooling/family/src/core/control-instance.tspackages/2-sql/3-tooling/family/test/emit-parameterized.test.tspackages/2-sql/3-tooling/family/test/schema-verify.defaults.test.tspackages/2-sql/5-runtime/test/mutation-default-generators.test.tspackages/2-sql/5-runtime/test/sql-context.test.ts
💤 Files with no reviewable changes (3)
- packages/1-framework/3-tooling/emitter/src/target-family.ts
- packages/1-framework/1-core/shared/contract/README.md
- packages/1-framework/3-tooling/emitter/src/exports/index.ts
closes TML-2193
Intent
Make
@prisma-next/contracta true leaf package with zero framework-domain dependencies by extracting emission SPI types to@prisma-next/framework-components/emission, and express the real layering hierarchy between leaf packages (utils,plan,contract) and framework-core packages (operations,framework-components,config) via a newfoundationlayer.Change map
./emissionsubpath barrel@prisma-next/operationsimport removed@prisma-next/operationsdependency droppedfoundationlayer added,layerOrderupdatedpnpm typecheck.The story
Add emission SPI types to framework-components. Create
emission-types.tswith the emission SPI interfaces (TargetFamilyHook,ValidationContext,GenerateContractTypesOptions,TypeRenderEntry,TypeRenderer,ParameterizedCodecDescriptor). Wire the./emissionsubpath. ConsolidateTypesImportSpecandRenderTypeContextby importing from their existing canonical locations rather than duplicating.Migrate consumers domain-by-domain. Three passes — framework domain (control-plane, emitter), SQL domain (SQL emitter, family), Mongo domain (Mongo emitter). Each pass splits the old
import { Contract, TargetFamilyHook, ... } from '@prisma-next/contract/types'into separate imports: contract data types stay, emission SPI types move to@prisma-next/framework-components/emission.Remove emission SPI types from contract. Delete ~200 lines of type definitions from
contract/src/types.ts, remove re-exports from the./typesbarrel, drop@prisma-next/operationsdependency. Contract is now a true leaf.Clean up naming debt. Remove the pointless
TypeRenderContext = RenderTypeContextalias (consumers now useRenderTypeContextdirectly). Unify the two differentTypeRenderertypes — the emission module now uses the canonical 4-variant union fromtype-renderers.ts. Renametypes.ts→types-import-spec.ts. Delete deademitter/target-family.tsre-export module (zero consumers).Introduce the foundation layer. Move
utils,plan,contractfrom1-core/shared/to0-foundation/shared/. Addfoundationtoarchitecture.config.jsonlayer ordering. Updaterepository.directoryin each moved package.Document the dependency inversion pattern. Add ADR 183 explaining why SPI types live at the lowest consuming layer (framework-components) rather than alongside their implementations (emitters). Update the framework-components README to describe the
./emissionsubpath and its DI rationale.Rewrite the contract README. Remove stale references to emission SPI types,
@prisma-next/operationsdependency, and deleted subpath exports. Fix relative links broken by the directory move.Behavior changes & evidence
Contract package is now a leaf with zero framework-domain dependencies: Before,
@prisma-next/contractdepended on@prisma-next/operations(viaValidationContext's reference toOperationRegistry). After, the contract package depends only on@prisma-next/utilsandarktype.@prisma-next/operationsdependency was architecturally wrong — the contract is a data model package, not an emission SPI package.@prisma-next/operationsremovedimport type { OperationRegistry }removedpnpm lint:depsenforces that foundation-layer packages cannot depend on core-layer packages.Emission SPI types importable from
@prisma-next/framework-components/emission: New subpath providing the canonical import location for all emission pipeline types.Foundation layer enforced in architecture config:
utils,plan,contractatlayer: foundation(belowcore).layerOrder)No behavioral changes to runtime, emitter, or validation logic: Pure code-move. All consumer code changes are import path updates only.
Compatibility / migration / risk
@prisma-next/contract,@prisma-next/utils,@prisma-next/plan) are unchanged. Only directory locations moved.tml-2190-m5-phase-a-update-emission-to-use-new-contract-typesince Phase A modifiesTargetFamilyHookand touches many of the same consumer files.@prisma-next/contract/typeswill get TypeScript errors. All known in-repo consumers are updated.Follow-ups / open questions
core-execution-plane,core-control-planedeprecated re-exports): Will be handled incidentally during M5 Phase A/B when those consumer files are already being modified for theContracttype migration.Non-goals / intentionally out of scope
TargetFamilyHookinterface — deferred to M6.GenerateContractTypesOptions— deferred to M6 (hook interface narrowing).Summary by CodeRabbit
Chores
Documentation