Skip to content

feat(authoring): close VP2 with target-owned terse field presets#326

Open
jkomyno wants to merge 8 commits intomainfrom
feat/vp2-ts-authoring-terseness-parity
Open

feat(authoring): close VP2 with target-owned terse field presets#326
jkomyno wants to merge 8 commits intomainfrom
feat/vp2-ts-authoring-terseness-parity

Conversation

@jkomyno
Copy link
Copy Markdown
Contributor

@jkomyno jkomyno commented Apr 10, 2026

closes TML-2243

Why this exists

VP2's user story in the April milestone is specific: "I author a representative contract (multiple models, relations, at least one extension type) in both PSL and the new TypeScript authoring surface. The TypeScript version is in the same ballpark of length as the PSL version." Until this branch the claim was unprovable end-to-end — every parity fixture under test/integration/test/authoring/parity/ used the verbose structural DSL (field.column(int4Column)), and the only place that exercised the terse field.text() / field.int() style wired itself to mock packs. The real @prisma-next/family-sql/pack did ship text, timestamp, createdAt, but bound them to sql/* codec IDs that never aligned with the postgres adapter's pg/* PSL mapping — so the emitted contracts diverged, and a PSL / TS byte-identical parity test was impossible to write. field.int(), field.boolean(), field.float(), field.json() weren't shipped at all.

The representative contract

A two-model shape with seven scalar types, a pgvector named extension type, and a cascading relation — small enough to read in one screen, large enough to tick every ingredient the VP2 user story calls out. This is the fixture the terseness assertion measures against.

PSL (schema.prisma, 20 semantic lines):

types {
  Embedding = Bytes @pgvector.column(length: 1536)
}

model User {
  id Int @id @default(autoincrement())
  email String @unique
  age Int
  isActive Boolean @default(true)
  score Float?
  profile Json?
  embedding Embedding?
  createdAt DateTime @default(now())
}

model Post {
  id Int @id @default(autoincrement())
  userId Int
  title String
  rating Float?
  user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
}

TS callback mode (contract.ts, 38 semantic lines):

import pgvector from '@prisma-next/extension-pgvector/pack';
import sqlFamily from '@prisma-next/family-sql/pack';
import { defineContract, rel } from '@prisma-next/sql-contract-ts/contract-builder';
import postgresPack from '@prisma-next/target-postgres/pack';

export const contract = defineContract(
  { family: sqlFamily, target: postgresPack, extensionPacks: { pgvector } },
  ({ field, model, type }) => {
    const types = {
      Embedding: type.pgvector.vector(1536),
    } as const;
    const User = model('User', {
      fields: {
        id: field.int().defaultSql('autoincrement()').id(),
        email: field.text().unique(),
        age: field.int(),
        isActive: field.boolean().default(true),
        score: field.float().optional(),
        profile: field.json().optional(),
        embedding: field.namedType(types.Embedding).optional(),
        createdAt: field.createdAt(),
      },
    }).sql({ table: 'user' });
    const Post = model('Post', {
      fields: {
        id: field.int().defaultSql('autoincrement()').id(),
        userId: field.int(),
        title: field.text(),
        rating: field.float().optional(),
      },
      relations: {
        user: rel
          .belongsTo(User, { from: 'userId', to: 'id' })
          .sql({ fk: { onDelete: 'cascade', onUpdate: 'cascade' } }),
      },
    }).sql({ table: 'post' });
    return { types, models: { User, Post } };
  },
);

Between them, the two models exercise every new preset (field.int(), field.text(), field.boolean(), field.float(), field.json(), field.createdAt()), the extension-contributed type constructor (type.pgvector.vector(n)), and the chainable modifiers the old structural DSL already supported (.unique(), .default(literal), .optional(), .defaultSql(expr), .id(), .sql({ fk })) — the shape of everyday CRUD code, not a pathological edge case. All four ingredients from the VP2 user story (multiple models, relation, extension type, ballpark ratio) are satisfied by this one fixture.

The numbers

20 PSL → 38 TS = 1.90x. The pre-existing core-surface parity fixture, which uses the structural DSL for similar scalars, is 2.46x. The pgvector-named-type fixture (structural DSL, with extension type but no scalars) is 3.43x. The April milestone doc put the previous baseline at 3–5x. The callback-mode fixture is now the tersest parity case in the repo — notably, adding the pgvector extension type improved the ratio (was 2.06x without it), because PSL spends three lines on a types { ... } block for a single named type while the TS equivalent amortizes better across the callback factory.

The ratio is locked as a test invariant in callback-mode-terseness.test.ts, which asserts two things: ratio ≤ 2.1x PSL, and strictly tighter than the structural core-surface baseline. Either threshold failing is a loud test regression, not silent drift.

What shipped

  1. postgres/src/core/authoring.ts@prisma-next/target-postgres/pack now ships the scalar preset vocabulary: text, int, bigint, float, decimal, boolean, json, bytes, dateTime, createdAt. Each preset is bound to the exact (codecId, nativeType) pair the postgres adapter already emits for the corresponding PSL scalar, so PSL and TS produce byte-identical contracts as a consequence of codec alignment — not as a separately enforced invariant.
  2. family-sql/src/core/authoring-field-presets.ts — drops three presets (text, timestamp, createdAt) whose sql/* codec IDs stamped the wrong thing on authored columns. No codecs were removedsql/text@1 and friends still exist and are still registered in codecs.ts (L611–L639); only the three authoring-time shortcuts that miswired them are gone. Generator-aligned presets (uuid, ulid, nanoid, cuid2, ksuid, field.id.*) stay in family-sql because @prisma-next/ids metadata pins their column descriptor to sql/char@1 in both PSL and TS paths regardless of target.
  3. callback-mode-scalars fixture + callback-mode-terseness.test.ts — proves parity end-to-end through the existing cli.emit-parity-fixtures runner (same contract.json, storageHash, profileHash, executionHash from both surfaces), including the pgvector extension type wired via the real @prisma-next/extension-pgvector/pack — not a mock. The terseness ratio is locked as described above.

Risks and non-goals

The removal from @prisma-next/family-sql/pack is a breaking change on paper: anyone importing field.text() / field.timestamp() / field.createdAt() from the real family pack would now fail to resolve. Repo grep confirms no real call site does — only mock-pack tests define their own inline copies. The full integration suite (366 tests, including all 13 pre-existing parity fixtures) passes with no expected.contract.json churn.

Follow-up I'm explicitly leaving for May: 4 of the 10 presets I shipped (bigint, decimal, bytes, dateTime) aren't exercised by any parity fixture, so they could drift silently. The April milestone's stop condition is explicit — "Then stop — authoring ergonomics, API naming, and syntactic sugar are May" — so hunting down vocabulary coverage is out of scope for VP2. Tracking as a follow-up.

Deliberately out of scope: SQLite or any second SQL target — it will ship its own preset vocabulary when it lands; parameterized types (varchar(n), numeric(p, s), time(p)) — deferred until a real caller needs them, VP2's stop condition is terseness, not vocabulary coverage; and re-pointing the postgres adapter's PSL scalar descriptors to family-level sql/* codec IDs — considered and rejected, 250+ files assert on pg/* in emitted contracts, for no corresponding parity win.

Summary by CodeRabbit

  • New Features

    • Added PostgreSQL field presets with common types and a default for createdAt (now()).
    • Added pgvector-backed embedding support in an example contract and generated Postgres contract output.
  • Chores

    • Removed several family-level SQL field presets (text, timestamp, createdAt) in favor of target-provided presets.
  • Tests

    • Added integration test enforcing callback-mode contract terseness and parity with core surface.

jkomyno added 3 commits April 10, 2026 09:32
Move scalar field presets to the owning layer so the TS callback surface
and the PSL scalar surface lower to byte-identical contracts.

- target-postgres now ships presets (text, int, bigint, float, decimal,
  boolean, json, bytes, dateTime, createdAt) using the same pg/* codec
  IDs and native types that the postgres adapter already emits for PSL
  scalars. This unblocks the terse field.int() / field.boolean() /
  field.json() / field.float() vocabulary the April milestone flagged
  as missing.
- family-sql drops text, timestamp, and createdAt — their sql/* codec
  IDs never aligned with any real target's PSL mapping and blocked
  parity. The generator-aligned presets (uuid, ulid, nanoid, cuid2,
  ksuid, id.*) stay: their sql/char@1 codec is fixed by the ID
  generator metadata override in both PSL and TS paths.
Prove VP2 parity end-to-end: author the same contract in PSL and in the
TS callback surface using the new target-postgres field presets, and
verify both paths emit byte-identical contract.json, storageHash,
profileHash, and executionHash.

The fixture covers the common scalar vocabulary (int with
autoincrement, text with unique, int, boolean with literal default,
float optional, json optional, DateTime with now() default) plus a
cascading belongsTo relation. It slots into the existing
cli.emit-parity-fixtures runner, so no test-harness changes are needed.
Add the formal terseness comparison the April milestone's VP2 task 2
asked for: count semantic lines (non-blank, non-comment) in the
callback-mode-scalars fixture's schema.prisma and contract.ts, and
assert the ratio stays under 2.1x.

Also assert the ratio is strictly tighter than the structural
core-surface baseline so regressions in the preset vocabulary (or in
the composed helper pipeline) can't silently widen the window. Current
numbers: callback-mode-scalars 16→33 = 2.06x, core-surface 24→59 =
2.46x — measurably under the 3–5x baseline the milestone doc called
out.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: b64ad1ed-111e-417e-870f-3f77f3ed4482

📥 Commits

Reviewing files that changed from the base of the PR and between 7448e08 and 1417eb9.

📒 Files selected for processing (9)
  • packages/2-mongo-family/9-family/src/exports/pack.ts
  • packages/3-extensions/pgvector/src/exports/pack.ts
  • packages/3-mongo-target/1-mongo-target/src/exports/pack.ts
  • packages/3-targets/3-targets/postgres/src/exports/pack.ts
  • packages/3-targets/3-targets/sqlite/src/exports/pack.ts
  • test/integration/test/authoring/parity/callback-mode-scalars/contract.ts
  • test/integration/test/authoring/parity/callback-mode-scalars/expected.contract.json
  • test/integration/test/authoring/parity/callback-mode-scalars/schema.prisma
  • test/integration/test/contract-builder.types.test-d.ts
✅ Files skipped from review due to trivial changes (2)
  • test/integration/test/authoring/parity/callback-mode-scalars/schema.prisma
  • test/integration/test/authoring/parity/callback-mode-scalars/expected.contract.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/integration/test/authoring/parity/callback-mode-scalars/contract.ts

📝 Walkthrough

Walkthrough

Family-level SQL authoring presets were narrowed to ID-aligned codecs; text, timestamp, and createdAt were removed from the SQL family and added to the Postgres target as postgresAuthoringFieldPresets (with createdAt default now()). Several pack export type assertions were simplified. New integration tests and fixtures validate callback-mode terseness and scalar parity (including pgvector).

Changes

Cohort / File(s) Summary
Family-level presets
packages/2-sql/9-family/src/core/authoring-field-presets.ts
Removed text, timestamp, and createdAt family-level presets; added module doc restricting family-level presets to ID-aligned codec/native-type pairs.
Postgres target authoring
packages/3-targets/3-targets/postgres/src/core/authoring.ts
Added postgresAuthoringFieldPresets (typed satisfies AuthoringFieldNamespace) defining field presets for common scalars and createdAt with output.default: now().
Postgres descriptor metadata
packages/3-targets/3-targets/postgres/src/core/descriptor-meta.ts
Wired postgresAuthoringFieldPresets into postgresTargetDescriptorMeta.authoring alongside type.
Integration terseness test
test/integration/test/authoring/callback-mode-terseness.test.ts
New Vitest integration test computing semantic line counts to assert callback-mode TS/PSL ratio ≤ 2.1 and lower than core-surface baseline.
Callback-mode fixture: contract & schema & expected
test/integration/test/authoring/parity/callback-mode-scalars/contract.ts, .../schema.prisma, .../expected.contract.json
Added callback-mode fixture using pgvector Embedding, User and Post models, relations (cascade), and generated expected contract JSON (includes now() default for createdAt).
Callback-mode fixture: packs
test/integration/test/authoring/parity/callback-mode-scalars/packs.ts
Exports extensionPacks containing pgvector (readonly [typeof pgvector]) for the fixture.
Pack export type assertions
packages/2-mongo-family/9-family/src/exports/pack.ts, packages/3-extensions/pgvector/src/exports/pack.ts, packages/3-mongo-target/1-mongo-target/src/exports/pack.ts, packages/3-targets/3-targets/postgres/src/exports/pack.ts, packages/3-targets/3-targets/sqlite/src/exports/pack.ts
Removed framework-specific *PackRef/TargetPackRef/ExtensionPackRef intersections from default export casts, narrowing exported compile-time assertions and keeping __codecTypes optional typing where present.
Typecheck test update
test/integration/test/contract-builder.types.test-d.ts
Updated typecheck expectations to match callback-mode model fields (int autoincrement id, text email, boolean isActive, float score, json profile, createdAt timestamptz) and added corresponding codecId assertions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Suggested reviewers

  • wmadden

Poem

🐇 I nudged presets from family to post,

timestamps hop where they suit the most,
createdAt hums with now()’s small chime,
vectors and models kept neat in their time,
contracts stay brief — a rabbit’s quick rhyme.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat(authoring): close VP2 with target-owned terse field presets' accurately and specifically describes the main change: implementing target-owned field presets for Postgres authoring to achieve terseness parity between TypeScript and PSL.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/vp2-ts-authoring-terseness-parity

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 10, 2026

Open in StackBlitz

@prisma-next/mongo-runtime

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

@prisma-next/family-mongo

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

@prisma-next/sql-runtime

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

@prisma-next/family-sql

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

@prisma-next/extension-paradedb

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

@prisma-next/extension-pgvector

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

@prisma-next/postgres

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

@prisma-next/sql-orm-client

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

@prisma-next/sqlite

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

@prisma-next/target-mongo

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

@prisma-next/adapter-mongo

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

@prisma-next/driver-mongo

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

@prisma-next/contract

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

@prisma-next/utils

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

@prisma-next/config

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

@prisma-next/errors

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

@prisma-next/framework-components

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

@prisma-next/operations

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

@prisma-next/contract-authoring

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

@prisma-next/ids

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

@prisma-next/psl-parser

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

@prisma-next/psl-printer

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

@prisma-next/cli

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

@prisma-next/emitter

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

@prisma-next/migration-tools

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

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

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

@prisma-next/runtime-executor

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/runtime-executor@326

@prisma-next/mongo-codec

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

@prisma-next/mongo-contract

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

@prisma-next/mongo-value

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

@prisma-next/mongo-contract-psl

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

@prisma-next/mongo-contract-ts

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

@prisma-next/mongo-emitter

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

@prisma-next/mongo-schema-ir

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

@prisma-next/mongo-query-ast

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

@prisma-next/mongo-orm

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

@prisma-next/mongo-pipeline-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-pipeline-builder@326

@prisma-next/mongo-lowering

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

@prisma-next/mongo-wire

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

@prisma-next/sql-contract

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

@prisma-next/sql-errors

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

@prisma-next/sql-operations

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

@prisma-next/sql-schema-ir

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

@prisma-next/sql-contract-psl

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

@prisma-next/sql-contract-ts

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

@prisma-next/sql-contract-emitter

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

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

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

@prisma-next/sql-relational-core

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

@prisma-next/sql-builder

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

@prisma-next/target-postgres

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

@prisma-next/target-sqlite

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

@prisma-next/adapter-postgres

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

@prisma-next/adapter-sqlite

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

@prisma-next/driver-postgres

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

@prisma-next/driver-sqlite

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

commit: 1417eb9

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)
test/integration/test/authoring/callback-mode-terseness.test.ts (1)

14-18: Exclude block comments from semantic-line counting.

Current counting ignores // comments only. /* ... */ comments will inflate the metric and can cause noisy terseness regressions.

Proposed hardening
 function countSemanticLines(source: string): number {
-  return source
+  const withoutBlockComments = source.replace(/\/\*[\s\S]*?\*\//g, '');
+  return withoutBlockComments
     .split('\n')
     .map((line) => line.trim())
     .filter((line) => line.length > 0 && !line.startsWith('//')).length;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/integration/test/authoring/callback-mode-terseness.test.ts` around lines
14 - 18, countSemanticLines currently only excludes lines starting with '//' and
thus counts block comments; to fix, first strip all block comments from the
source (e.g. remove matches of /\/\*[\s\S]*?\*\//g) inside countSemanticLines,
then split into lines and for each line remove any trailing inline '//' comments
(e.g. strip /\/\/.*$/ from each line) before trimming and applying the existing
emptiness check; update the logic in the countSemanticLines function so block
comments and inline single-line comments are removed prior to counting.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@test/integration/test/authoring/callback-mode-terseness.test.ts`:
- Around line 14-18: countSemanticLines currently only excludes lines starting
with '//' and thus counts block comments; to fix, first strip all block comments
from the source (e.g. remove matches of /\/\*[\s\S]*?\*\//g) inside
countSemanticLines, then split into lines and for each line remove any trailing
inline '//' comments (e.g. strip /\/\/.*$/ from each line) before trimming and
applying the existing emptiness check; update the logic in the
countSemanticLines function so block comments and inline single-line comments
are removed prior to counting.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 83e83cba-2adc-43c3-9058-04e6201475ac

📥 Commits

Reviewing files that changed from the base of the PR and between b5bcbd6 and f09141a.

📒 Files selected for processing (8)
  • packages/2-sql/9-family/src/core/authoring-field-presets.ts
  • packages/3-targets/3-targets/postgres/src/core/authoring.ts
  • packages/3-targets/3-targets/postgres/src/core/descriptor-meta.ts
  • test/integration/test/authoring/callback-mode-terseness.test.ts
  • test/integration/test/authoring/parity/callback-mode-scalars/contract.ts
  • test/integration/test/authoring/parity/callback-mode-scalars/expected.contract.json
  • test/integration/test/authoring/parity/callback-mode-scalars/packs.ts
  • test/integration/test/authoring/parity/callback-mode-scalars/schema.prisma

jkomyno and others added 5 commits April 10, 2026 10:28
…on type

Closes the last gap in VP2's user story — "a representative contract
(multiple models, relations, at least one extension type)". The fixture
now declares an `Embedding` named type via `@pgvector.column(length: 1536)`
in PSL and via the `type.pgvector.vector(n)` callback-mode helper
contributed by the real `@prisma-next/extension-pgvector/pack`, and uses
it through `field.namedType(types.Embedding).optional()` on the `User`
model.

Terseness actually improves: 20 PSL → 38 TS = 1.90x (was 16 → 33 = 2.06x),
because a reusable named type amortizes better in TS than the 3-line
`types { ... }` block in PSL. Still well under the 2.1x test bound in
callback-mode-terseness.test.ts, with meaningful breathing room for
future drift.

No changes to any package source — the fix is entirely in the fixture.
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