TML-2988: Hard-cut @db.* lowering; add actionable diagnostics#1054
Conversation
Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe PR replaces legacy ChangesUnified storage-type authoring
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Author
participant PSLInterpreter
participant TypeResolver
participant DiagnosticReporter
Author->>PSLInterpreter: submit type-position constructors or legacy `@db`.* attributes
PSLInterpreter->>TypeResolver: resolve authoring type constructors
TypeResolver-->>PSLInterpreter: return resolved storage type
PSLInterpreter->>DiagnosticReporter: report migration guidance for legacy attributes
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
size-limit report 📦
|
@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/extension-supabase
@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/config-loader
@prisma-next/emitter
@prisma-next/language-server
@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: |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packages/2-sql/2-authoring/contract-psl/src/psl-field-resolution.ts (1)
227-236: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDuplicated
db.-prefix migration-diagnostic branch across the two validators. BothvalidateFieldAttributesandvalidateNamedTypeAttributesimplement the identical "checkdb.prefix → push diagnostic viaformatDbAttributeMigrationMessage→ continue" logic, differing only in the diagnostic code string.
packages/2-sql/2-authoring/contract-psl/src/psl-field-resolution.ts#L227-L236: extract this branch into a shared helper (e.g.pushDbAttributeMigrationDiagnostic(diagnostics, attribute, sourceId, code)inpsl-attribute-parsing.ts) parameterized by diagnostic code.packages/2-sql/2-authoring/contract-psl/src/psl-named-type-resolution.ts#L39-L48: call the same shared helper here instead of re-implementing the branch.♻️ Proposed shared helper
+export function pushDbAttributeMigrationDiagnostic( + diagnostics: ContractSourceDiagnostic[], + attribute: ResolvedAttribute, + sourceId: string, + code: string, +): void { + diagnostics.push({ + code, + message: formatDbAttributeMigrationMessage(attribute), + sourceId, + span: attribute.span, + }); +}🤖 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/2-sql/2-authoring/contract-psl/src/psl-field-resolution.ts` around lines 227 - 236, The duplicated db.-attribute migration diagnostic logic should be centralized. In packages/2-sql/2-authoring/contract-psl/src/psl-attribute-parsing.ts, add a shared helper such as pushDbAttributeMigrationDiagnostic parameterized by diagnostics, attribute, sourceId, and diagnostic code; update validateFieldAttributes in packages/2-sql/2-authoring/contract-psl/src/psl-field-resolution.ts:227-236 and validateNamedTypeAttributes in packages/2-sql/2-authoring/contract-psl/src/psl-named-type-resolution.ts:39-48 to call it while preserving each validator’s existing diagnostic code and continue behavior.
🤖 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.
Inline comments:
In
`@skills/extension-author/prisma-next-extension-upgrade/upgrades/0.16-to-0.17/instructions.md`:
- Line 176: The migration instructions overstate codec preservation by omitting
the Date rebinding exception. Update both specified instruction entries so the
preservation claim is limited to mappings that retain codec references, or
explicitly identifies Date as requiring codec-reference and
contract-storage-hash changes, re-emission, and re-signing.
In `@skills/prisma-next-supabase/SKILL.md`:
- Around line 75-82: Update the canonical Supabase example referenced by the
guide so Profile.userId uses the introduced AuthUserId alias instead of Uuid
directly, keeping it consistent with the schema guidance. Alternatively, revise
the “Mirror” wording in the skill to explicitly identify the alias-based schema
as an equivalent form.
---
Nitpick comments:
In `@packages/2-sql/2-authoring/contract-psl/src/psl-field-resolution.ts`:
- Around line 227-236: The duplicated db.-attribute migration diagnostic logic
should be centralized. In
packages/2-sql/2-authoring/contract-psl/src/psl-attribute-parsing.ts, add a
shared helper such as pushDbAttributeMigrationDiagnostic parameterized by
diagnostics, attribute, sourceId, and diagnostic code; update
validateFieldAttributes in
packages/2-sql/2-authoring/contract-psl/src/psl-field-resolution.ts:227-236 and
validateNamedTypeAttributes in
packages/2-sql/2-authoring/contract-psl/src/psl-named-type-resolution.ts:39-48
to call it while preserving each validator’s existing diagnostic code and
continue behavior.
🪄 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 Plus
Run ID: c2d7b6ea-6477-4d8f-9877-f20200bad8b3
⛔ Files ignored due to path filters (7)
projects/remove-db-attributes/slices/remove-db-channel/dispatches/01-remove-legacy-interpretation.mdis excluded by!projects/**projects/remove-db-attributes/slices/remove-db-channel/dispatches/02-align-architecture-and-guidance-r2.mdis excluded by!projects/**projects/remove-db-attributes/slices/remove-db-channel/dispatches/02-align-architecture-and-guidance.mdis excluded by!projects/**projects/remove-db-attributes/slices/remove-db-channel/dispatches/03-exhaustive-scrub-and-closure.mdis excluded by!projects/**projects/remove-db-attributes/slices/remove-db-channel/plan.mdis excluded by!projects/**projects/remove-db-attributes/slices/remove-db-channel/spec.mdis excluded by!projects/**projects/remove-db-attributes/trace.jsonlis excluded by!projects/**
📒 Files selected for processing (15)
docs/architecture docs/adrs/ADR 226 - Cross-contract foreign-key references.mddocs/architecture docs/adrs/ADR 231 - Declarative attribute specifications.mddocs/architecture docs/adrs/ADR 239 - Option arguments and select templates for authoring helpers.mddocs/architecture docs/adrs/ADR 241 - Scalar types use the authoring type-constructor channel.mddocs/architecture docs/subsystems/6. Ecosystem Extensions & Packs.mdpackages/2-sql/2-authoring/contract-psl/src/psl-attribute-parsing.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/src/psl-named-type-resolution.tspackages/2-sql/2-authoring/contract-psl/test/interpreter.db-attribute-migration-diagnostics.test.tspackages/2-sql/2-authoring/contract-psl/test/interpreter.db-native-types-compatibility.test.tsskills/extension-author/prisma-next-extension-upgrade/upgrades/0.16-to-0.17/instructions.mdskills/prisma-next-contract/SKILL.mdskills/prisma-next-supabase/SKILL.mdskills/upgrade/prisma-next-upgrade/upgrades/0.16-to-0.17/instructions.md
💤 Files with no reviewable changes (1)
- packages/2-sql/2-authoring/contract-psl/test/interpreter.db-native-types-compatibility.test.ts
Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
- **Intent:** Close the completed `@db.*` hard-cut project after PR #1054 merged at `ca1f3a16b`; retain the mandatory final-retro learning as F27. - **Linear:** Refs: [TML-2988](https://linear.app/prisma-company/issue/TML-2988) · [Remove @db.* attributes from PSL](https://linear.app/prisma-company/project/remove-db-attributes-from-psl-7f387115b0fc) - **Scope:** Project DoD evidence: all four hard-cut slices are complete; close-out material was classified as transient, while ADR 241 and F27 are durable; the external-reference scan found no references outside the removed project tree. - **Verification:** `git diff --check origin/main...HEAD` and tracked close-out integrity only: the diff retains F27 while deleting the classified transient artefacts. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Made a minor whitespace/formatting adjustment around the boundary between two failure-mode sections (no content added or changed). <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Linked issue
Refs TML-2988
At a glance
The supported schema puts storage constructors directly in type position:
Id = UuidandSlug = VarChar(191).Decision
This PR hard-cuts the SQL PSL interpreter’s legacy
@db.*lowering channel and makes type-position constructors the only supported storage-type authoring surface. It deletes the family-owned native-type specification/resolver path, emits actionable migration diagnostics for named-type and field-position uses, and records the unifiedAuthoringContributions.typemodel in ADR 241.Reviewer notes
db.prefix only to format migration help. Non-db.dotted attributes continue through the existing extension namespace and unsupported-attribute paths.@db.*references are intentional migration diagnostics/current rewrite guidance or deliberate historical evidence in older release notes, older version-specific upgrade records, and historical ADR context. They were not indiscriminately rewritten.packages/2-sql/5-runtime/src/sql-context.tsalready contained no stale@dbwording onmain, so it was inspected and intentionally left unchanged rather than receiving a no-op edit.44ce52aab1546c1a1598ea17f0d46e4657ae6596in a clean ext4 clone. CurrentHEADis22bbfea9732a75c5b09a8935719a8ec737c4e4c1; the sole descendant change records the completed dispatch inprojects/remove-db-attributes/trace.jsonl. The branch is0commits behindorigin/main.How it fits together
formatDbAttributeMigrationMessagestripsdb.and preserves resolved arguments in source order to produce one migration message for every obsolete spelling.@db.*with their existing position-specific diagnostic codes and the shared actionable message.NativeTypeSpec/NATIVE_TYPE_SPECStable,resolveDbNativeTypeAttribute,allowDbNativeType, and legacy argument parsers are removed from the SQL family interpreter, leaving target-contributed type constructors as the only storage-lowering path.Behavior changes & evidence
@db.*source no longer emits storage descriptors. Named-type declarations that previously lowered through the SQL family’s native-type table now fail and require a type-position constructor. Implementation: named-type validation and the former resolver’s home. Evidence: zero-argument and parameterized diagnostics.use X(args) in type position, preserving positional and named arguments even when the old spelling is duplicate, malformed, or unknown. Implementation: shared formatter and field diagnostic path. Evidence: argument-preservation coverage and field-position coverage.Testing performed
The full matrix passed on exact commit
44ce52aab1546c1a1598ea17f0d46e4657ae6596in a clean ext4 clone:pnpm build— 68/68 tasks passedpnpm fixtures:check— passedpnpm lint:packages— 70/70 tasks passedpnpm lint:deps— 0 violationspnpm typecheck— 143/143 tasks passedpnpm test:packages— 13,719 tests passedpnpm test:integration— 1,336 tests passedpnpm test:e2e— 109 tests passedpnpm coverage:report— 0 blocking failuresUnchanged CLI timing tests exceeded their 500 ms budget on the mounted virtiofs source checkout but passed at the same commit in the clean ext4 clone. No timeout, threshold, or test policy was changed.
Compatibility / migration / risk
BaseType @db.XasXandBaseType @db.X(args)asX(args)in type position before re-emitting.@db.*spellings receive a syntactic replacement suggestion, not a promise that the suggested constructor exists. Constructor resolution provides the authoritative follow-on validation.db.extension attributes; the implementation checks onlyattribute.name.startsWith('db.'), and the complete package/integration/E2E matrix passed.Skill update
Current user-facing guidance was updated in
skills/prisma-next-contract,skills/prisma-next-supabase, the Prisma Next 0.16→0.17 upgrade instructions, and the extension-author 0.16→0.17 upgrade instructions.Alternatives considered
NATIVE_TYPE_SPECSas a compatibility path: Rejected because it would preserve duplicate storage ownership in the SQL family after targets already contribute the authoritative constructors.@db.*mention: Rejected because older release notes and version-specific upgrade records describe behavior that was true for those releases; only live guidance should describe the current surface.Checklist
git commit -s) per the DCO; all seven branch commits have a matchingSigned-off-by:trailer.TML-NNNN: <sentence-case title>form and names the concrete deliverable.Summary by CodeRabbit
Breaking Changes
@db.*storage-type attributes are no longer supported.Uuid,VarChar(191)), rewriting any remaining@db.*forms toX/X(args).Documentation
AuthUserId.Bug Fixes
Tests
db.*migration diagnostics and removed outdated compatibility tests.