Skip to content

Port upstream Prisma query/write/data-type behaviours as multi-target ORM tests#995

Open
SevInf wants to merge 4 commits into
mainfrom
port-tests
Open

Port upstream Prisma query/write/data-type behaviours as multi-target ORM tests#995
SevInf wants to merge 4 commits into
mainfrom
port-tests

Conversation

@SevInf

@SevInf SevInf commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Linked issue

n/a — no Linear ticket; this is test-coverage work.

This PR pins tests against real bugs surfaced during the work: #980 (self-referential relation predicate returns []), #981 (@map column names with spaces emit invalid contract.d.ts), and #983 (int8/bigint reads return a string). #982 was opened during the work and then closed as invalid.

At a glance

The bulk of the change is result-level ORM tests that pin upstream Prisma behaviours against a live database. For example, the empty-in edge case (empty list matches zero rows, not invalid SQL):

it(
  '#8 in([]) returns no rows',
  async () => {
    await withCollectionRuntime(async (runtime) => {
      const users = createUsersCollection(runtime);
      await seedUsers(runtime, [
        { id: 1, name: 'a', email: 'a@example.com' },
        { id: 2, name: 'b', email: 'b@example.com' },
      ]);

      const rows = await users.where((u) => u.name.in([])).all();

      expect(rows).toEqual([]);
    });
  },
  timeouts.spinUpPpgDev,
);

Before this PR the sql-orm-client suite asserted operator→AST shapes at the unit level, but had almost no result-level where/write coverage against a real database.

Decision

This PR ports concrete, individually-cited behaviours from the upstream Prisma client functional suite and the engine connector-test-kit into prisma-next's own test suites, each against the database the upstream test actually targets:

  1. Postgres — the large majority: filters, boolean combinators, one-to-many relation predicates, ordering & pagination, aggregation/groupBy, distinct, writes (create/update/delete/upsert/unchecked/nested-connect), and data-type round-trips + typed filters.
  2. SQLite — the one SQLite-only regression, ported against SQLite via the e2e ORM harness.
  3. MongoDB — two MongoDB-only regressions, ported against Mongo via the mongo ORM harness.

It also adds a small enabling change: a PSL-authored data-types fixture (fixtures/datatypes-psl) covering the parameterized and key-typed Postgres columns the data-type ports need (numeric/char via named types, bytea PK, a BigInt-keyed relation), wired into the integration emit script so fixtures:check regenerates and gates it.

Where prisma-next is genuinely buggy, the ported test asserts the correct upstream behaviour and is marked it.fails against the filed issue — it flips green the moment the bug is fixed. No test works around a bug by asserting wrong output.

How it fits together

  1. Fixture + harness — a new PSL contract (DataRow plus ParamRow/BytesRow/BigParent/BigChild) and a shared datatypes-helpers.ts that builds the runtime, creates the tables, and hands back typed collections. Parameterized native types (numeric(20,8), char(12)) are declared as PSL named types — the supported path for supplying typeParams.
  2. Postgres ports — grouped by concern into ported-*.test.ts files, all driving the existing PGlite integration harness with whole-shape toEqual assertions.
  3. SQLite portsome { … in [...] } fed into a count() must not fan out and double-count the parent; asserted against a real SQLite database.
  4. MongoDB ports — a $-containing string value is treated as data (filter + update), and an OR[ NOT eq, eq ] filter resolves correctly.
  5. Bug pinning — self-relation some (sql-orm-client: relation predicate (some/every/none) returns wrong results on self-referential relations #980) and every int8 read (postgres: int8/bigint reads return a string but the codec declares number (should be bigint for both output type and runtime value) #983) are asserted correctly and quarantined under it.fails with a comment pointing at the issue.

What lands in this PR

Commit What it adds
Add PSL data-types fixture and wire it into the integration emit The datatypes-psl fixture (+ generated contract), the shared helper, and the emit wiring
Port upstream Prisma query/write behaviours as Postgres ORM tests 8 ported-*.test.ts files (124 cases: 117 pass, 7 it.fails)
Port SQLite EXISTS-duplicate regression as an ORM e2e test 1 SQLite e2e case
Port MongoDB filter regressions as ORM integration tests 3 Mongo cases (filter, update, OR/NOT)

Notes for the reviewer

Testing performed

  • pnpm --filter @prisma-next/integration-tests exec vitest run test/sql-orm-client/ported-*.test.ts — 124 cases: 117 passed, 7 expected-fail.
  • pnpm --filter @prisma-next/e2e-tests exec vitest run test/sqlite/ported-regressions.test.ts1 passed.
  • MONGOMS_SYSTEM_BINARY=<nix mongod> pnpm --filter @prisma-next/integration-tests exec vitest run test/mongo/ported-regressions.test.ts3 passed.
  • pnpm build (Turbo) and the pre-commit biome/lint hooks on every commit.

Skill update

n/a — tests, fixture, and emit-wiring only; no user-facing surface (CLI, public API, config, error codes) changes.

Follow-ups

  • Un-mark the it.fails tests and switch their assertions to the fixed shapes once #980 and #983 land (int8 → bigint, self-relation some).
  • Port the space-column CRUD behaviour once #981 is fixed.

Alternatives considered

  • Port everything against Postgres. Rejected: connector-specific regressions (a SQLite EXISTS bug, MongoDB $-operator handling) prove nothing on Postgres. Each is ported against the database it targets.
  • Assert prisma-next's current (buggy) output to keep the suite green. Rejected: that would bake bugs into the tests. The correct behaviour is asserted and the test is it.fails against the tracked issue instead.
  • Extend the shared TS-builder fixture for the data types. Rejected in favour of a dedicated PSL fixture, matching the existing mn-psl precedent and exercising the PSL authoring path (named types) directly.

Checklist

  • All commits are signed off (git commit -s) per the DCO.
  • I read CONTRIBUTING.md and the change is scoped to one logical concern (porting upstream test coverage).
  • Tests are updated (this PR is tests).
  • The PR title is in TML-NNNN: <sentence-case title> form.
  • The Skill update section above is filled in (n/a — internal only).

Summary by CodeRabbit

  • Tests
    • Added comprehensive coverage for SQL ORM filtering, relations, ordering, aggregation, pagination, scalar data types, writes, and regression scenarios.
    • Added PostgreSQL, MongoDB, and SQLite tests for nested filters, special-character matching, codec round-trips, and mutation behavior.
    • Added fixtures covering enums, numeric and character types, binary keys, BigInt relations, and database defaults.

SevInf added 4 commits July 16, 2026 10:33
A PSL-authored fixture (DataRow plus ParamRow/BytesRow/BigParent/BigChild)
covering every parameterized and key-typed Postgres column the data-type
ports need, and a shared datatypes-helpers harness. Wired into the
integration `emit` script so `fixtures:check` regenerates and gates it.

Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Ports concrete behaviours from the upstream Prisma client functional suite
and engine connector-test-kit into result-level sql-orm-client integration
tests: filters, combinators, relation predicates, ordering/pagination,
aggregation/groupBy, distinct, writes, and data-type round-trips/filters.
Self-relation `some` (#980) and int8 string reads (#983) are asserted
correctly and marked `it.fails` against the filed bugs.

Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Ports the SQLite-only upstream regression (some { ... in [...] } fed into a
count must not fan out and duplicate the parent) against SQLite via the e2e
ORM harness, asserting count 1.

Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Ports two MongoDB-only upstream behaviours against Mongo: a string value
containing a literal `$` is treated as data (filter + update), and an
OR[NOT eq, eq] filter evaluates to the expected result set.

Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
@SevInf
SevInf requested a review from a team as a code owner July 16, 2026 10:40
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

The PR adds broad ported regression coverage for SQL-ORM datatype handling, filters, relations, ordering, aggregation, writes, and projections, plus MongoDB and SQLite regression tests. It also adds a PostgreSQL datatype contract fixture, runtime helpers, and contract emission wiring.

Ported ORM coverage

Layer / File(s) Summary
Runtime and datatype contracts
test/integration/package.json, test/integration/test/sql-orm-client/fixtures/datatypes-psl/*, test/integration/test/sql-orm-client/datatypes-helpers.ts, test/integration/test/sql-orm-client/ported-datatypes*.test.ts
Adds the datatypes contract, PostgreSQL runtime setup, collection factories, isolated schema preparation, and scalar codec round-trip/filter tests.
Datatype regression assertions
test/integration/test/sql-orm-client/ported-datatypes-regressions.test.ts
Covers typed filters, enums, cursor pagination, integer and float boundaries, grouping, aggregation, and selected creation results.
Scalar and relation filters
test/integration/test/sql-orm-client/ported-filters-scalar.test.ts, test/integration/test/sql-orm-client/ported-filters-relations.test.ts
Tests scalar operators, null semantics, boolean combinators, and nested some, every, and none relation predicates.
Ordering, pagination, and aggregation
test/integration/test/sql-orm-client/ported-ordering-aggregation.test.ts
Tests ordering precedence, cursor traversal, aggregates, grouping, having, distinct, pagination, and scalar projections.
Writes and SQL-ORM regressions
test/integration/test/sql-orm-client/ported-writes-simple.test.ts, test/integration/test/sql-orm-client/ported-regressions.test.ts
Covers create/update/delete behavior, upserts, composite selectors, relation-scoped mutations, direct foreign-key writes, nested updates, and database defaults.
Cross-database regression suites
test/integration/test/mongo/ported-regressions.test.ts, test/e2e/framework/test/sqlite/ported-regressions.test.ts
Adds MongoDB literal-string and logical-expression tests and a SQLite nested relation-filter aggregation test.

Estimated code review effort: 5 (Critical) | ~120 minutes

Suggested reviewers: wmadden

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: porting Prisma query, write, and data-type behaviors into multi-target ORM tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 port-tests

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.

@github-actions

Copy link
Copy Markdown

size-limit report 📦

Path Size
postgres / no-emit 158.31 KB (0%)
postgres / emit 131.83 KB (0%)
mongo / no-emit 98.71 KB (0%)
mongo / emit 89.43 KB (0%)
cf-worker / no-emit 185.14 KB (0%)
cf-worker / emit 155.9 KB (0%)

@pkg-pr-new

pkg-pr-new Bot commented Jul 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

@prisma-next/extension-author-tools

npm i https://pkg.pr.new/@prisma-next/extension-author-tools@995

@prisma-next/mongo-runtime

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

@prisma-next/family-mongo

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

@prisma-next/sql-runtime

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

@prisma-next/family-sql

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

@prisma-next/extension-arktype-json

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

@prisma-next/middleware-cache

npm i https://pkg.pr.new/@prisma-next/middleware-cache@995

@prisma-next/mongo

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

@prisma-next/extension-paradedb

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

@prisma-next/extension-pgvector

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

@prisma-next/extension-postgis

npm i https://pkg.pr.new/@prisma-next/extension-postgis@995

@prisma-next/postgres

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

@prisma-next/sql-orm-client

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

@prisma-next/sqlite

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

@prisma-next/extension-supabase

npm i https://pkg.pr.new/@prisma-next/extension-supabase@995

@prisma-next/target-mongo

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

@prisma-next/adapter-mongo

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

@prisma-next/driver-mongo

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

@prisma-next/contract

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

@prisma-next/utils

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

@prisma-next/config

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

@prisma-next/errors

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

@prisma-next/framework-components

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

@prisma-next/operations

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

@prisma-next/ts-render

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

@prisma-next/contract-authoring

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

@prisma-next/ids

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

@prisma-next/psl-parser

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

@prisma-next/psl-printer

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

@prisma-next/cli

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

@prisma-next/cli-telemetry

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

@prisma-next/config-loader

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

@prisma-next/emitter

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

@prisma-next/language-server

npm i https://pkg.pr.new/@prisma-next/language-server@995

@prisma-next/migration-tools

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

prisma-next

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

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

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

@prisma-next/mongo-codec

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

@prisma-next/mongo-contract

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

@prisma-next/mongo-value

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

@prisma-next/mongo-contract-psl

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

@prisma-next/mongo-contract-ts

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

@prisma-next/mongo-emitter

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

@prisma-next/mongo-schema-ir

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

@prisma-next/mongo-query-ast

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

@prisma-next/mongo-orm

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

@prisma-next/mongo-query-builder

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

@prisma-next/mongo-lowering

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

@prisma-next/mongo-wire

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

@prisma-next/sql-contract

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

@prisma-next/sql-errors

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

@prisma-next/sql-operations

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

@prisma-next/sql-schema-ir

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

@prisma-next/sql-contract-psl

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

@prisma-next/sql-contract-ts

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

@prisma-next/sql-contract-emitter

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

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

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

@prisma-next/sql-relational-core

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

@prisma-next/sql-builder

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

@prisma-next/target-postgres

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

@prisma-next/target-sqlite

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

@prisma-next/adapter-postgres

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

@prisma-next/adapter-sqlite

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

@prisma-next/driver-postgres

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

@prisma-next/driver-sqlite

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

commit: ef7c270

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
test/integration/test/mongo/ported-regressions.test.ts (1)

26-26: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer separate expect() assertions over toMatchObject() for multiple fields.

Based on learnings, test files should prefer separate expect() assertions for each field instead of combining checks with toMatchObject(). This yields clearer, more actionable failure messages that pinpoint exactly which field failed.

  • test/integration/test/mongo/ported-regressions.test.ts#L26-L26: Replace expect(results[0]).toMatchObject(...) with separate .toBe() checks for results[0].name and results[0].email.
  • test/integration/test/mongo/ported-regressions.test.ts#L41-L41: Replace expect(updated).toMatchObject(...) with separate .toBe() checks for updated.name and updated.email.
🤖 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 `@test/integration/test/mongo/ported-regressions.test.ts` at line 26, Replace
the combined toMatchObject assertions in
test/integration/test/mongo/ported-regressions.test.ts at lines 26-26 and 41-41
with separate toBe assertions: check results[0].name and results[0].email
independently at the first site, and updated.name and updated.email
independently at the second site.

Source: Learnings

🤖 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 `@test/integration/package.json`:
- Line 7: Update the emit:check git diff scope to include
test/sql-orm-client/fixtures/datatypes-psl/generated alongside the existing
generated fixture paths. Keep the emit command and other diff checks unchanged
so datatype fixture output is validated for stale generated JSON and types.

In `@test/integration/test/sql-orm-client/ported-regressions.test.ts`:
- Around line 113-139: Update the entry 109 test to use one shared full-length
blindCast<Char<36>> constant for the UserRole.roleId fixture values. Reuse that
constant in seedUserRoles, the cursor passed to cursor(), and the expected rows,
replacing the short roleId literals while preserving the existing ordering and
results.

---

Nitpick comments:
In `@test/integration/test/mongo/ported-regressions.test.ts`:
- Line 26: Replace the combined toMatchObject assertions in
test/integration/test/mongo/ported-regressions.test.ts at lines 26-26 and 41-41
with separate toBe assertions: check results[0].name and results[0].email
independently at the first site, and updated.name and updated.email
independently at the second site.
🪄 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: ffc02073-e556-4dd8-b52e-a764c378e12e

📥 Commits

Reviewing files that changed from the base of the PR and between cfea1a2 and ef7c270.

⛔ Files ignored due to path filters (2)
  • test/integration/test/sql-orm-client/fixtures/datatypes-psl/generated/contract.d.ts is excluded by !**/generated/**
  • test/integration/test/sql-orm-client/fixtures/datatypes-psl/generated/contract.json is excluded by !**/generated/**
📒 Files selected for processing (14)
  • test/e2e/framework/test/sqlite/ported-regressions.test.ts
  • test/integration/package.json
  • test/integration/test/mongo/ported-regressions.test.ts
  • test/integration/test/sql-orm-client/datatypes-helpers.ts
  • test/integration/test/sql-orm-client/fixtures/datatypes-psl/contract.prisma
  • test/integration/test/sql-orm-client/fixtures/datatypes-psl/prisma-next.config.ts
  • test/integration/test/sql-orm-client/ported-datatypes-params.test.ts
  • test/integration/test/sql-orm-client/ported-datatypes-regressions.test.ts
  • test/integration/test/sql-orm-client/ported-datatypes.test.ts
  • test/integration/test/sql-orm-client/ported-filters-relations.test.ts
  • test/integration/test/sql-orm-client/ported-filters-scalar.test.ts
  • test/integration/test/sql-orm-client/ported-ordering-aggregation.test.ts
  • test/integration/test/sql-orm-client/ported-regressions.test.ts
  • test/integration/test/sql-orm-client/ported-writes-simple.test.ts

"type": "module",
"scripts": {
"emit": "node ../../packages/1-framework/3-tooling/cli/dist/cli.js contract emit --config test/fixtures/prisma-next.config.ts && node ../../packages/1-framework/3-tooling/cli/dist/cli.js contract emit --config test/namespaced-accessors/fixtures/prisma-next.config.ts && node ../../packages/1-framework/3-tooling/cli/dist/cli.js contract emit --config test/sql-orm-client/fixtures/scalar-lists/prisma-next.config.ts && (node ../../packages/1-framework/3-tooling/cli/dist/cli.js contract emit --config test/mongo/fixtures/prisma-next.config.ts || true) && pnpm emit:authoring",
"emit": "node ../../packages/1-framework/3-tooling/cli/dist/cli.js contract emit --config test/fixtures/prisma-next.config.ts && node ../../packages/1-framework/3-tooling/cli/dist/cli.js contract emit --config test/namespaced-accessors/fixtures/prisma-next.config.ts && node ../../packages/1-framework/3-tooling/cli/dist/cli.js contract emit --config test/sql-orm-client/fixtures/scalar-lists/prisma-next.config.ts && node ../../packages/1-framework/3-tooling/cli/dist/cli.js contract emit --config test/sql-orm-client/fixtures/datatypes-psl/prisma-next.config.ts && (node ../../packages/1-framework/3-tooling/cli/dist/cli.js contract emit --config test/mongo/fixtures/prisma-next.config.ts || true) && pnpm emit:authoring",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Include the datatype fixture output in emit:check.

This emitter updates test/sql-orm-client/fixtures/datatypes-psl/generated, but the scoped git diff --exit-code on Line 9 does not check that path. Contract source changes can therefore leave stale JSON/types undetected.

Proposed fix
-    "emit:check": "pnpm emit && git diff --exit-code test/fixtures/contract.json test/fixtures/contract.d.ts test/authoring/parity test/authoring/side-by-side",
+    "emit:check": "pnpm emit && git diff --exit-code test/fixtures/contract.json test/fixtures/contract.d.ts test/sql-orm-client/fixtures/datatypes-psl/generated test/authoring/parity test/authoring/side-by-side",
🤖 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 `@test/integration/package.json` at line 7, Update the emit:check git diff
scope to include test/sql-orm-client/fixtures/datatypes-psl/generated alongside
the existing generated fixture paths. Keep the emit command and other diff
checks unchanged so datatype fixture output is validated for stale generated
JSON and types.

Comment on lines +113 to +139
it(
'entry 109: composite multi-field cursor with parameterised values',
async () => {
await withCollectionRuntime(async (runtime) => {
const userRoles = createUserRolesCollection(runtime);

await seedUserRoles(runtime, [
{ userId: 1, roleId: 'a', level: 10 },
{ userId: 1, roleId: 'b', level: 20 },
{ userId: 1, roleId: 'c', level: 30 },
{ userId: 2, roleId: 'a', level: 40 },
]);

// Composite (userId, roleId) cursor: the boundary tuple is bound as
// parameters, and the seek advances past (1, 'a') within user 1.
const rows = await userRoles
.where((r) => r.userId.eq(1))
.orderBy([(r) => r.userId.asc(), (r) => r.roleId.asc()])
.cursor({ userId: 1, roleId: 'a' })
.skip(0)
.take(5)
.all();

expect(rows).toEqual([
{ userId: 1, roleId: 'b', level: 20 },
{ userId: 1, roleId: 'c', level: 30 },
]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
ast-grep outline test/integration/test/sql-orm-client/runtime-helpers.ts \
  --match 'SeedUserRole|seedUserRoles' --view expanded

rg -n -C3 '\bUserRole\b|\broleId\b' \
  test/integration/test/sql-orm-client/helpers.ts \
  test/integration/test/sql-orm-client/runtime-helpers.ts \
  test/integration/test/sql-orm-client/ported-regressions.test.ts \
  test/integration/test/sql-orm-client/ported-writes-simple.test.ts

Repository: prisma/prisma-next

Length of output: 11806


Brand the UserRole.roleId fixtures — use a single full-length blindCast<Char<36>> constant for these seeds, cursor inputs, and expectations; the short literals don’t match the UserRole.roleId contract used elsewhere in the test suite.

🤖 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 `@test/integration/test/sql-orm-client/ported-regressions.test.ts` around lines
113 - 139, Update the entry 109 test to use one shared full-length
blindCast<Char<36>> constant for the UserRole.roleId fixture values. Reuse that
constant in seedUserRoles, the cursor passed to cursor(), and the expected rows,
replacing the short roleId literals while preserving the existing ordering and
results.

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