Repository navigation
Conversation
…trol flow inversion) Task 3.9: extract family-agnostic assembly from SQL family package into @prisma-next/contract/assembly, build Mongo family package at layer 9 using the inverted pattern (framework drives assembly). Task 3.11: complete the inversion for SQL — framework orchestration (ControlClient, CLI) calls assembleComponents() and emit() directly, move SQL family package to layer 9. Detailed plans in projects/contract-domain-extraction/plans/.
…state, not assembly functions
…ssembly Move extractCodecTypeImports, extractOperationTypeImports, extractQueryOperationTypeImports, extractExtensionIds, extractParameterizedRenderers, extractParameterizedTypeImports, assembleAuthoringContributions, and supporting helpers from the SQL family package into the framework contract package. Add assembleComponents() with structured input (family, target, adapter?, extensionPacks?) and AssembledComponentState output. Export via @prisma-next/contract/assembly subpath.
Replace local assembly function definitions with re-exports from @prisma-next/contract/assembly. Update extractExtensionIds call sites to use the new (family, target, adapter, extensions) signature. SQL-specific functions (assembleOperationRegistry, extractCodecControlHooks, mutation defaults, PSL interpretation) remain in the SQL package.
Create @prisma-next/family-mongo with MongoFamilyDescriptor, createMongoFamilyInstance, and mongoTargetDescriptor. The descriptor uses the inverted control-flow pattern: assembledState is passed in by the caller rather than assembled internally. Update ControlFamilyDescriptor.create to accept optional assembledState parameter. Register the package in architecture.config.json at the family layer.
Replace direct emit() call with MongoFamilyDescriptor + assembleComponents() + emitContract() flow, demonstrating the inverted control-flow pattern. Remove direct emitter/mongo-emitter dev dependencies in favor of @prisma-next/family-mongo.
…ntrolHooks, note assembledState required in 5.8 - Remove review artifacts from git tracking (local-only) - Add .gitignore entries for review artifact filenames - 3.9 plan: move extractCodecControlHooks to SQL-specific list (operates on TargetBoundComponentDescriptor<sql>) - 3.9 plan: correct plane from "shared" to "migration" - 5.8 plan: note that assembledState should become required once SQL family is migrated
The family package at layer 9 is a top-level entry point that nothing should import from. Placing it at the end of the layer order enforces this invariant.
The function collects IDs from all component types (family, target, adapter, extensions), not just extensions. The new name accurately reflects its behavior.
Remove re-exports of framework assembly functions from packages/2-sql/3-tooling/family/src/core/assembly.ts (non-exports folder). Update test-utils.ts to import from @prisma-next/contract/assembly. Remove unused NormalizedTypeRenderer import.
The helper was defined identically in both the framework assembly and SQL assembly. Export from @prisma-next/contract/assembly and import in the SQL package to eliminate duplication.
Move raw string template, raw function, structured function, CodecTypes interpolation, and missing-parameter tests from the SQL assembly test into the framework assembly test. Delete the SQL assembly.test.ts since all its tests are now covered at the framework level (extractCodecTypeImports and extractComponentIds were already duplicate coverage).
Cover MongoFamilyDescriptor.create (missing state throws, valid state returns instance), descriptor shape, mongoTargetDescriptor shape, and stub methods throwing not-implemented errors.
Document why the double cast (MongoContract -> unknown -> ContractIR) and the emitContract contractIR cast are safe.
Add a new M5 task to extract component descriptors, assembly, authoring types, and emission SPI types from @prisma-next/contract into a dedicated @prisma-next/framework-components package. Introduces a foundation layer below core, making contract a true leaf package with zero framework-domain dependencies (Clean Architecture DIP).
- assembly.ts: import authoring types from framework-authoring (not framework-components, which no longer re-exports them after the base branch restructured authoring types) - SQL exports/control.ts: re-export assembleAuthoringContributions from @prisma-next/contract/assembly (removed from core/assembly) - SQL emitter tests: import extractCodecTypeImports and extractOperationTypeImports from @prisma-next/contract/assembly (removed re-exports from SQL core/assembly)
Task 3.10 extracts @prisma-next/framework-components, renames assembly to createControlStack()/createExecutionStack(), and wires the Mongo demo through both planes. Tasks 5.8 and 5.11 now list 3.10 as a prerequisite and reference the new naming/package. The old 3.10 (Mongo PSL interpreter) is renumbered to 3.11.
New framework-level package for component types, authoring logic, assembly, and stack creation. Will receive code moved from @prisma-next/contract in subsequent commits.
Copy framework-components.ts and framework-authoring.ts from @prisma-next/contract into @prisma-next/framework-components, updating the types import to use @prisma-next/contract/types. Create barrel exports for ./components and ./authoring subpaths.
Rename assembleComponents -> createControlStack, AssembledComponentState -> ControlStack, AssembleComponentsInput -> CreateControlStackInput. Update imports to use @prisma-next/contract/types for TypesImportSpec.
Copy ExecutionStack, ExecutionStackInstance, createExecutionStack, and instantiateExecutionStack from @prisma-next/core-execution-plane into @prisma-next/framework-components with import path updates.
Contract package re-exports assembly and framework-components from @prisma-next/framework-components with old names mapped. Execution-plane re-exports stack from the new package. Delete original source files from contract package.
Replace exported MongoFamilyDescriptor class with a private class and exported const mongoFamilyDescriptor singleton value.
Replace the object-literal factory with a private MongoFamilyInstance class for cleaner encapsulation of assembled state.
…onents Update Mongo family to import ControlStack from the new package. Update demo generate-contract.ts to use createControlStack and mongoFamilyDescriptor const value.
Move test files from @prisma-next/contract to @prisma-next/framework-components, updating imports to use local src paths and renamed functions.
…ontrolPlaneStack divergence, use Framework Component term
Move all execution-plane types, stack functions, and requirements check into framework-components/src/execution-*.ts, split types.ts into execution-instances.ts and execution-descriptors.ts for clarity. Add ./execution subpath export. Convert core-execution-plane to a backward-compatible re-export shim pointing at framework-components/execution.
Update all imports to use @prisma-next/framework-components/{components,authoring}
directly. Delete the contract/framework-components re-export module and
remove framework-components from contract dependencies.
This breaks the dependency inversion: contract no longer depends on
framework-components.
Move TypeRendererTemplate, TypeRendererFunction, TypeRenderer, NormalizedTypeRenderer, interpolateTypeTemplate, normalizeRenderer into type-renderers.ts. Move RenderTypeContext from types.ts into type-renderers.ts where it belongs (with renderers). framework-components.ts retains component descriptors, metadata, and requirements checking. TypesImportSpec stays in types.ts.
…es (F06) Delete the ad-hoc AssemblyInput interface. CreateControlStackInput and all extract* functions now accept ComponentDescriptor<string> directly. Add queryOperationTypes to ComponentMetadata.types to match the field already used by extension descriptors (e.g. pgvector).
…F02/F10, F09) Update the as-never cast TODO in generate-contract.ts to reference F13 stack consolidation. Deduplicate mongo-target-descriptor.ts by spreading from @prisma-next/target-mongo meta instead of redeclaring identity fields.
Task 3.12 (core-execution-plane absorption + contract/framework-components consumer migration) is now done. Note F12 for task 3.11, F13 for a follow-up pass.
The extract* functions in control-stack.ts only access types? and id, not kind/version. Use Pick<ComponentMetadata, 'types'> as the parameter type so callers with intermediate descriptor types (SqlControlDescriptorWithContributions) can pass them directly. CreateControlStackInput still requires full ComponentDescriptor types.
Move ControlFamilyInstance, ControlTargetDescriptor, ControlPlaneStack, and result types from core-control-plane into framework-components as the canonical home. core-control-plane and config become re-export shims. Extract migrations and schema-view into dependency-inverted capability interfaces (MigratableTargetDescriptor + hasMigrations, SchemaViewCapable + hasSchemaView) so framework-components stays free of migration/view domain knowledge. Update CLI consumers to use type predicates.
Extend ControlStack<TFamilyId, TTargetId> with descriptor fields (family, target, adapter, driver, extensionPacks) so it subsumes ControlPlaneStack. ControlPlaneStack becomes a deprecated Pick type alias. Change ControlFamilyDescriptor.create() from dual-arg (stack, controlStack?) to single-arg (controlStack) since ControlStack now carries both descriptors and aggregated metadata. Update all family implementations and call sites. Remove the as-never cast from the Mongo demo generate-contract script.
Re-export createControlStack from framework-components through core-control-plane. Mark createControlPlaneStack as deprecated while keeping it functional for backward compatibility.
📝 WalkthroughWalkthroughCreated a new Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer Script
participant Stack as ControlStack (createControlStack)
participant Family as FamilyDescriptor
participant Instance as FamilyInstance
participant Emitter as Emit Pipeline
Dev->>Stack: createControlStack({ family, target, adapter, driver?, extensionPacks? })
Stack->>Family: passed into family.create(stack)
Family->>Instance: create(stack) -> returns FamilyInstance
Dev->>Instance: instance.emitContract({ contractIR })
Instance->>Emitter: emit(contractIR, codecImports, renderers, ids)
Emitter-->>Dev: { contractJson, contractDts, storageHash, profileHash }
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
|
@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-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/core-control-plane
@prisma-next/core-execution-plane
@prisma-next/config
@prisma-next/contract
@prisma-next/framework-components
@prisma-next/operations
@prisma-next/plan
@prisma-next/utils
commit: |
There was a problem hiding this comment.
Actionable comments posted: 18
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
packages/1-framework/1-core/migration/control-plane/src/stack.ts (1)
1-27: 🛠️ Refactor suggestion | 🟠 MajorRemove the parallel stack constructor instead of keeping both surfaces alive.
createControlStack()andcreateControlPlaneStack()are not equivalent: the new stack carries assembled state, while the legacy wrapper still returns the older, smaller shape. Keeping both here will keep downstream code pinned to the deprecated API and makessrc/stack.tsact as a compatibility shim.As per coding guidelines, "Never add backward-compatibility shims; update call sites instead", "
packages/**: Do not add backward-compatibility shims ... remove old code entirely instead of preserving it with backward-compatibility shims", and "Do not reexport things from one file in another, except in the exports/ folders."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/1-framework/1-core/migration/control-plane/src/stack.ts` around lines 1 - 27, The file currently re-exports createControlStack while also defining a deprecated createControlPlaneStack shim; remove the legacy shim so only the new surface remains: delete the createControlPlaneStack function and its JSDoc, remove or adjust the now-unused type imports (ControlPlaneStack and any types used solely by the removed function), and keep the export { createControlStack } from '@prisma-next/framework-components/control'; ensure no other declarations referencing createControlPlaneStack remain so callers are forced to use createControlStack.packages/1-framework/1-core/migration/control-plane/src/types.ts (1)
8-49: 🛠️ Refactor suggestion | 🟠 MajorKeep re-exports in
src/exports/control.ts, notsrc/types.ts.This file is acting as another barrel for both framework and migration types, which adds a parallel entrypoint outside the migration-plane export surface. Import the source modules directly here and let
src/exports/control.tsown the public re-export.As per coding guidelines, "Import control plane/tooling only from
src/exports/control.ts" and "Do not reexport things from one file in another, except in the exports/ folders."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/1-framework/1-core/migration/control-plane/src/types.ts` around lines 8 - 49, This file is incorrectly re-exporting control and migration types (e.g., ControlAdapterDescriptor, ControlDriverInstance, ControlPlaneStack, MigrationPlanner, MigrationPlan, MigrationRunnerResult) creating a parallel public entrypoint; remove these export blocks from this types.ts and instead import the original modules directly where needed, and centralize the public re-exports in the project's control exports barrel (the exports/control module) so all consumers import control-plane/tooling from that single exports barrel.
🧹 Nitpick comments (13)
architecture.config.json (1)
243-248: Consider more granular glob patterns for multi-plane extensibility.The SQL family package (
packages/2-sql/3-tooling/family/...) uses separate globs for different planes:src/core/**(shared),exports/control.ts(migration),exports/runtime.ts(runtime). The Mongo family registration uses a single broad globpackages/2-mongo-family/9-family/**mapped entirely to the migration plane.If this package will eventually include shared core types or runtime exports (similar to the SQL family pattern), consider adding granular globs now to avoid rework. If the package is intentionally migration-plane-only with no anticipated multi-plane support, this is fine as-is.
As per coding guidelines: "Architecture configuration in
architecture.config.jsonmust define multiple globs for multi-plane packages, with one glob per plane (shared, migration, runtime)."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@architecture.config.json` around lines 243 - 248, The current registration uses one broad glob "packages/2-mongo-family/9-family/**" mapped to the migration plane; instead, split this into separate architecture entries mirroring the SQL pattern by adding distinct globs for shared core (e.g. "packages/2-mongo-family/9-family/src/core/**" with plane "shared"), migration exports (e.g. "packages/2-mongo-family/9-family/exports/control.ts" with plane "migration"), and runtime exports (e.g. "packages/2-mongo-family/9-family/exports/runtime.ts" with plane "runtime"); if the package truly is migration-only, explicitly document that intent (or keep the single migration-only entry) — update the object containing the glob "packages/2-mongo-family/9-family/**" accordingly.packages/2-mongo-family/9-family/tsconfig.json (2)
9-9: Add fixture exclusion to align with tsconfig rule.Line 9 should also exclude
test/fixtures/**/*to avoid fixture typechecking bleed-through.As per coding guidelines: "
**/tsconfig.json: Exclude test fixture files from TypeScript typechecking in tsconfig.json using 'exclude': ['test/fixtures/**/*'] because fixtures often use internal types that aren't exported from packages."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/2-mongo-family/9-family/tsconfig.json` at line 9, Update the tsconfig.json "exclude" array to also include the test fixture path so fixture files are not typechecked; specifically modify the existing "exclude" entry (the "exclude" key in tsconfig.json) to add "test/fixtures/**/*" alongside "dist".
5-5: Use dedicated TypeScript emit directory instead ofdist.Line 5 sets
outDirto./dist, which can collide with bundler artifacts; usedist-tscfor base config and keep prod config fordist-tsc-prod.Based on learnings: "Ensure TypeScript emit outputs are configured to dedicated output directories (e.g., dist-tsc for regular builds and dist-tsc-prod for production builds) via tsconfig settings."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/2-mongo-family/9-family/tsconfig.json` at line 5, The tsconfig.json currently sets the TypeScript emit directory to "./dist" via the "outDir" property; change "outDir" in this base tsconfig (the "outDir" setting) to a dedicated emit directory like "./dist-tsc" and ensure any production/override tsconfig uses "./dist-tsc-prod" so compiled TS output won't collide with bundler artifacts.packages/1-framework/3-tooling/cli/src/utils/migration-command-scaffold.ts (1)
2-2: Usepatheinstead ofnode:pathin CLI tooling files.This CLI source file imports from
node:path, but per coding guidelines, CLI commands and tooling files should usepathefor consistent cross-platform behavior.♻️ Suggested fix
-import { relative, resolve } from 'node:path'; +import { relative, resolve } from 'pathe';Based on learnings: "In the Prisma-next repository, prefer importing and using 'pathe' over the built-in 'node:path' module for path operations across the codebase (including CLI commands and tooling files)."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/1-framework/3-tooling/cli/src/utils/migration-command-scaffold.ts` at line 2, Replace the import from node:path with pathe to follow CLI tooling guidelines: change the import of the path helpers (relative, resolve) currently imported from 'node:path' to be imported from 'pathe' (the rest of the file's uses of relative and resolve can remain unchanged because pathe exposes the same functions).test/integration/test/family.introspect.integration.test.ts (1)
66-74: LGTM with optional suggestion: Consider extracting repeated control-stack creation.The control-stack migration is correct and consistent across all 10 test cases. However, the identical
createControlStack({ family: sql, target: postgres, adapter: postgresAdapter, driver: postgresDriver, extensionPacks: [] })pattern is repeated in each test.♻️ Optional: Extract to a helper function
// At the top of the describe block or in a shared helper const createSqlFamilyInstance = () => sql.create( createControlStack({ family: sql, target: postgres, adapter: postgresAdapter, driver: postgresDriver, extensionPacks: [], }), );Then use
const familyInstance = createSqlFamilyInstance();in each test.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/integration/test/family.introspect.integration.test.ts` around lines 66 - 74, The repeated creation of the control-stack using sql.create(createControlStack({...})) across tests should be extracted into a small helper to reduce duplication; add a function (e.g., createSqlFamilyInstance) near the top of the describe block or in a shared test helper that returns sql.create(createControlStack({ family: sql, target: postgres, adapter: postgresAdapter, driver: postgresDriver, extensionPacks: [] })), then replace each direct use where familyInstance is assigned with a call to createSqlFamilyInstance(); this targets the sql.create and createControlStack usage and the familyInstance assignments to centralize the setup.packages/1-framework/3-tooling/cli/test/control-api/client.test.ts (1)
79-84: Make these target mocks descriptor-shaped.The arity update is fine, but both casts still widen partial objects into
ControlTargetDescriptor<any, any, any>. That hides missing descriptor fields and makes the tests less sensitive to regressions in control-stack assembly that start reading more of the target contract.As per coding guidelines "All control plane descriptors must include
idproperty as a string identifier", "manifestproperty of typeExtensionPackManifest", and a "create()factory method", and "Never use any type in TypeScript".Also applies to: 620-626
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/1-framework/3-tooling/cli/test/control-api/client.test.ts` around lines 79 - 84, The test's mockTarget currently casts a partial object to ControlTargetDescriptor<any, any, any>, hiding missing fields; update the mock to be a full descriptor-shaped object by adding the required id (string), manifest (ExtensionPackManifest) and a create() factory method that returns the expected target instance, and remove the use of any in the descriptor generics (use concrete generics or unknown) so the mock type enforces shape; apply the same change to the other mocks mentioned (the ones around the other occurrence) so tests exercise the real descriptor contract instead of widening with any.test/integration/test/family.schema-verify.dependencies.integration.test.ts (1)
66-74: Collapse the repeated SQL stack setup into a helper.These seven
createControlStack(...)blocks all encode the same SQL/Postgres fixture, while the file also mirrors enabled components separately inframeworkComponents. A small helper that builds both from one input would make future stack or extension changes a single edit instead of several.Also applies to: 136-144, 191-199, 226-234, 259-267, 309-317, 398-406
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/integration/test/family.schema-verify.dependencies.integration.test.ts` around lines 66 - 74, Multiple test blocks duplicate the same createControlStack(...) configuration (used to build familyInstance via sql.create and mirrored in frameworkComponents); extract a small helper function (e.g., buildPgTestStack or makeSqlPostgresFixture) that accepts the common inputs (sql, postgres, postgresAdapter, postgresDriver, pgvector) and returns both the control stack object for sql.create (used where familyInstance is created) and the corresponding frameworkComponents array so each test uses the single helper to produce both values; update all occurrences referencing createControlStack, familyInstance, and frameworkComponents to call the helper instead of repeating the seven-argument literal.examples/mongo-demo/scripts/generate-contract.ts (1)
2-2: Usepatheinstead ofnode:pathfor path operations.Per coding guidelines,
patheshould be used for consistent cross-platform behavior.Suggested fix
-import { resolve } from 'node:path'; +import { resolve } from 'pathe';Based on learnings: "In the Prisma-next repository, prefer importing and using 'pathe' over the built-in 'node:path' module for path operations across the codebase."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@examples/mongo-demo/scripts/generate-contract.ts` at line 2, Replace the import of resolve from the Node core module with the pathe package to ensure cross-platform path handling: change the import statement that currently imports resolve from 'node:path' to import resolve from 'pathe' (update the top-level import where resolve is referenced in this file, i.e., the import line in generate-contract.ts).packages/1-framework/1-core/shared/framework-components/README.md (1)
19-23: Keep the README focused on the supported API.The backward-compatibility note and the
~70 consumers on maincount are rollout details that will go stale quickly. For a package README, it’s clearer to document the canonical import path only and move migration notes elsewhere if they still matter.✏️ Suggested wording
## Relationship to other packages -This package is the canonical source for framework component types and assembly logic. `@prisma-next/contract/framework-components` re-exports `./components` and `./authoring` for backward compatibility (~70 consumers on main). - -New code should import directly from `@prisma-next/framework-components`. +This package is the canonical source for framework component types and assembly logic. + +Import from `@prisma-next/framework-components` and its documented subpaths directly.As per coding guidelines, "
packages/**/*.md: Update design docs to reflect the current state only, not the transition history or legacy approaches" and "**/README.md: For user-facing packages, keep README.md focused on what the package does, when to use it, and a few concrete examples. Avoid internal implementation detail unless it materially affects usage."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/1-framework/1-core/shared/framework-components/README.md` around lines 19 - 23, Update the README to remove the backward-compatibility rollout details and stale consumer counts: keep only the supported API and canonical import guidance by stating that this package is the canonical source for framework component types and assembly logic and that new code should import from "@prisma-next/framework-components"; remove the sentence mentioning "@prisma-next/contract/framework-components" re-exports and the "~70 consumers on main" note, and if migration guidance is needed, move it to a separate migration or release note document instead of the README.packages/2-mongo-family/9-family/package.json (1)
7-13: Clean the TypeScript emit directories too.
tscin this repo can leave artifacts indist-tscanddist-tsc-prod; keeping those out of the clean step makes local rebuilds and publish checks less reliable. Based on learnings,TypeScript outputs are configured to emit to dist-tsc (regular builds via base tsconfig) and dist-tsc-prod (production builds via prod tsconfig). Ensure clean scripts remove dist, dist-tsc, and dist-tsc-prod directories so a full clean is performed.Suggested cleanup update
- "clean": "rm -rf dist coverage" + "clean": "rm -rf dist dist-tsc dist-tsc-prod coverage"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/2-mongo-family/9-family/package.json` around lines 7 - 13, Update the "clean" npm script in package.json to remove TypeScript emit dirs too: modify the scripts.clean entry (currently "clean") to delete dist, dist-tsc, and dist-tsc-prod so tsc artifacts are fully removed; ensure the command removes all three directories (e.g., using rm -rf or cross-platform equivalent) to guarantee a full clean before rebuilds/publishes.packages/2-sql/3-tooling/family/src/core/control-instance.ts (1)
14-17: Use the control target descriptor at this boundary.
CreateSqlFamilyInstanceOptions.targetis still built on the sharedTargetDescriptor, so this factory no longer enforces the control-plane descriptor contract at compile time. Please switch it to the SQL control target descriptor type instead of the base component type. As per coding guidelines,Use ControlTargetDescriptor<TFamilyId, TTargetId, TTargetInstance> type for target descriptors in control plane implementationsandDo not use legacy descriptor types (FamilyDescriptor, TargetDescriptor, AdapterDescriptor, DriverDescriptor, ExtensionDescriptor, ControlPlaneDriver).Also applies to: 221-228
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/2-sql/3-tooling/family/src/core/control-instance.ts` around lines 14 - 17, CreateSqlFamilyInstanceOptions.target currently uses the legacy TargetDescriptor type; change it to the control-plane descriptor by importing and using ControlTargetDescriptor<TFamilyId, TTargetId, TTargetInstance> (replace the TargetDescriptor reference in the CreateSqlFamilyInstanceOptions type with ControlTargetDescriptor and update the import to pull ControlTargetDescriptor from the control-plane types module), and apply the same replacement for the other occurrences mentioned (the block around the current lines 221-228) so the factory enforces the SQL control target descriptor contract at compile time.packages/1-framework/1-core/shared/framework-components/src/execution-requirements.ts (1)
42-46: Only the first missing extension pack is reported.The loop throws on the first missing extension pack ID, so users won't see all missing dependencies at once. Consider collecting all missing IDs and throwing a single comprehensive error.
♻️ Proposed improvement to report all missing packs
- for (const packId of result.missingExtensionPackIds) { - throw new Error( - `Contract requires extension pack '${packId}', but runtime descriptors do not provide a matching component.`, - ); - } + if (result.missingExtensionPackIds.length > 0) { + const packList = result.missingExtensionPackIds.map((id) => `'${id}'`).join(', '); + throw new Error( + `Contract requires extension pack(s) ${packList}, but runtime descriptors do not provide matching component(s).`, + ); + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/1-framework/1-core/shared/framework-components/src/execution-requirements.ts` around lines 42 - 46, The current loop throws on the first missingExtensionPackIds entry (result.missingExtensionPackIds/packId), so only one missing pack shows; instead, gather all missing IDs from result.missingExtensionPackIds and throw a single Error that lists them all (e.g., join the array into a comma-separated string) so the error message reports every missing extension pack at once.packages/2-mongo-family/9-family/src/core/control-instance.ts (1)
68-75: UseifDefined()for conditional object spread.As per coding guidelines, use
ifDefined()from@prisma-next/utils/definedfor conditional object spreads instead of inline conditional spread patterns.♻️ Proposed fix using ifDefined
+import { ifDefined } from '@prisma-next/utils/defined'; ... return { contractJson: result.contractJson, contractDts: result.contractDts, storageHash: result.storageHash, - ...(result.executionHash ? { executionHash: result.executionHash } : {}), + ...ifDefined(result.executionHash, (h) => ({ executionHash: h })), profileHash: result.profileHash, };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/2-mongo-family/9-family/src/core/control-instance.ts` around lines 68 - 75, The returned object uses an inline conditional spread for result.executionHash; replace that pattern with ifDefined to follow the guideline: import ifDefined from '@prisma-next/utils/defined' (if not already imported) and change the spread ...(result.executionHash ? { executionHash: result.executionHash } : {}) to using ifDefined('executionHash', result.executionHash) while keeping the other properties (contractJson, contractDts, storageHash, profileHash) unchanged; ensure you reference the same result variable and property name executionHash so the returned shape is identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/glossary.md`:
- Around line 147-187: Update the "Divergence" note to state that consolidation
is complete: replace the "Status: pending." sentence with a short note that
ControlStack and ControlPlaneStack have been consolidated in task 3.13,
ControlStack now carries both descriptors and aggregated contributions,
ControlPlaneStack remains only as a deprecated type alias, and the canonical
factory is createControlStack() from `@prisma-next/framework-components/control`;
ensure you reference the symbols ControlStack, ControlPlaneStack, and
createControlStack() in the revised sentence.
In `@packages/1-framework/1-core/migration/control-plane/src/types.ts`:
- Around line 67-70: The hasMigrations predicate currently uses truthiness and
can falsely narrow malformed descriptors; update hasMigrations to verify the
migrations capability shape rather than just truthiness: ensure
target.migrations is a non-null object and contains the expected capability
methods/keys (e.g. check typeof migrations === 'object' && migrations !== null
&& typeof migrations.<expectedMethod> === 'function' or presence of required
keys) so it reliably narrows target to MigratableTargetDescriptor<TFamilyId,
TTargetId> / TargetMigrationsCapability in callers like hasMigrations.
In `@packages/1-framework/1-core/runtime/execution-plane/src/types.ts`:
- Around line 1-12: This file is merely re-exporting public types from
`@prisma-next/framework-components/execution` which creates an unnecessary
indirection; update the repository to stop re-exporting that barrel from runtime
plane: either remove these exports from
packages/1-framework/1-core/runtime/execution-plane/src/types.ts and import
RuntimeAdapterDescriptor, RuntimeAdapterInstance, RuntimeDriverDescriptor,
RuntimeDriverInstance, RuntimeExtensionDescriptor, RuntimeExtensionInstance,
RuntimeFamilyDescriptor, RuntimeFamilyInstance, RuntimeTargetDescriptor,
RuntimeTargetInstance directly where they are used, or move any
runtime-plane-specific type subsets into this file (src/core/) and expose them
through the designated plane entrypoint (src/exports/runtime.ts) so the runtime
plane does not reexport another package's barrel.
In `@packages/1-framework/1-core/shared/framework-components/package.json`:
- Line 12: The npm "clean" script currently only removes "dist"; update the
"clean" script in package.json (the "clean" script entry) to also remove
TypeScript emit directories "dist-tsc" and "dist-tsc-prod" so stale type-build
artifacts are removed; modify the "clean" script value to include both
"dist-tsc" and "dist-tsc-prod" alongside "dist" (ensuring it still works
cross-platform or follows the repo's existing shell convention).
- Around line 14-17: The package.json in framework-components incorrectly lists
"@prisma-next/utils" under "dependencies", violating shared-plane rules; remove
"@prisma-next/utils" from the dependencies block and either move it to
"devDependencies" if it's only used at build/test time or replace its usage with
an allowed shared-plane dependency (e.g., refactor imports to use
"@prisma-next/contract" or "@prisma-next/operations"); update any code
referencing "@prisma-next/utils" accordingly to the chosen replacement and run a
local build to verify.
In
`@packages/1-framework/1-core/shared/framework-components/src/control-descriptors.ts`:
- Around line 18-25: Remove the deprecated compatibility alias
ControlPlaneStack: delete the exported type alias named
ControlPlaneStack<TFamilyId extends string, TTargetId extends string> (the Pick
of ControlStack) and any direct export of that symbol; replace any internal
usages that import or reference ControlPlaneStack to use ControlStack<TFamilyId,
TTargetId> directly, and run tests/build to ensure no remaining references; do
not add any shim or deprecation comments—fully remove the declaration and its
export.
In
`@packages/1-framework/1-core/shared/framework-components/src/control-instances.ts`:
- Around line 64-70: The shared ControlDriverInstance interface currently
includes a SQL-specific query method; remove query from ControlDriverInstance so
it remains family-neutral (leave ControlDriverInstance<TFamilyId, TTargetId>
extending DriverInstance only), and introduce a new family-specific interface
(e.g., SqlControlDriverInstance<TFamilyId, TTargetId>) that declares
query<Row=...>(sql: string, params?: readonly unknown[]): Promise<{ readonly
rows: Row[] }> and close(): Promise<void>; update any SQL-family drivers to
implement SqlControlDriverInstance instead of the base ControlDriverInstance and
adjust uses to rely on the family-specific interface where SQL execution is
required.
- Line 55: Change the emitContract signature to accept a single unknown-typed
parameter instead of the redundant union; update the declaration
emitContract(options: { readonly contractIR: ContractIR | unknown }):
Promise<EmitContractResult> to use unknown for contractIR (e.g. contractIR:
unknown) so callers see the intended flexible input type, and ensure the
implementation continues to validate using normalizeProviderContractIR() as
documented.
In
`@packages/1-framework/1-core/shared/framework-components/src/control-stack.ts`:
- Around line 38-40: The assembled control stack currently omits the driver by
building allDescriptors without the driver and populates extensionIds from
extractComponentIds (which omits driver), causing driver-owned imports/metadata
and the driver's id to be lost or mislabeled; fix by including the driver
descriptor when computing allDescriptors (or adjust the driver into the source
list used by allDescriptors), and either change extractComponentIds to include
the driver or, preferably, populate extensionIds from only extension descriptors
so the field is clearly extension-only; update usages around allDescriptors,
extractComponentIds, and extensionIds (also present in the other affected
blocks) to ensure driver imports, authoring helpers, renderer ownership and id
are folded into the stack correctly.
- Around line 294-304: The code currently holds the caller's extensionPacks
array by reference which can be mutated later and desynchronize derived fields;
fix it by snapshotting a shallow copy of extensionPacks up-front (e.g., create a
const extensionPacksSnapshot = [...extensionPacks] and use that snapshot
everywhere) so that allDescriptors, derived imports/rendererMap/ids/authoring
contributions and the returned extensionPacks property reference the immutable
snapshot (apply the same readonly typing/cast used on extensionPacks when
returning).
In
`@packages/1-framework/1-core/shared/framework-components/src/execution-descriptors.ts`:
- Around line 20-24: The create signature on RuntimeFamilyDescriptor.create
requires a driver but ExecutionStack/createExecutionStack allow omitting it;
make the contracts consistent by making the driver optional in the create
options (change the parameter type for driver to
RuntimeDriverDescriptor<TFamilyId, TTargetId> | undefined / mark as readonly
driver?: RuntimeDriverDescriptor<...>), and update any internal handling in
RuntimeFamilyDescriptor.create to accept and correctly handle a missing driver
(e.g., treat as undefined or null-safe path). Ensure references in code that
construct or pass ExecutionStack objects to RuntimeFamilyDescriptor.create no
longer need casts by aligning the driver optionality with ExecutionStack and
createExecutionStack.
In `@packages/1-framework/1-core/shared/framework-components/tsconfig.json`:
- Line 7: Update the tsconfig.json exclude list to also exclude test fixture
files so they aren't typechecked: add the glob pattern "test/fixtures/**/*" to
the existing "exclude" array (which currently contains "dist" and
"node_modules") ensuring the array preserves existing entries and formatting.
In `@packages/2-mongo-family/9-family/package.json`:
- Around line 33-45: The package currently publishes the control-plane at the
package root (the "." export and root "main"/"module"/"types" fields pointing to
dist/control.*); change the exports to publish the control surface under the
subpath "./control" (e.g. add "./control": "./dist/control.mjs" and remove the
"." root export), and update the package metadata entries ("main", "module",
"types") or add corresponding entries so the control-plane files are exposed
only via "./control" and include the matching architecture metadata under that
subpath in package.json. Ensure "./package.json" export stays and that no
plane-specific files are exported from the package root.
In `@packages/2-mongo-family/9-family/src/core/mongo-target-descriptor.ts`:
- Around line 4-15: Replace the current type assertion on mongoTargetDescriptor
that uses TargetDescriptor<'mongo','mongo'> with
ControlTargetDescriptor<'mongo','mongo', MongoTargetInstance> and add the
necessary import for ControlTargetDescriptor and MongoTargetInstance from
'@prisma-next/framework-components/components'; specifically update the trailing
"as const satisfies ..." expression on mongoTargetDescriptor to satisfy
ControlTargetDescriptor<'mongo','mongo', MongoTargetInstance> so the descriptor
uses the control-plane-specific type.
In `@packages/2-mongo-family/9-family/test/control.test.ts`:
- Around line 8-21: The test's createMinimalControlStack() constructs an
unrealistic ControlStack (extensionPacks empty but extensionIds contains
duplicates), so replace its manual assembly by calling the real factory
createControlStack() to produce a production-consistent stack; ensure the test
invokes createControlStack() (or the same factory used by
createMongoFamilyInstance) and then use that returned object's
extensionPacks/extensionIds rather than hand-crafting them, so the
createMongoFamilyInstance() is exercised against a realistic, assembled state.
In `@packages/2-sql/3-tooling/family/src/core/control-instance.ts`:
- Around line 18-25: extractComponentIds() returns all component IDs (family,
target, adapter, and extensions) but the emitter's extensionIds parameter should
only contain extension pack IDs; update the code that passes
extractComponentIds() to the emitter (the extensionIds argument) to filter the
result to extension descriptors only (e.g., call extractComponentIds(), then
filter by the extension-type predicate or helper you have for identifying
extension descriptors) before emitting, or rename the helper/parameter if the
intent is to pass all component IDs instead of just extensions.
In `@packages/2-sql/3-tooling/family/test/emit-parameterized.test.ts`:
- Line 3: Replace the legacy TargetDescriptor import and usages with the
control-plane type: import and use ControlTargetDescriptor<'sql','postgres',
TTargetInstance> instead of TargetDescriptor, and update the createMockTarget()
typing to return ControlTargetDescriptor<'sql','postgres', ...> (match the
appropriate TTargetInstance used in this test) so the test uses the
ControlTargetDescriptor contract; update any variable/type annotations that
reference TargetDescriptor to the new ControlTargetDescriptor type and remove
the old import.
In `@packages/3-extensions/pgvector/package.json`:
- Line 22: The package.json currently lists "@prisma-next/framework-components"
under "dependencies" but it is only used for TypeScript types; move the
"@prisma-next/framework-components": "workspace:*" entry from "dependencies"
into "devDependencies" in package.json so it’s treated as a dev-only, type-only
dependency, then run the package manager install to update lockfiles; keep the
exact version spec ("workspace:*") when moving to "devDependencies".
---
Outside diff comments:
In `@packages/1-framework/1-core/migration/control-plane/src/stack.ts`:
- Around line 1-27: The file currently re-exports createControlStack while also
defining a deprecated createControlPlaneStack shim; remove the legacy shim so
only the new surface remains: delete the createControlPlaneStack function and
its JSDoc, remove or adjust the now-unused type imports (ControlPlaneStack and
any types used solely by the removed function), and keep the export {
createControlStack } from '@prisma-next/framework-components/control'; ensure no
other declarations referencing createControlPlaneStack remain so callers are
forced to use createControlStack.
In `@packages/1-framework/1-core/migration/control-plane/src/types.ts`:
- Around line 8-49: This file is incorrectly re-exporting control and migration
types (e.g., ControlAdapterDescriptor, ControlDriverInstance, ControlPlaneStack,
MigrationPlanner, MigrationPlan, MigrationRunnerResult) creating a parallel
public entrypoint; remove these export blocks from this types.ts and instead
import the original modules directly where needed, and centralize the public
re-exports in the project's control exports barrel (the exports/control module)
so all consumers import control-plane/tooling from that single exports barrel.
---
Nitpick comments:
In `@architecture.config.json`:
- Around line 243-248: The current registration uses one broad glob
"packages/2-mongo-family/9-family/**" mapped to the migration plane; instead,
split this into separate architecture entries mirroring the SQL pattern by
adding distinct globs for shared core (e.g.
"packages/2-mongo-family/9-family/src/core/**" with plane "shared"), migration
exports (e.g. "packages/2-mongo-family/9-family/exports/control.ts" with plane
"migration"), and runtime exports (e.g.
"packages/2-mongo-family/9-family/exports/runtime.ts" with plane "runtime"); if
the package truly is migration-only, explicitly document that intent (or keep
the single migration-only entry) — update the object containing the glob
"packages/2-mongo-family/9-family/**" accordingly.
In `@examples/mongo-demo/scripts/generate-contract.ts`:
- Line 2: Replace the import of resolve from the Node core module with the pathe
package to ensure cross-platform path handling: change the import statement that
currently imports resolve from 'node:path' to import resolve from 'pathe'
(update the top-level import where resolve is referenced in this file, i.e., the
import line in generate-contract.ts).
In `@packages/1-framework/1-core/shared/framework-components/README.md`:
- Around line 19-23: Update the README to remove the backward-compatibility
rollout details and stale consumer counts: keep only the supported API and
canonical import guidance by stating that this package is the canonical source
for framework component types and assembly logic and that new code should import
from "@prisma-next/framework-components"; remove the sentence mentioning
"@prisma-next/contract/framework-components" re-exports and the "~70 consumers
on main" note, and if migration guidance is needed, move it to a separate
migration or release note document instead of the README.
In
`@packages/1-framework/1-core/shared/framework-components/src/execution-requirements.ts`:
- Around line 42-46: The current loop throws on the first
missingExtensionPackIds entry (result.missingExtensionPackIds/packId), so only
one missing pack shows; instead, gather all missing IDs from
result.missingExtensionPackIds and throw a single Error that lists them all
(e.g., join the array into a comma-separated string) so the error message
reports every missing extension pack at once.
In `@packages/1-framework/3-tooling/cli/src/utils/migration-command-scaffold.ts`:
- Line 2: Replace the import from node:path with pathe to follow CLI tooling
guidelines: change the import of the path helpers (relative, resolve) currently
imported from 'node:path' to be imported from 'pathe' (the rest of the file's
uses of relative and resolve can remain unchanged because pathe exposes the same
functions).
In `@packages/1-framework/3-tooling/cli/test/control-api/client.test.ts`:
- Around line 79-84: The test's mockTarget currently casts a partial object to
ControlTargetDescriptor<any, any, any>, hiding missing fields; update the mock
to be a full descriptor-shaped object by adding the required id (string),
manifest (ExtensionPackManifest) and a create() factory method that returns the
expected target instance, and remove the use of any in the descriptor generics
(use concrete generics or unknown) so the mock type enforces shape; apply the
same change to the other mocks mentioned (the ones around the other occurrence)
so tests exercise the real descriptor contract instead of widening with any.
In `@packages/2-mongo-family/9-family/package.json`:
- Around line 7-13: Update the "clean" npm script in package.json to remove
TypeScript emit dirs too: modify the scripts.clean entry (currently "clean") to
delete dist, dist-tsc, and dist-tsc-prod so tsc artifacts are fully removed;
ensure the command removes all three directories (e.g., using rm -rf or
cross-platform equivalent) to guarantee a full clean before rebuilds/publishes.
In `@packages/2-mongo-family/9-family/src/core/control-instance.ts`:
- Around line 68-75: The returned object uses an inline conditional spread for
result.executionHash; replace that pattern with ifDefined to follow the
guideline: import ifDefined from '@prisma-next/utils/defined' (if not already
imported) and change the spread ...(result.executionHash ? { executionHash:
result.executionHash } : {}) to using ifDefined('executionHash',
result.executionHash) while keeping the other properties (contractJson,
contractDts, storageHash, profileHash) unchanged; ensure you reference the same
result variable and property name executionHash so the returned shape is
identical.
In `@packages/2-mongo-family/9-family/tsconfig.json`:
- Line 9: Update the tsconfig.json "exclude" array to also include the test
fixture path so fixture files are not typechecked; specifically modify the
existing "exclude" entry (the "exclude" key in tsconfig.json) to add
"test/fixtures/**/*" alongside "dist".
- Line 5: The tsconfig.json currently sets the TypeScript emit directory to
"./dist" via the "outDir" property; change "outDir" in this base tsconfig (the
"outDir" setting) to a dedicated emit directory like "./dist-tsc" and ensure any
production/override tsconfig uses "./dist-tsc-prod" so compiled TS output won't
collide with bundler artifacts.
In `@packages/2-sql/3-tooling/family/src/core/control-instance.ts`:
- Around line 14-17: CreateSqlFamilyInstanceOptions.target currently uses the
legacy TargetDescriptor type; change it to the control-plane descriptor by
importing and using ControlTargetDescriptor<TFamilyId, TTargetId,
TTargetInstance> (replace the TargetDescriptor reference in the
CreateSqlFamilyInstanceOptions type with ControlTargetDescriptor and update the
import to pull ControlTargetDescriptor from the control-plane types module), and
apply the same replacement for the other occurrences mentioned (the block around
the current lines 221-228) so the factory enforces the SQL control target
descriptor contract at compile time.
In `@test/integration/test/family.introspect.integration.test.ts`:
- Around line 66-74: The repeated creation of the control-stack using
sql.create(createControlStack({...})) across tests should be extracted into a
small helper to reduce duplication; add a function (e.g.,
createSqlFamilyInstance) near the top of the describe block or in a shared test
helper that returns sql.create(createControlStack({ family: sql, target:
postgres, adapter: postgresAdapter, driver: postgresDriver, extensionPacks: []
})), then replace each direct use where familyInstance is assigned with a call
to createSqlFamilyInstance(); this targets the sql.create and createControlStack
usage and the familyInstance assignments to centralize the setup.
In `@test/integration/test/family.schema-verify.dependencies.integration.test.ts`:
- Around line 66-74: Multiple test blocks duplicate the same
createControlStack(...) configuration (used to build familyInstance via
sql.create and mirrored in frameworkComponents); extract a small helper function
(e.g., buildPgTestStack or makeSqlPostgresFixture) that accepts the common
inputs (sql, postgres, postgresAdapter, postgresDriver, pgvector) and returns
both the control stack object for sql.create (used where familyInstance is
created) and the corresponding frameworkComponents array so each test uses the
single helper to produce both values; update all occurrences referencing
createControlStack, familyInstance, and frameworkComponents to call the helper
instead of repeating the seven-argument literal.
🪄 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: 4c1ab214-5644-49a5-8785-aced2bdec070
⛔ Files ignored due to path filters (11)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlprojects/contract-domain-extraction/plan.mdis excluded by!projects/**projects/contract-domain-extraction/plans/3.10-extract-framework-components-and-unify-stacks-plan.mdis excluded by!projects/**projects/contract-domain-extraction/plans/3.13-consolidate-control-plane-types-into-framework-components-plan.mdis excluded by!projects/**projects/contract-domain-extraction/plans/3.8-hook-up-mongo-demo-to-emitter.mdis excluded by!projects/**projects/contract-domain-extraction/plans/3.9-extract-assembly-mongo-control-plane-plan.mdis excluded by!projects/**projects/contract-domain-extraction/plans/5.11-extract-framework-components-package-plan.mdis excluded by!projects/**projects/contract-domain-extraction/plans/5.8-control-flow-inversion-plan.mdis excluded by!projects/**projects/contract-domain-extraction/reviews/code-review.mdis excluded by!projects/**projects/contract-domain-extraction/reviews/system-design-review.mdis excluded by!projects/**projects/contract-domain-extraction/reviews/walkthrough.mdis excluded by!projects/**
📒 Files selected for processing (158)
.gitignorearchitecture.config.jsondocs/glossary.mdexamples/mongo-demo/package.jsonexamples/mongo-demo/scripts/generate-contract.tsexamples/mongo-demo/src/contract.d.tsexamples/mongo-demo/src/contract.jsonpackages/1-framework/1-core/migration/control-plane/package.jsonpackages/1-framework/1-core/migration/control-plane/src/exports/stack.tspackages/1-framework/1-core/migration/control-plane/src/exports/types.tspackages/1-framework/1-core/migration/control-plane/src/migrations.tspackages/1-framework/1-core/migration/control-plane/src/stack.tspackages/1-framework/1-core/migration/control-plane/src/types.tspackages/1-framework/1-core/runtime/execution-plane/package.jsonpackages/1-framework/1-core/runtime/execution-plane/src/framework-components.tspackages/1-framework/1-core/runtime/execution-plane/src/stack.tspackages/1-framework/1-core/runtime/execution-plane/src/types.tspackages/1-framework/1-core/shared/config/package.jsonpackages/1-framework/1-core/shared/config/src/types.tspackages/1-framework/1-core/shared/contract/package.jsonpackages/1-framework/1-core/shared/contract/src/exports/framework-components.tspackages/1-framework/1-core/shared/contract/tsdown.config.tspackages/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-instances.tspackages/1-framework/1-core/shared/framework-components/src/control-result-types.tspackages/1-framework/1-core/shared/framework-components/src/control-stack.tspackages/1-framework/1-core/shared/framework-components/src/execution-descriptors.tspackages/1-framework/1-core/shared/framework-components/src/execution-instances.tspackages/1-framework/1-core/shared/framework-components/src/execution-requirements.tspackages/1-framework/1-core/shared/framework-components/src/execution-stack.tspackages/1-framework/1-core/shared/framework-components/src/exports/authoring.tspackages/1-framework/1-core/shared/framework-components/src/exports/components.tspackages/1-framework/1-core/shared/framework-components/src/exports/control.tspackages/1-framework/1-core/shared/framework-components/src/exports/execution.tspackages/1-framework/1-core/shared/framework-components/src/framework-authoring.tspackages/1-framework/1-core/shared/framework-components/src/framework-components.tspackages/1-framework/1-core/shared/framework-components/src/type-renderers.tspackages/1-framework/1-core/shared/framework-components/src/types.tspackages/1-framework/1-core/shared/framework-components/test/control-stack.test.tspackages/1-framework/1-core/shared/framework-components/test/execution-requirements.test.tspackages/1-framework/1-core/shared/framework-components/test/execution-stack.test.tspackages/1-framework/1-core/shared/framework-components/test/execution-stack.types.test-d.tspackages/1-framework/1-core/shared/framework-components/test/framework-components.authoring.test.tspackages/1-framework/1-core/shared/framework-components/test/framework-components.renderer.test.tspackages/1-framework/1-core/shared/framework-components/test/framework-components.requirements.test.tspackages/1-framework/1-core/shared/framework-components/tsconfig.jsonpackages/1-framework/1-core/shared/framework-components/tsconfig.prod.jsonpackages/1-framework/1-core/shared/framework-components/tsdown.config.tspackages/1-framework/2-authoring/contract/package.jsonpackages/1-framework/2-authoring/contract/src/contract-builder.tspackages/1-framework/2-authoring/contract/test/contract-builder.test.tspackages/1-framework/3-tooling/cli/package.jsonpackages/1-framework/3-tooling/cli/src/commands/migration-plan.tspackages/1-framework/3-tooling/cli/src/control-api/client.tspackages/1-framework/3-tooling/cli/src/control-api/contract-enrichment.tspackages/1-framework/3-tooling/cli/src/control-api/operations/contract-emit.tspackages/1-framework/3-tooling/cli/src/control-api/operations/db-init.tspackages/1-framework/3-tooling/cli/src/control-api/operations/db-update.tspackages/1-framework/3-tooling/cli/src/control-api/operations/migration-apply.tspackages/1-framework/3-tooling/cli/src/control-api/types.tspackages/1-framework/3-tooling/cli/src/utils/command-helpers.tspackages/1-framework/3-tooling/cli/src/utils/framework-components.tspackages/1-framework/3-tooling/cli/src/utils/migration-command-scaffold.tspackages/1-framework/3-tooling/cli/test/control-api/client.test.tspackages/1-framework/3-tooling/cli/test/control-api/contract-enrichment.test.tspackages/1-framework/3-tooling/cli/test/control-api/progress.test.tspackages/1-framework/3-tooling/cli/test/helpers/postgres-pack.tspackages/2-mongo-family/9-family/package.jsonpackages/2-mongo-family/9-family/src/core/control-descriptor.tspackages/2-mongo-family/9-family/src/core/control-instance.tspackages/2-mongo-family/9-family/src/core/mongo-target-descriptor.tspackages/2-mongo-family/9-family/src/exports/control.tspackages/2-mongo-family/9-family/test/control.test.tspackages/2-mongo-family/9-family/tsconfig.jsonpackages/2-mongo-family/9-family/tsconfig.prod.jsonpackages/2-mongo-family/9-family/tsdown.config.tspackages/2-sql/2-authoring/contract-psl/package.jsonpackages/2-sql/2-authoring/contract-psl/src/interpreter.tspackages/2-sql/2-authoring/contract-psl/src/provider.tspackages/2-sql/2-authoring/contract-psl/src/psl-column-resolution.tspackages/2-sql/2-authoring/contract-psl/src/psl-field-resolution.tspackages/2-sql/2-authoring/contract-psl/test/fixtures.tspackages/2-sql/2-authoring/contract-psl/test/ts-psl-parity.test.tspackages/2-sql/2-authoring/contract-ts/package.jsonpackages/2-sql/2-authoring/contract-ts/src/authoring-helper-runtime.tspackages/2-sql/2-authoring/contract-ts/src/authoring-type-utils.tspackages/2-sql/2-authoring/contract-ts/src/composed-authoring-helpers.tspackages/2-sql/2-authoring/contract-ts/src/contract-builder.tspackages/2-sql/2-authoring/contract-ts/src/semantic-contract.tspackages/2-sql/2-authoring/contract-ts/src/staged-contract-dsl.tspackages/2-sql/2-authoring/contract-ts/src/staged-contract-types.tspackages/2-sql/2-authoring/contract-ts/test/authoring-helper-runtime.test.tspackages/2-sql/2-authoring/contract-ts/test/contract-builder.constraints.test.tspackages/2-sql/2-authoring/contract-ts/test/contract-builder.methods.test.tspackages/2-sql/2-authoring/contract-ts/test/contract-builder.normalization.test.tspackages/2-sql/2-authoring/contract-ts/test/contract-builder.semantic-contract.test.tspackages/2-sql/2-authoring/contract-ts/test/contract-builder.staged-contract-dsl.helpers.test.tspackages/2-sql/2-authoring/contract-ts/test/contract-builder.staged-contract-dsl.parity.test.tspackages/2-sql/2-authoring/contract-ts/test/contract-builder.staged-contract-dsl.portability.test.tspackages/2-sql/2-authoring/contract-ts/test/contract-builder.staged-contract-dsl.test.tspackages/2-sql/2-authoring/contract-ts/test/contract-parity.test.tspackages/2-sql/2-authoring/contract-ts/test/staged-contract-dsl.runtime.test.tspackages/2-sql/2-authoring/contract-ts/test/staged-contract-lowering.runtime.test.tspackages/2-sql/3-tooling/emitter/package.jsonpackages/2-sql/3-tooling/emitter/test/emitter-hook.generation.advanced.test.tspackages/2-sql/3-tooling/emitter/test/emitter-hook.generation.basic.test.tspackages/2-sql/3-tooling/family/package.jsonpackages/2-sql/3-tooling/family/src/core/assembly.tspackages/2-sql/3-tooling/family/src/core/authoring-field-presets.tspackages/2-sql/3-tooling/family/src/core/control-descriptor.tspackages/2-sql/3-tooling/family/src/core/control-instance.tspackages/2-sql/3-tooling/family/src/core/migrations/contract-to-schema-ir.tspackages/2-sql/3-tooling/family/src/core/migrations/types.tspackages/2-sql/3-tooling/family/src/core/schema-verify/verify-sql-schema.tspackages/2-sql/3-tooling/family/src/exports/control.tspackages/2-sql/3-tooling/family/src/exports/pack.tspackages/2-sql/3-tooling/family/src/exports/test-utils.tspackages/2-sql/3-tooling/family/test/assembly.codec-control-hooks.test.tspackages/2-sql/3-tooling/family/test/assembly.test.tspackages/2-sql/3-tooling/family/test/emit-parameterized.test.tspackages/2-sql/3-tooling/family/test/mutation-default-assembly.test.tspackages/2-sql/3-tooling/family/test/schema-verify.dependencies.test.tspackages/2-sql/3-tooling/family/test/schema-verify.helpers.tspackages/2-sql/3-tooling/family/test/schema-verify.storage-types.test.tspackages/2-sql/3-tooling/family/test/schema-view.test.tspackages/2-sql/5-runtime/package.jsonpackages/2-sql/5-runtime/src/sql-context.tspackages/3-extensions/pgvector/package.jsonpackages/3-extensions/pgvector/src/core/authoring.tspackages/3-extensions/pgvector/src/exports/pack.tspackages/3-targets/3-targets/postgres/package.jsonpackages/3-targets/3-targets/postgres/src/core/authoring.tspackages/3-targets/3-targets/postgres/src/exports/control.tspackages/3-targets/3-targets/postgres/src/exports/pack.tspackages/3-targets/3-targets/postgres/test/migrations/fixtures/runner-fixtures.tspackages/3-targets/3-targets/postgres/test/migrations/planner.behavior.test.tspackages/3-targets/3-targets/postgres/test/migrations/planner.contract-to-schema-ir.test.tspackages/3-targets/3-targets/postgres/test/migrations/planner.storage-types.test.tstest/integration/package.jsontest/integration/test/authoring/cli.emit-parity-fixtures.test.tstest/integration/test/authoring/psl.pgvector-dbinit.test.tstest/integration/test/cli.emit-contract.test.tstest/integration/test/cli.emit.test.tstest/integration/test/contract-builder.types.test-d.tstest/integration/test/contract-imports.test.tstest/integration/test/control-api.test.tstest/integration/test/family.introspect.integration.test.tstest/integration/test/family.introspect.test.tstest/integration/test/family.schema-verify.basic.integration.test.tstest/integration/test/family.schema-verify.dependencies.integration.test.tstest/integration/test/family.schema-verify.helpers.tstest/integration/test/family.schema-verify.mismatches.integration.test.tstest/integration/test/family.sign-database.test.tstest/integration/test/family.verify-database.basic.test.tstest/integration/test/family.verify-database.errors.test.tstest/integration/test/referential-actions.integration.test.ts
💤 Files with no reviewable changes (3)
- packages/1-framework/1-core/shared/contract/package.json
- packages/2-sql/3-tooling/family/test/assembly.test.ts
- packages/1-framework/1-core/shared/contract/src/exports/framework-components.ts
- Update glossary: mark ControlStack/ControlPlaneStack consolidation complete - Expand framework-components clean script to remove dist-tsc dirs - Simplify emitContract param type from ContractIR | unknown to unknown - Use createControlStack() factory in mongo family test instead of hand-built stub
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/1-core/shared/framework-components/src/control-instances.ts`:
- Around line 14-16: The schemaVerify options currently accept the legacy
TargetBoundComponentDescriptor; update the type surface to use the corresponding
Control* types instead: replace TargetBoundComponentDescriptor with the
appropriate Control*Descriptor (and any related TargetInstance uses with
Control*Instance) in the schemaVerify options and any exported types so
discriminators/manifest/create guarantees are preserved; search for
schemaVerify, TargetBoundComponentDescriptor and TargetInstance in this module
and swap to the matching Control*Descriptor / Control*Instance types across all
option shapes and signatures to satisfy the coding guideline banning legacy
descriptor types.
🪄 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: d1bfc33f-b4d1-47f1-b885-07835cedac02
📒 Files selected for processing (5)
docs/glossary.mdpackages/1-framework/1-core/shared/framework-components/package.jsonpackages/1-framework/1-core/shared/framework-components/src/control-instances.tspackages/2-mongo-family/9-family/README.mdpackages/2-mongo-family/9-family/test/control.test.ts
✅ Files skipped from review due to trivial changes (3)
- packages/2-mongo-family/9-family/test/control.test.ts
- packages/2-mongo-family/9-family/README.md
- packages/1-framework/1-core/shared/framework-components/package.json
|
Merging without review because everyone is on holiday |
closes TML-2182
Walkthrough — Tasks 3.9 + 3.10 + 3.12 + 3.13
Key snippet
Before — assembly trapped in SQL family
After — assembly is framework-level, families just compose
Intent
Establish
@prisma-next/framework-componentsas the single canonical source for all framework component types, assembly logic, and stack creation across both control and execution planes. Introduce a Mongo control plane that proves the framework assembly path works end-to-end. Unify the control-plane stack so callers work with a single struct instead of managing two parallel representations.Change map
ControlStack,createControlStack(), allextract*()functionsControlFamilyDescriptor,ControlTargetDescriptor, etc.ControlFamilyInstance,ControlDriverInstance, etc.VerifyDatabaseResult,EmitContractResult, etc.ExecutionStack,createExecutionStack()The story
Extract family-agnostic assembly into the framework. The
extract*()functions andassembleAuthoringContributions()were SQL-family implementation details but operated on framework-level types. Moved them to a new@prisma-next/framework-componentspackage with a./controlsubpath.Build a Mongo control plane. Created
@prisma-next/family-mongoat layer 9 withmongoFamilyDescriptor(singleton),mongoTargetDescriptor(spreads identity from@prisma-next/target-mongo), and a privateMongoFamilyInstanceclass. The Mongo demo'sgenerate-contract.tscalls the control plane for contract emission, closing the ContractIR → emitter → runtime loop.Absorb execution-plane types.
@prisma-next/core-execution-planehad drifted from its name — it contained framework component types, not runtime pipeline logic. Moved all source files intoframework-components/executionand converted the original package to a re-export shim.Eliminate the contract → framework-components dependency inversion. Migrated ~65 consumers of
@prisma-next/contract/framework-componentsto import from@prisma-next/framework-components/{components,authoring}directly, deleted the re-export module and the dependency fromcontract.Move control-plane descriptor/instance/result types to framework-components.
ControlFamilyDescriptor,ControlFamilyInstance,ControlDriverInstance,VerifyDatabaseResult,EmitContractResult, and related types moved from@prisma-next/core-control-plane/types.tstoframework-components/control. Introduced dependency-inverted capability interfaces (MigratableTargetDescriptor,SchemaViewCapable) with type predicates soframework-componentshas no knowledge of migrations or schema views. Convertedcore-control-plane/types.tsandconfig/types.tsto re-export shims.Unify ControlStack with ControlPlaneStack. Extended
ControlStackto carry both component descriptors (family, target, adapter, driver, extensions) and aggregated metadata (type imports, renderers, authoring contributions). ChangedControlFamilyDescriptor.create()to accept a singleControlStackargument. DeprecatedControlPlaneStackas aPick<ControlStack, ...>alias. Eliminated theas nevercast from the Mongo demo.Behavior changes & evidence
Adds
@prisma-next/framework-componentsas the canonical home for all framework component types, assembly, and stack creation. Four subpath exports (./components,./authoring,./control,./execution) cover shared component types, authoring contributions, control-plane assembly/stacks/descriptors/instances/results, and execution-plane equivalents.@prisma-next/contract,@prisma-next/core-control-plane,@prisma-next/core-execution-plane, and@prisma-next/configwith duplicates. Centralizing them removes duplication and dependency inversions.Adds Mongo control plane with descriptor, private instance class, and target descriptor. The Mongo demo calls
createControlStack()+mongoFamilyDescriptor.create(controlStack)to emit contracts.mongoFamilyDescriptorMongoFamilyInstanceControlStackcarries both descriptors and aggregated metadata. Before: two separate structs (ControlPlaneStackfor descriptors,ControlStackfor aggregations), two arguments tocreate(),as nevercast needed. After: singleControlStack<TFamilyId, TTargetId>with both, single-argcreate(), no casts.Adds capability interfaces for migrations and schema views.
MigratableTargetDescriptor+hasMigrations()andSchemaViewCapable+hasSchemaView()allowframework-componentsto defineControlTargetDescriptorandControlFamilyInstancewithout migration/schema-view knowledge.framework-componentsmust not depend oncore-control-plane's migration types.hasMigrations()gating.@prisma-next/contractis a leaf. No longer depends on@prisma-next/framework-components. (No behavior change.)contract/src/exports/framework-components.tsdeletedThree packages converted to re-export shims.
core-execution-plane,core-control-plane/types.ts, andconfig/types.tsre-export fromframework-components. (No behavior change — existing imports continue to work.)Compatibility / migration / risk
ControlPlaneStackis deprecated. The type alias works but should be migrated away from in future tasks.framework-componentsdepends on@prisma-next/contract. This is a new dependency (forContractIR,ContractMarkerRecord,TargetFamilyHook). It's correct directionally — both are1-core/sharedpeers. Task 5.11 plans to movecontractto0-foundation, making this a downward dependency.createSqlFamilyInstance()re-calls allextract*()functions on descriptors thatcreateControlStack()already processed. Expected interim state — task 5.8 will restructure the SQL family to read fromControlStackdirectly.Follow-ups / open questions
AssembledAuthoringContributionsintoControlStack(cosmetic).TypesImportSpec/RenderTypeContextduplication (task 5.11).ControlStackaggregations instead of re-callingextract*().framework-componentsimports.core-control-plane/typesshim rather than canonicalframework-components/control.Non-goals / intentionally out of scope
core-control-plane/typesto import fromframework-components/controldirectly (deferred — shims provide backward compat).Summary by CodeRabbit
New Features
@prisma-next/framework-componentspackage for composing control stacks with families, targets, adapters, drivers, and extensionsDocumentation
Chores