Repository navigation
refactor(contract): rename effectiveControl → effectiveControlPolicy (TML-2797) - #699
Conversation
|
Warning Review limit reached
More reviews will be available in 21 minutes and 47 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe PR renames the exported helper function ChangesFunction Rename and Test Updates
Possibly related PRs
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…(TML-2797) The contract used bare "control" as shorthand for "control policy", which collides with the existing "control plane" vocabulary. Rename the resolver to effectiveControlPolicy so the ubiquitous language is unambiguous. Landing this on main ahead of the slice-2/3/4 reworks avoids three-way conflicts on the merged substrate file when each open PR adopts the name. Signed-off-by: Will Madden <[email protected]>
63f5b97 to
fcc91c9
Compare
@prisma-next/extension-author-tools
@prisma-next/mongo-runtime
@prisma-next/family-mongo
@prisma-next/sql-runtime
@prisma-next/family-sql
@prisma-next/extension-arktype-json
@prisma-next/middleware-cache
@prisma-next/mongo
@prisma-next/extension-paradedb
@prisma-next/extension-pgvector
@prisma-next/extension-postgis
@prisma-next/postgres
@prisma-next/sql-orm-client
@prisma-next/sqlite
@prisma-next/target-mongo
@prisma-next/adapter-mongo
@prisma-next/driver-mongo
@prisma-next/contract
@prisma-next/utils
@prisma-next/config
@prisma-next/errors
@prisma-next/framework-components
@prisma-next/operations
@prisma-next/ts-render
@prisma-next/contract-authoring
@prisma-next/ids
@prisma-next/psl-parser
@prisma-next/psl-printer
@prisma-next/cli
@prisma-next/cli-telemetry
@prisma-next/emitter
@prisma-next/migration-tools
prisma-next
@prisma-next/vite-plugin-contract-emit
@prisma-next/mongo-codec
@prisma-next/mongo-contract
@prisma-next/mongo-value
@prisma-next/mongo-contract-psl
@prisma-next/mongo-contract-ts
@prisma-next/mongo-emitter
@prisma-next/mongo-schema-ir
@prisma-next/mongo-query-ast
@prisma-next/mongo-orm
@prisma-next/mongo-query-builder
@prisma-next/mongo-lowering
@prisma-next/mongo-wire
@prisma-next/sql-contract
@prisma-next/sql-errors
@prisma-next/sql-operations
@prisma-next/sql-schema-ir
@prisma-next/sql-contract-psl
@prisma-next/sql-contract-ts
@prisma-next/sql-contract-emitter
@prisma-next/sql-lane-query-builder
@prisma-next/sql-relational-core
@prisma-next/sql-builder
@prisma-next/target-postgres
@prisma-next/target-sqlite
@prisma-next/adapter-postgres
@prisma-next/adapter-sqlite
@prisma-next/driver-postgres
@prisma-next/driver-sqlite
commit: |
size-limit report 📦
|
…-2800) Substrate-first field rename completing the ubiquitous-language pass started in #699 (effectiveControl → effectiveControlPolicy). No behaviour change. Signed-off-by: Will Madden <[email protected]>
…-2800) (prisma#707) ## At a glance ```ts // before const contract = defineContract({ ..., defaultControl: 'tolerated' }); // after const contract = defineContract({ ..., defaultControlPolicy: 'tolerated' }); ``` A pure mechanical rename of the contract-level default field. No behaviour change. ## The decision The control-policy primitive (`ControlPolicy = 'managed' | 'tolerated' | 'external' | 'observed'`) introduced a contract-level default named `defaultControl`. Reading the merged slice PRs as a fresh team member, "control" is overloaded: the codebase already uses **control plane** as a load-bearing term, and the contract was using bare "control" as shorthand for "control **policy**". This rename completes the [`effectiveControl → effectiveControlPolicy`](prisma#699) cleanup landed in prisma#699 — the field-name half of the same ubiquitous-language pass. After this PR, every policy-bearing identifier on the storage plane reads `…ControlPolicy` rather than bare `…Control` (the per-node `.control` IR field is the deliberate exception — renaming it would change every node's serialized contract hash, see "Alternatives considered"). ## Scope In: - `defaultControl` → `defaultControlPolicy` on the contract IR (`@prisma-next/contract` and the Mongo contract foundation), its arktype validators, the TS authoring builder option, and every reader (verifier, planner). - The serialized JSON key on the contract — and a regeneration of the one committed example contract that exercises it (`projects/supabase-integration/example/migrations/supabase/contract.{json,d.ts}`). - Test fixtures and helpers that reference the old name. Out (deliberately): - The per-node `.control` field — renaming it would alter the serialized JSON of every contract that uses control policies, regardless of the value. The collision the rename addresses is the **default**-side identifier; the per-node field stays `.control` for now. ## Hash impact The feature was merged to `main` only yesterday (prisma#691 on 2026-06-02). No downstream contract is yet using a non-default `defaultControl` value. The omit-when-default idiom means the JSON key only appears when the author explicitly sets a non-default policy; existing contracts in the wild that don't set it will be byte-for-byte unchanged. ## Verification - `@prisma-next/contract`, `@prisma-next/mongo-contract`, and `@prisma-next/sql-contract` rebuilt — `dist/*.d.mts` exports the new field. - Tests green: contract (160), sql-contract (129), mongo-contract (117), sql-contract-ts (270), family-sql (333), family-mongo (148), target-postgres (377), target-sqlite (104), target-mongo (404) — **2042 passing**. - Typecheck green across all touched packages. - `pnpm lint:deps` clean. - No stale `defaultControl` token remains in source/tests (the design docs under `projects/control-policy/` continue to spell the pre-rename name — they describe pre-rename state and are deleted at project close-out, mirroring the precedent prisma#699 set for `plan.md`). ## Alternatives considered - **Carry the rename inside the e2e demonstration slice (TML-2796)** — no extra PR, but risks colliding with any open branch that reads the field; landing it as substrate-first matches how prisma#699 sequenced `effectiveControl`, removing the rebase hazard entirely. - **Also rename the per-node `.control` field → `.controlPolicy`** — would alter the serialized JSON of every node carrying a control policy, churning contract hashes for every consumer regardless of value. Not required to resolve the default-side ambiguity. Deliberately out of scope. Linear: TML-2800 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Standardized contract control policy property naming across MongoDB, SQL, and related packages for improved consistency and clarity in contract definitions. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Will Madden <[email protected]> Co-authored-by: Will Madden <[email protected]>
At a glance
A pure mechanical rename of one exported function. No behaviour change.
The decision
The control-policy primitive (
ControlPolicy = 'managed' | 'tolerated' | 'external' | 'observed') introduced a resolver namedeffectiveControl. Reading the slice PRs as a fresh team member, "control" is overloaded: the codebase already uses control plane (the migration/verification side of the system) as a load-bearing term, and the contract was using bare "control" as shorthand for "control policy". The collision makes call-sites likeeffectiveControl(node.control, …)read ambiguously.This renames the resolver to
effectiveControlPolicyso the name says what it returns — the effectiveControlPolicyfor a storage-plane node.Why land it separately, first
effectiveControlis defined in@prisma-next/contract(already onmain) and consumed by three open PRs in flight — the verifier dispatch (#694), the planner dispatch (#693), and the target serializers. If each PR renamed the merged definition independently, they would three-way-conflict on the substrate file.Landing the rename as its own small PR to
mainand rebasing the three open PRs onto it removes that hazard: each rework then only touches its own consumption.Scope
In:
effectiveControl→effectiveControlPolicy(function + re-export incontract/src/exports/types.ts)Out (handled inside each slice's own rework, per their review artifacts):
DdlIntent,tableControl/collectionControl,verifierDisposition,gateCallsByControlPolicy, and the.controlIR field name itself.Verification
@prisma-next/contractrebuilt —dist/types.d.mtsnow exportseffectiveControlPolicy.effectiveControltoken remains in the tree.Alternatives considered
.controlfield →.controlPolicy— larger, hash-affecting (the field is serialized intocontract.json), and not required to resolve the resolver-name ambiguity. Deliberately out of scope.Linear: TML-2797
Summary by CodeRabbit