Skip to content

fix: fix DATE cursor comparison#29327

Merged
jacek-prisma merged 2 commits intomainfrom
fix/fix-date-cursor
Mar 11, 2026
Merged

fix: fix DATE cursor comparison#29327
jacek-prisma merged 2 commits intomainfrom
fix/fix-date-cursor

Conversation

@jacek-prisma
Copy link
Copy Markdown
Contributor

@jacek-prisma jacek-prisma commented Mar 10, 2026

TML-2059

Fixes #29309

Summary by CodeRabbit

  • Bug Fixes

    • Fixed DateTime parameter handling so string values that represent dates are converted to Date objects during query resolution, preventing string-vs-date comparison issues.
  • Tests

    • Added functional tests for cursor-based pagination on DateTime columns (including composite key scenarios).
    • Added test matrix/schema setup and provider filtering to run the new tests while excluding engines that lack DATE support.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 10, 2026

Walkthrough

Adds DateTime special-casing when evaluating query placeholders to convert string values to Date objects, and introduces a functional test matrix, schema, and test validating composite cursor pagination with a DateTime field in the primary key.

Changes

Cohort / File(s) Summary
DateTime Conversion
packages/client-engine-runtime/src/interpreter/render-query.ts
Added handling in evaluateArg to convert resolved string values to Date when the placeholder type is DateTime, preserving other resolved types.
Test Matrix & Schema
packages/client/tests/functional/issues/29309-datetime-cursor/_matrix.ts, packages/client/tests/functional/issues/29309-datetime-cursor/prisma/_schema.ts
Added test matrix setup and a Prisma schema generator defining Event with composite primary key (appId, createdAt) where createdAt is DateTime @db.Date``.
Functional Test
packages/client/tests/functional/issues/29309-datetime-cursor/tests.ts
Added a test that inserts 10 sequential dates, reads a cursor from the third row, and asserts subsequent pagination results (skipping MongoDB and SQLite). Test targets cursor behavior with DateTime composite keys.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 'fix: fix DATE cursor comparison' accurately describes the main change: fixing a DateTime/DATE cursor comparison issue in compound-key queries.
Linked Issues check ✅ Passed The PR addresses all core objectives from #29309: it fixes the DateTime/DATE cursor comparison in render-query.ts, adds a functional test for compound cursors with DateTime fields, and validates the fix works across database providers.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the DateTime/DATE cursor comparison bug: runtime fix, test matrix, schema, and functional tests for the specific issue.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/fix-date-cursor

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.

Copy link
Copy Markdown
Contributor

@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.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1deeed1a-8b18-45e6-910b-01d1d66f04d0

📥 Commits

Reviewing files that changed from the base of the PR and between f8e742a and b02b8a4.

📒 Files selected for processing (4)
  • packages/client-engine-runtime/src/interpreter/render-query.ts
  • packages/client/tests/functional/issues/29309-datetime-cursor/_matrix.ts
  • packages/client/tests/functional/issues/29309-datetime-cursor/prisma/_schema.ts
  • packages/client/tests/functional/issues/29309-datetime-cursor/tests.ts

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 10, 2026

size-limit report 📦

Path Size
packages/client/runtime/index-browser.js 2.29 KB (0%)
packages/client/runtime/index-browser.d.ts 3.37 KB (0%)
packages/cli/build/index.js 2.5 MB (0%)
packages/client/prisma-client-0.0.0.tgz 26.81 MB (+0.01% 🔺)
packages/cli/prisma-0.0.0.tgz 12.84 MB (0%)
packages/bundle-size/da-workers-libsql/output.tgz 1.33 MB (+0.01% 🔺)
packages/bundle-size/da-workers-neon/output.tgz 1.39 MB (+0.01% 🔺)
packages/bundle-size/da-workers-pg/output.tgz 1.38 MB (+0.01% 🔺)
packages/bundle-size/da-workers-planetscale/output.tgz 1.33 MB (+0.01% 🔺)
packages/bundle-size/da-workers-d1/output.tgz 1.3 MB (+0.01% 🔺)

Copy link
Copy Markdown
Contributor

@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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3ac622f7-069c-4275-98a8-8413bd74e06f

📥 Commits

Reviewing files that changed from the base of the PR and between b02b8a4 and a7957d6.

📒 Files selected for processing (4)
  • packages/client-engine-runtime/src/interpreter/render-query.ts
  • packages/client/tests/functional/issues/29309-datetime-cursor/_matrix.ts
  • packages/client/tests/functional/issues/29309-datetime-cursor/prisma/_schema.ts
  • packages/client/tests/functional/issues/29309-datetime-cursor/tests.ts

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 11, 2026
@jacek-prisma jacek-prisma merged commit ea93809 into main Mar 11, 2026
250 of 252 checks passed
@jacek-prisma jacek-prisma deleted the fix/fix-date-cursor branch March 11, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compound cursor with DateTime field returns 0 rows via driver adapter (@prisma/adapter-mariadb)

2 participants