Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

Add test cases for JSON null values and fix validator/dialect handling#465

Closed
Copilot wants to merge 2 commits intofeat/json-nulls-filterfrom
copilot/sub-pr-464
Closed

Add test cases for JSON null values and fix validator/dialect handling#465
Copilot wants to merge 2 commits intofeat/json-nulls-filterfrom
copilot/sub-pr-464

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 4, 2025

The test suite didn't cover JSON objects or arrays containing null values as elements (e.g., { key: null } or [1, null, 3]). Adding these tests revealed bugs in both the validator and SQLite dialect.

Changes

  • Test cases: Added works with JSON objects containing null values and works with JSON arrays containing null values tests covering creation, equality filters, and not filters

  • Validator fix (validator/index.ts): makeJsonValueSchema now allows null elements in JSON arrays, matching the JsonArray type definition

    // Before: didn't allow null in array elements
    z.lazy(() => this.makeJsonValueSchema(false, false).array())
    
    // After: allows null elements like object values do
    z.lazy(() => z.union([this.makeJsonValueSchema(false, false), z.null()]).array())
  • SQLite dialect fix (dialects/sqlite.ts): transformPrimitive now handles JSON type before the array check, ensuring JSON values are serialized as a whole rather than element-by-element (which would cause SQLite binding errors for arrays with null elements)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 4, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

@ymc9
Copy link
Copy Markdown
Member

ymc9 commented Dec 4, 2025

@copilot where're your changes?

… validator/dialect

Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 4, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint.prisma.io
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/zenstack-v3/zenstack-v3/node_modules/.pnpm/prisma@6.19.0_magicast@0.3.5_typescript@5.9.3/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;6.19.0&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2025-12-04T10:54:30Z&#34;,&#34;project_hash&#34;:&#34;302ae6b3&#34;,&#34;cli_path&#34;:&#34;/tmp/tmp-5741-NwbV6Sd0WbHr/node_modules/prisma/build/index.js&#34;,&#34;cli_path_hash&#34;:&#34;410c208a&#34;,&#34;en sh (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/zenstack-v3/zenstack-v3/node_modules/.pnpm/prisma@6.19.0_magicast@0.3.5_typescript@5.9.3/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;6.19.0&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2025-12-04T10:54:33Z&#34;,&#34;project_hash&#34;:&#34;09e8a64b&#34;,&#34;cli_path&#34;:&#34;/tmp/tmp-5741-uLAvJyFLUg61/node_modules/prisma/build/index.js&#34;,&#34;cli_path_hash&#34;:&#34;4404d1c1&#34;,&#34;en node k/ze�� ts son-filter.test.ts h --verify feat/json-nulls--c tools/pnpm/10.23tsc uname px ilter.test.ts git node tsup-node origin tnet/tools/sh node (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/zenstack-v3/zenstack-v3/node_modules/.pnpm/prisma@6.19.0_magicast@0.3.5_typescript@5.9.3/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;6.19.0&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2025-12-04T10:54:36Z&#34;,&#34;project_hash&#34;:&#34;f23ce6a7&#34;,&#34;cli_path&#34;:&#34;/tmp/tmp-5741-1TK3jRpo6hlA/node_modules/prisma/build/index.js&#34;,&#34;cli_path_hash&#34;:&#34;dbcc54c7&#34;,&#34;en node ites�� lient-api/json-filter.test.ts ts de --noprofile (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update implementation of JSON null values and equality filter Add test cases for JSON null values and fix validator/dialect handling Dec 4, 2025
Copilot AI requested a review from ymc9 December 4, 2025 11:00
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 4, 2025

@copilot where're your changes?

The changes are in commit ba45db2. Here's what was changed:

  1. Test cases (tests/e2e/orm/client-api/json-filter.test.ts): Added two new tests:

    • works with JSON objects containing null values
    • works with JSON arrays containing null values
  2. Validator fix (packages/orm/src/client/crud/validator/index.ts): Updated makeJsonValueSchema to allow null elements in JSON arrays

  3. SQLite dialect fix (packages/orm/src/client/crud/dialects/sqlite.ts): Moved JSON type handling before the array check to ensure proper serialization

@ymc9 ymc9 closed this Dec 4, 2025
@ymc9 ymc9 deleted the copilot/sub-pr-464 branch January 25, 2026 13:11
@ymc9 ymc9 restored the copilot/sub-pr-464 branch January 25, 2026 13:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants