Skip to content

refactor(operations): clean up registry and emission types#436

Open
SevInf wants to merge 2 commits intomainfrom
cleanup-op-registry-again
Open

refactor(operations): clean up registry and emission types#436
SevInf wants to merge 2 commits intomainfrom
cleanup-op-registry-again

Conversation

@SevInf
Copy link
Copy Markdown
Contributor

@SevInf SevInf commented May 7, 2026

Intent

Two small cleanups to @prisma-next/operations and the surrounding emission machinery:

  1. Delete the operationTypes pipeline. A types.operationTypes field on component descriptors flowed all the way through emission into a generated OperationTypes alias in contract.d.ts and a matching slot on TypeMaps, but neither was ever read at runtime. The only type-level consumer (ResolveOperationTypes) was exported and unimported. queryOperationTypes — the real type-level dispatch surface — is unaffected.
  2. Stop encoding the operation name inside the descriptor object. OperationRegistry.register(name, descriptor) now takes the key explicitly, descriptor factories return a keyed Record<string, Descriptor>, and the per-operation method property goes away.

Change map

The story

  1. The operationTypes slot on TypeMaps and the matching OperationTypes alias in generated contract.d.ts were leftover scaffolding. The only thing that referenced them was ResolveOperationTypes, which was exported but never imported. Deleting the slot and the helper alias removes a surface that pretended to be load-bearing.
  2. With nothing reading the slot, the upstream extractOperationTypeImports step on the control stack and the operationTypeImports argument threaded through the emitter become dead too. They get pulled out together so the contract pipeline has one fewer parallel "imports" channel that emits nothing meaningful.
  3. The descriptor side of the registry was carrying a method: string field that did double duty as both the registry key and a value attached to each entry. The factory then Object.freeze'd an array of descriptors that the runtime walked just to read descriptor.method back. Switching to register(name, descriptor) lets factories return a Readonly<Record<string, Descriptor>> directly — the record's keys are the operation names, the descriptor stops carrying its own name, and the as unknown as T cast that existed only to strip method from the stored entry goes away.
  4. Adapter and extension factories now annotate their return type as QueryOperationTypes<CT> (the type-level dispatch surface that already existed). That makes the type-level signature the single source of truth: per-operation impl no longer needs hand-written argument and return-type annotations, and any drift between the type signature and the implementation becomes a compile error at the factory boundary.

Behavior changes & evidence

Compatibility / migration / risk

  • Generated contract.d.ts and contract.json change shape. Anyone hand-importing the generated OperationTypes alias or reading typeMaps.operationTypes from a contract JSON would break — but no caller in this repo does, and neither was a documented public surface.
  • TypeMaps (SQL) and MongoTypeMaps lose a type parameter (the TOperationTypes slot). Direct callers that explicitly named that parameter will need to drop it. There are no such callers in the repo.
  • OperationRegistry.register and SqlStaticContributions.queryOperations change shape. Both are internal extension-point APIs; all in-repo extensions and adapters are migrated in the same change.

Non-goals / intentionally out of scope

  • queryOperationTypes (the live type-level dispatch surface) is intentionally untouched.
  • No new operations or behavior; this is purely a cleanup.

Summary by CodeRabbit

  • New Features

    • Enhanced operation descriptor model with improved type safety and registration patterns.
  • Bug Fixes

    • Improved operation type inference and contract generation accuracy.
  • Refactor

    • Restructured operation type system to separate query operations from codec types in contracts.
    • Updated operation registry API to use explicit name-based registration instead of embedded method references.
    • Simplified type maps and descriptor structures across SQL and document frameworks.
    • Consolidated operation metadata handling for clearer extension manifest definitions.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Warning

Rate limit exceeded

@SevInf has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 44 minutes and 24 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: dc9dc1be-93f5-4b53-b2ff-2405480502b6

📥 Commits

Reviewing files that changed from the base of the PR and between d1c0824 and 0d0c66e.

⛔ Files ignored due to path filters (10)
  • packages/2-sql/4-lanes/sql-builder/test/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • packages/2-sql/4-lanes/sql-builder/test/fixtures/generated/contract.json is excluded by !**/generated/**
  • packages/3-extensions/sql-orm-client/test/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • packages/3-extensions/sql-orm-client/test/fixtures/generated/contract.json is excluded by !**/generated/**
  • test/e2e/framework/test/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • test/e2e/framework/test/fixtures/generated/contract.json is excluded by !**/generated/**
  • test/e2e/framework/test/sqlite/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/mongo/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/sql-builder/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/sql-builder/fixtures/generated/contract.json is excluded by !**/generated/**
📒 Files selected for processing (63)
  • examples/prisma-next-cloudflare-worker/src/prisma/contract.d.ts
  • examples/prisma-next-demo/src/prisma/contract.d.ts
  • examples/prisma-next-demo/src/prisma/contract.json
  • examples/prisma-next-demo/test/demo-dx.types.test.ts
  • packages/1-framework/1-core/framework-components/src/control/control-stack.ts
  • packages/1-framework/1-core/framework-components/src/control/emission-types.ts
  • packages/1-framework/1-core/framework-components/src/exports/control.ts
  • packages/1-framework/1-core/framework-components/src/shared/framework-components.ts
  • packages/1-framework/1-core/framework-components/test/control-stack.test.ts
  • packages/1-framework/1-core/operations/README.md
  • packages/1-framework/1-core/operations/src/index.ts
  • packages/1-framework/1-core/operations/test/operations-registry.test.ts
  • packages/1-framework/3-tooling/cli/README.md
  • packages/1-framework/3-tooling/emitter/README.md
  • packages/1-framework/3-tooling/emitter/src/emit-types.ts
  • packages/1-framework/3-tooling/emitter/src/emit.ts
  • packages/1-framework/3-tooling/emitter/src/generate-contract-dts.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.integration.test.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.roundtrip.test.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.test.ts
  • packages/1-framework/3-tooling/emitter/test/mock-spi.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/contract-types.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/contract-types.test-d.ts
  • packages/2-mongo-family/3-tooling/emitter/src/index.ts
  • packages/2-mongo-family/3-tooling/emitter/test/emitter-hook.e2e.test.ts
  • packages/2-mongo-family/3-tooling/emitter/test/emitter-hook.generation.test.ts
  • packages/2-mongo-family/5-query-builders/orm/test/value-object-inputs.test-d.ts
  • packages/2-sql/1-core/contract/src/exports/types.ts
  • packages/2-sql/1-core/contract/src/types.ts
  • packages/2-sql/1-core/contract/test/contract-typemaps-shape.test.ts
  • packages/2-sql/1-core/operations/README.md
  • packages/2-sql/1-core/operations/src/index.ts
  • packages/2-sql/1-core/operations/test/operations-registry.test.ts
  • packages/2-sql/3-tooling/emitter/README.md
  • packages/2-sql/3-tooling/emitter/src/index.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.generation.advanced.test.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.generation.basic.test.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.typeref-resolver.test.ts
  • packages/2-sql/5-runtime/src/sql-context.ts
  • packages/2-sql/5-runtime/test/execution-stack.test.ts
  • packages/2-sql/5-runtime/test/sql-context.test.ts
  • packages/2-sql/9-family/src/core/control-instance.ts
  • packages/2-sql/9-family/src/core/migrations/types.ts
  • packages/2-sql/9-family/src/exports/test-utils.ts
  • packages/2-sql/9-family/test/compute-column-js-type.test-d.ts
  • packages/2-sql/9-family/test/operation-preview.test.ts
  • packages/3-extensions/pgvector/src/core/descriptor-meta.ts
  • packages/3-extensions/pgvector/src/exports/operation-types.ts
  • packages/3-extensions/pgvector/src/types/operation-types.ts
  • packages/3-extensions/pgvector/test/manifest.test.ts
  • packages/3-extensions/pgvector/test/operations.test.ts
  • packages/3-extensions/sql-orm-client/test/generated-contract-types.test-d.ts
  • packages/3-extensions/sql-orm-client/test/model-accessor.test.ts
  • packages/3-mongo-target/2-mongo-adapter/src/core/operations.ts
  • packages/3-mongo-target/2-mongo-adapter/test/codecs.test.ts
  • packages/3-targets/6-adapters/postgres/src/core/descriptor-meta.ts
  • test/integration/test/authoring/parity/callback-mode-scalars/expected.contract.json
  • test/integration/test/authoring/parity/pgvector-named-type/expected.contract.json
  • test/integration/test/cli.emit.test.ts
  • test/integration/test/contract-imports.test.ts
  • test/integration/test/emitter.adapter-query-operation-types.test.ts
  • test/integration/test/fixtures/contract.d.ts
  • test/integration/test/pgvector.test.ts
📝 Walkthrough

Walkthrough

This PR consolidates the operation type system by removing static OperationTypes from type maps and converting operation descriptors to object maps with refactored registry API. The register(name, descriptor) method now separates operation names from self+impl descriptors, and QueryOperationTypes replaces all OperationTypes references across SQL, Mongo, and extension contracts.

Changes

Operation Type System Consolidation

Layer / File(s) Summary
Operation Registry API
packages/1-framework/1-core/operations/src/index.ts, packages/1-framework/1-core/operations/README.md, packages/1-framework/1-core/operations/test/operations-registry.test.ts
OperationRegistry.register now accepts (name, descriptor) instead of descriptor with embedded method; OperationDescriptor becomes direct alias of OperationEntry; test helpers updated to new signature.
Type Map Contracts
packages/2-sql/1-core/contract/src/types.ts, packages/2-mongo-family/1-foundation/mongo-contract/src/contract-types.ts, packages/2-sql/1-core/contract/test/contract-typemaps-shape.test.ts, packages/2-mongo-family/1-foundation/mongo-contract/test/contract-types.test-d.ts
Remove operationTypes generic parameter and property; keep codecTypes, queryOperationTypes, fieldOutputTypes, fieldInputTypes only; adjust generic parameter ordering across test files.
Operation Descriptor Shapes
packages/2-sql/1-core/operations/src/index.ts, packages/3-extensions/pgvector/src/core/descriptor-meta.ts, packages/3-targets/6-adapters/postgres/src/core/descriptor-meta.ts, packages/3-mongo-target/2-mongo-adapter/src/core/operations.ts, packages/3-mongo-target/2-mongo-adapter/test/codecs.test.ts
Change SqlOperationDescriptors, pgvectorQueryOperations(), postgresQueryOperations() to return object maps keyed by operation name instead of arrays; add cosineSimilarity operation to pgvector.
Control Stack & Emission
packages/1-framework/1-core/framework-components/src/control/control-stack.ts, packages/1-framework/1-core/framework-components/src/control/emission-types.ts, packages/1-framework/3-tooling/emitter/src/emit-types.ts
Remove operationTypeImports from ControlStack and EmitStackInput; rename operationTypeImports to queryOperationTypeImports in options; delete extractOperationTypeImports function.
Adapter Implementations
packages/2-sql/5-runtime/src/sql-context.ts, packages/2-sql/9-family/src/core/migrations/types.ts
Update SqlStaticContributions.queryOperations return type from array to SqlOperationDescriptors; refactor runtime registration to iterate Object.entries and call register(name, op).
Emitter Implementation
packages/1-framework/3-tooling/emitter/src/emit.ts, packages/1-framework/3-tooling/emitter/src/generate-contract-dts.ts, packages/2-sql/3-tooling/emitter/src/index.ts, packages/2-mongo-family/3-tooling/emitter/src/index.ts
Stop reading/passing operationTypeImports; update generateContractDts calls to remove operationTypeImports argument; remove OperationTypes generation from contract DTS output; update getTypeMapsExpression to omit OperationTypes parameter.
Contract Generation
examples/prisma-next-demo/src/prisma/contract.d.ts, test/integration/test/fixtures/contract.d.ts, test/integration/test/authoring/parity/callback-mode-scalars/expected.contract.json
Remove OperationTypes exports; remove pgvector operationTypes import blocks from extension pack metadata; update TypeMaps instantiation to use new parameter order.
Tests & Documentation
packages/1-framework/3-tooling/emitter/test/emitter*.test.ts, packages/3-extensions/pgvector/test/operations.test.ts, test/integration/test/pgvector.test.ts, test/integration/test/cli.emit.test.ts, packages/1-framework/3-tooling/cli/README.md, packages/1-framework/3-tooling/emitter/README.md, packages/2-sql/1-core/operations/README.md, packages/2-sql/3-tooling/emitter/README.md
Update all tests to use new registry registration signature, descriptor shapes, and emitter inputs; update READMEs to document new self+impl operation structure and name-based registration; remove operation type import extraction assertions.

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly Related PRs

  • prisma/prisma-next#374: Performs identical core refactor of OperationTypes→QueryOperationTypes and operation descriptor shape changes across the same modules (registry, pgvector, postgres, emitter, tooling).
  • prisma/prisma-next#330: Implements adapter-specific QueryOperationTypes and trait-targeted operations that are now wired via this PR's new descriptor collection and registry APIs.

Suggested Reviewers

  • wmadden

🐰 The operation map now springs to life,
No embedded methods, just self and impl in sight,
Query types guide the way so bright,
A registry reborn, registration done right!

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cleanup-op-registry-again

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 7, 2026

Open in StackBlitz

@prisma-next/mongo-runtime

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

@prisma-next/family-mongo

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

@prisma-next/sql-runtime

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

@prisma-next/family-sql

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

@prisma-next/extension-arktype-json

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

@prisma-next/middleware-telemetry

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/middleware-telemetry@436

@prisma-next/mongo

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

@prisma-next/extension-paradedb

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

@prisma-next/extension-pgvector

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

@prisma-next/postgres

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

@prisma-next/sql-orm-client

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

@prisma-next/sqlite

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

@prisma-next/target-mongo

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

@prisma-next/adapter-mongo

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

@prisma-next/driver-mongo

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

@prisma-next/contract

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

@prisma-next/utils

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

@prisma-next/config

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

@prisma-next/errors

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

@prisma-next/framework-components

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

@prisma-next/operations

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

@prisma-next/ts-render

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

@prisma-next/contract-authoring

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

@prisma-next/ids

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

@prisma-next/psl-parser

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

@prisma-next/psl-printer

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

@prisma-next/cli

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

@prisma-next/emitter

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

@prisma-next/migration-tools

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

prisma-next

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

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

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

@prisma-next/mongo-codec

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

@prisma-next/mongo-contract

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

@prisma-next/mongo-value

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

@prisma-next/mongo-contract-psl

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

@prisma-next/mongo-contract-ts

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

@prisma-next/mongo-emitter

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

@prisma-next/mongo-schema-ir

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

@prisma-next/mongo-query-ast

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

@prisma-next/mongo-orm

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

@prisma-next/mongo-query-builder

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

@prisma-next/mongo-lowering

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

@prisma-next/mongo-wire

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

@prisma-next/sql-contract

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

@prisma-next/sql-errors

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

@prisma-next/sql-operations

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

@prisma-next/sql-schema-ir

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

@prisma-next/sql-contract-psl

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

@prisma-next/sql-contract-ts

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

@prisma-next/sql-contract-emitter

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

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

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

@prisma-next/sql-relational-core

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

@prisma-next/sql-builder

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

@prisma-next/target-postgres

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

@prisma-next/target-sqlite

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

@prisma-next/adapter-postgres

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

@prisma-next/adapter-sqlite

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

@prisma-next/driver-postgres

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

@prisma-next/driver-sqlite

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

commit: 0d0c66e

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/3-mongo-target/2-mongo-adapter/src/core/operations.ts (1)

9-11: 💤 Low value

Consider Object.freeze() on the exported descriptors map for runtime immutability parity.

mongoVectorNearOperation is frozen (line 4), but mongoVectorOperationDescriptors is not. Readonly<Record<...>> is compile-time only; the exported object can be mutated at runtime. The previous array-based export was frozen.

🔒 Proposed fix
-export const mongoVectorOperationDescriptors: OperationDescriptors = {
-  near: mongoVectorNearOperation,
-};
+export const mongoVectorOperationDescriptors: OperationDescriptors = Object.freeze({
+  near: mongoVectorNearOperation,
+});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/3-mongo-target/2-mongo-adapter/src/core/operations.ts` around lines
9 - 11, The exported map mongoVectorOperationDescriptors is not frozen at
runtime (unlike mongoVectorNearOperation), allowing mutation despite its
TypeScript readonly type; update the export so the object is frozen with
Object.freeze(...) to enforce immutability at runtime while preserving the
OperationDescriptors shape so consumers get the same API but cannot mutate the
map.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/3-mongo-target/2-mongo-adapter/src/core/operations.ts`:
- Around line 9-11: The exported map mongoVectorOperationDescriptors is not
frozen at runtime (unlike mongoVectorNearOperation), allowing mutation despite
its TypeScript readonly type; update the export so the object is frozen with
Object.freeze(...) to enforce immutability at runtime while preserving the
OperationDescriptors shape so consumers get the same API but cannot mutate the
map.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: c9f83a79-31b6-416b-91a0-65ffac6548a9

📥 Commits

Reviewing files that changed from the base of the PR and between 91a1853 and d1c0824.

⛔ Files ignored due to path filters (10)
  • packages/2-sql/4-lanes/sql-builder/test/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • packages/2-sql/4-lanes/sql-builder/test/fixtures/generated/contract.json is excluded by !**/generated/**
  • packages/3-extensions/sql-orm-client/test/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • packages/3-extensions/sql-orm-client/test/fixtures/generated/contract.json is excluded by !**/generated/**
  • test/e2e/framework/test/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • test/e2e/framework/test/fixtures/generated/contract.json is excluded by !**/generated/**
  • test/e2e/framework/test/sqlite/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/mongo/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/sql-builder/fixtures/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/sql-builder/fixtures/generated/contract.json is excluded by !**/generated/**
📒 Files selected for processing (62)
  • examples/prisma-next-demo/src/prisma/contract.d.ts
  • examples/prisma-next-demo/src/prisma/contract.json
  • examples/prisma-next-demo/test/demo-dx.types.test.ts
  • packages/1-framework/1-core/framework-components/src/control/control-stack.ts
  • packages/1-framework/1-core/framework-components/src/control/emission-types.ts
  • packages/1-framework/1-core/framework-components/src/exports/control.ts
  • packages/1-framework/1-core/framework-components/src/shared/framework-components.ts
  • packages/1-framework/1-core/framework-components/test/control-stack.test.ts
  • packages/1-framework/1-core/operations/README.md
  • packages/1-framework/1-core/operations/src/index.ts
  • packages/1-framework/1-core/operations/test/operations-registry.test.ts
  • packages/1-framework/3-tooling/cli/README.md
  • packages/1-framework/3-tooling/emitter/README.md
  • packages/1-framework/3-tooling/emitter/src/emit-types.ts
  • packages/1-framework/3-tooling/emitter/src/emit.ts
  • packages/1-framework/3-tooling/emitter/src/generate-contract-dts.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.integration.test.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.roundtrip.test.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.test.ts
  • packages/1-framework/3-tooling/emitter/test/mock-spi.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/contract-types.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/test/contract-types.test-d.ts
  • packages/2-mongo-family/3-tooling/emitter/src/index.ts
  • packages/2-mongo-family/3-tooling/emitter/test/emitter-hook.e2e.test.ts
  • packages/2-mongo-family/3-tooling/emitter/test/emitter-hook.generation.test.ts
  • packages/2-mongo-family/5-query-builders/orm/test/value-object-inputs.test-d.ts
  • packages/2-sql/1-core/contract/src/exports/types.ts
  • packages/2-sql/1-core/contract/src/types.ts
  • packages/2-sql/1-core/contract/test/contract-typemaps-shape.test.ts
  • packages/2-sql/1-core/operations/README.md
  • packages/2-sql/1-core/operations/src/index.ts
  • packages/2-sql/1-core/operations/test/operations-registry.test.ts
  • packages/2-sql/3-tooling/emitter/README.md
  • packages/2-sql/3-tooling/emitter/src/index.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.generation.advanced.test.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.generation.basic.test.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.typeref-resolver.test.ts
  • packages/2-sql/5-runtime/src/sql-context.ts
  • packages/2-sql/5-runtime/test/execution-stack.test.ts
  • packages/2-sql/5-runtime/test/sql-context.test.ts
  • packages/2-sql/9-family/src/core/control-instance.ts
  • packages/2-sql/9-family/src/core/migrations/types.ts
  • packages/2-sql/9-family/src/exports/test-utils.ts
  • packages/2-sql/9-family/test/compute-column-js-type.test-d.ts
  • packages/2-sql/9-family/test/operation-preview.test.ts
  • packages/3-extensions/pgvector/src/core/descriptor-meta.ts
  • packages/3-extensions/pgvector/src/exports/operation-types.ts
  • packages/3-extensions/pgvector/src/types/operation-types.ts
  • packages/3-extensions/pgvector/test/manifest.test.ts
  • packages/3-extensions/pgvector/test/operations.test.ts
  • packages/3-extensions/sql-orm-client/test/generated-contract-types.test-d.ts
  • packages/3-extensions/sql-orm-client/test/model-accessor.test.ts
  • packages/3-mongo-target/2-mongo-adapter/src/core/operations.ts
  • packages/3-mongo-target/2-mongo-adapter/test/codecs.test.ts
  • packages/3-targets/6-adapters/postgres/src/core/descriptor-meta.ts
  • test/integration/test/authoring/parity/callback-mode-scalars/expected.contract.json
  • test/integration/test/authoring/parity/pgvector-named-type/expected.contract.json
  • test/integration/test/cli.emit.test.ts
  • test/integration/test/contract-imports.test.ts
  • test/integration/test/emitter.adapter-query-operation-types.test.ts
  • test/integration/test/fixtures/contract.d.ts
  • test/integration/test/pgvector.test.ts
💤 Files with no reviewable changes (22)
  • test/integration/test/authoring/parity/pgvector-named-type/expected.contract.json
  • test/integration/test/authoring/parity/callback-mode-scalars/expected.contract.json
  • packages/1-framework/3-tooling/emitter/test/emitter.integration.test.ts
  • packages/1-framework/3-tooling/emitter/test/emitter.roundtrip.test.ts
  • test/integration/test/emitter.adapter-query-operation-types.test.ts
  • packages/3-extensions/pgvector/test/manifest.test.ts
  • packages/2-sql/3-tooling/emitter/test/emitter-hook.typeref-resolver.test.ts
  • packages/1-framework/1-core/framework-components/src/control/control-stack.ts
  • examples/prisma-next-demo/src/prisma/contract.json
  • packages/1-framework/3-tooling/emitter/src/emit-types.ts
  • test/integration/test/fixtures/contract.d.ts
  • packages/1-framework/1-core/framework-components/src/control/emission-types.ts
  • packages/3-extensions/pgvector/src/types/operation-types.ts
  • packages/2-sql/9-family/src/exports/test-utils.ts
  • packages/1-framework/1-core/framework-components/src/exports/control.ts
  • examples/prisma-next-demo/src/prisma/contract.d.ts
  • packages/2-sql/1-core/contract/src/exports/types.ts
  • packages/1-framework/1-core/framework-components/test/control-stack.test.ts
  • packages/2-mongo-family/1-foundation/mongo-contract/src/contract-types.ts
  • packages/2-sql/9-family/test/operation-preview.test.ts
  • packages/2-sql/1-core/contract/src/types.ts
  • packages/1-framework/1-core/framework-components/src/shared/framework-components.ts

SevInf added 2 commits May 7, 2026 18:18
…ors via registry

`types.operationTypes` on component descriptors fed into the generated
`contract.d.ts` `OperationTypes` alias and a matching `TypeMaps`
slot, but neither was read at runtime: `OperationTypesOf` was only
referenced by `ResolveOperationTypes`, which was exported but never
imported. Remove the field, the extraction helpers, and the `TypeMaps`
slot for both SQL and Mongo. `queryOperationTypes` (the live
type-level dispatch surface) is unaffected.

Drop `method` from `OperationDescriptor` and switch
`OperationRegistry.register(name, descriptor)` to take the key
explicitly. `queryOperations()` factories now return
`Readonly<Record<string, SqlOperationEntry>>`; consumers iterate
`Object.entries` and register by record key. Adapter/extension
factories annotate their return type with their own
`QueryOperationTypes<CT>`, so the type-level signature is the single
source of truth and impl drift is a compile error.

Regenerated all on-disk contract fixtures.
The cloudflare-worker example was added to main after this branch
forked. Its committed contract.d.ts still carried the now-removed
OperationTypes alias and TypeMaps slot; regenerated to match.
@SevInf SevInf force-pushed the cleanup-op-registry-again branch from d1c0824 to 0d0c66e Compare May 7, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant