refactor!: rename count-only ORM terminals - #1044
Conversation
|
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 ignored due to path filters (3)
📒 Files selected for processing (28)
🚧 Files skipped from review as they are similar to previous changes (22)
📝 WalkthroughWalkthroughThe ORM count-returning mutation methods were renamed from ChangesORM count terminal rename
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
@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: |
size-limit report 📦
|
bb5739e to
645dd32
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/2-mongo-family/5-query-builders/orm/src/collection.ts (1)
198-212: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove redundant variant comments.
The
blindCastreason strings already explain both no-op returns, so the added prose is avoidable.As per coding guidelines, “Don't add comments if avoidable, prefer code that expresses its intent.”
🤖 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-mongo-family/5-query-builders/orm/src/collection.ts` around lines 198 - 212, Remove the two explanatory comments immediately preceding the blindCast calls in the variant refinement logic, while preserving both no-op return paths and their existing blindCast reason strings.Source: Coding guidelines
🤖 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/test/ports/prisma/functional/methods-createMany/methods-createMany.test.ts`:
- Line 15: Rename the test title in the methods-createMany test from “should
create many records” to “creates many records” or an equivalent concise
description without “should”.
---
Nitpick comments:
In `@packages/2-mongo-family/5-query-builders/orm/src/collection.ts`:
- Around line 198-212: Remove the two explanatory comments immediately preceding
the blindCast calls in the variant refinement logic, while preserving both no-op
return paths and their existing blindCast reason strings.
🪄 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: a54ceee2-2ad5-4d9b-97fe-26dfd54f3238
⛔ Files ignored due to path filters (3)
projects/created-updated-at-authoring/plan.mdis excluded by!projects/**projects/middleware-intercept-and-cache/api-revision-meta-callback.mdis excluded by!projects/**projects/middleware-intercept-and-cache/follow-ups.mdis excluded by!projects/**
📒 Files selected for processing (26)
docs/reference/error-reference.mdexamples/mongo-demo/test/crud-lifecycle.test.tsexamples/supabase/test/real-supabase.acceptance.test.tspackages/2-mongo-family/5-query-builders/orm/src/collection.tspackages/2-mongo-family/5-query-builders/orm/test/collection.test.tspackages/3-extensions/sql-orm-client/src/collection-internal-types.tspackages/3-extensions/sql-orm-client/src/collection.tspackages/3-extensions/sql-orm-client/src/query-plan-mutations.tspackages/3-extensions/sql-orm-client/test/annotations.test.tspackages/3-extensions/sql-orm-client/test/annotations.types.test-d.tspackages/3-extensions/sql-orm-client/test/collection-variant.test.tspackages/3-extensions/sql-orm-client/test/collection.state.test.tspackages/3-extensions/sql-orm-client/test/generated-contract-types.test-d.tspackages/3-extensions/sql-orm-client/test/orm-namespace-crud.test.tspackages/3-extensions/supabase/test/rls-role-binding.integration.test.tsscorecard/06-sql-orm-client.mdscorecard/07-mongodb-query-and-orm.mdskills/prisma-next-queries/mongo.mdskills/prisma-next-supabase/SKILL.mdtest/e2e/framework/test/sqlite/orm.test.tstest/integration/test/namespaced-accessors-e2e.integration.test.tstest/integration/test/ports/prisma/functional/methods-createMany/methods-createMany.test.tstest/integration/test/sql-orm-client/collection-mutation-defaults.test.tstest/integration/test/sql-orm-client/create.test.tstest/integration/test/sql-orm-client/delete.test.tstest/integration/test/sql-orm-client/update.test.ts
Rename createCount, updateCount, and deleteCount to the corresponding AndCount forms across SQL and Mongo ORM APIs and consumers. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
645dd32 to
2765b40
Compare
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
…s, issue regressions (229 accounted) Second porting wave for the port-all-tests project, +229 checklist boxes accounted (488 → 717). Ported & passing: - mongo composites/list + composites/object (withMongoPort): create/createMany/delete/deleteMany/findFirst/findMany/update/upsert - relationMode foreignKeys referential-action matrices: 1-to-1, 1-to-n, m-to-n (Cascade/NoAction/Restrict/SetNull; @Map + nomap), plus 17255 same/mixed-action disconnect - issue regressions: 5952 decimal, 14954 date, 21631 batching-in-tx (Promise.all forms), 29174 jsonb, 13089 dollar-in-search (mongo) Ported & failing (test.fails, faithful gap): - 29267 Uint8Array-in-JSON serialization; required-composite null; implicit default onUpdate (NoAction vs Prisma Cascade) - relation-mode-gh-m-to-n @Map variants: prisma-next rejects the mapped join-table auto-index name (>54-char prefix limit, #1047); Prisma truncates/hashes. Tracked as it.fails that flips green when fixed. Non-portable (recorded per-test in non-ported/): - relationLoadStrategy, relationMode=prisma emulation, implicit embedded mongo m2m, array-batch $transaction([...]), embedded-subfield select / composite where operators / read-side aggregate+count in mongo ORM Built against current main: fixtures emitted with the new indexes[].unique contract shape (#1047); count-only ORM terminals renamed to createAndCount/updateAndCount/deleteAndCount (#1044). Corpus: 69 files, 476 passed | 52 expected-fail, typecheck + lint clean. failing.md matches the test.fails markers; non-ported ledgers mirror functional/<suite>/. All dispositions reviewer-gated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…s, issue regressions (229 accounted) Second porting wave for the port-all-tests project, +229 checklist boxes accounted (488 → 717). Ported & passing: - mongo composites/list + composites/object (withMongoPort): create/createMany/delete/deleteMany/findFirst/findMany/update/upsert - relationMode foreignKeys referential-action matrices: 1-to-1, 1-to-n, m-to-n (Cascade/NoAction/Restrict/SetNull; @Map + nomap), plus 17255 same/mixed-action disconnect - issue regressions: 5952 decimal, 14954 date, 21631 batching-in-tx (Promise.all forms), 29174 jsonb, 13089 dollar-in-search (mongo) Ported & failing (test.fails, faithful gap): - 29267 Uint8Array-in-JSON serialization; required-composite null; implicit default onUpdate (NoAction vs Prisma Cascade) - relation-mode-gh-m-to-n @Map variants: prisma-next rejects the mapped join-table auto-index name (>54-char prefix limit, #1047); Prisma truncates/hashes. Tracked as it.fails that flips green when fixed. Non-portable (recorded per-test in non-ported/): - relationLoadStrategy, relationMode=prisma emulation, implicit embedded mongo m2m, array-batch $transaction([...]), embedded-subfield select / composite where operators / read-side aggregate+count in mongo ORM Built against current main: fixtures emitted with the new indexes[].unique contract shape (#1047); count-only ORM terminals renamed to createAndCount/updateAndCount/deleteAndCount (#1044). Corpus: 69 files, 476 passed | 52 expected-fail, typecheck + lint clean. failing.md matches the test.fails markers; non-ported ledgers mirror functional/<suite>/. All dispositions reviewer-gated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…s, issue regressions (229 accounted) Second porting wave for the port-all-tests project, +229 checklist boxes accounted (488 → 717). Ported & passing: - mongo composites/list + composites/object (withMongoPort): create/createMany/delete/deleteMany/findFirst/findMany/update/upsert - relationMode foreignKeys referential-action matrices: 1-to-1, 1-to-n, m-to-n (Cascade/NoAction/Restrict/SetNull; @Map + nomap), plus 17255 same/mixed-action disconnect - issue regressions: 5952 decimal, 14954 date, 21631 batching-in-tx (Promise.all forms), 29174 jsonb, 13089 dollar-in-search (mongo) Ported & failing (test.fails, faithful gap): - 29267 Uint8Array-in-JSON serialization; required-composite null; implicit default onUpdate (NoAction vs Prisma Cascade) - relation-mode-gh-m-to-n @Map variants: prisma-next rejects the mapped join-table auto-index name (>54-char prefix limit, #1047); Prisma truncates/hashes. Tracked as it.fails that flips green when fixed. Non-portable (recorded per-test in non-ported/): - relationLoadStrategy, relationMode=prisma emulation, implicit embedded mongo m2m, array-batch $transaction([...]), embedded-subfield select / composite where operators / read-side aggregate+count in mongo ORM Built against current main: fixtures emitted with the new indexes[].unique contract shape (#1047); count-only ORM terminals renamed to createAndCount/updateAndCount/deleteAndCount (#1044). Corpus: 69 files, 476 passed | 52 expected-fail, typecheck + lint clean. failing.md matches the test.fails markers; non-ported ledgers mirror functional/<suite>/. All dispositions reviewer-gated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…s, issue regressions (229 accounted) Second porting wave for the port-all-tests project, +229 checklist boxes accounted (488 → 717). Ported & passing: - mongo composites/list + composites/object (withMongoPort): create/createMany/delete/deleteMany/findFirst/findMany/update/upsert - relationMode foreignKeys referential-action matrices: 1-to-1, 1-to-n, m-to-n (Cascade/NoAction/Restrict/SetNull; @Map + nomap), plus 17255 same/mixed-action disconnect - issue regressions: 5952 decimal, 14954 date, 21631 batching-in-tx (Promise.all forms), 29174 jsonb, 13089 dollar-in-search (mongo) Ported & failing (test.fails, faithful gap): - 29267 Uint8Array-in-JSON serialization; required-composite null; implicit default onUpdate (NoAction vs Prisma Cascade) - relation-mode-gh-m-to-n @Map variants: prisma-next rejects the mapped join-table auto-index name (>54-char prefix limit, #1047); Prisma truncates/hashes. Tracked as it.fails that flips green when fixed. Non-portable (recorded per-test in non-ported/): - relationLoadStrategy, relationMode=prisma emulation, implicit embedded mongo m2m, array-batch $transaction([...]), embedded-subfield select / composite where operators / read-side aggregate+count in mongo ORM Built against current main: fixtures emitted with the new indexes[].unique contract shape (#1047); count-only ORM terminals renamed to createAndCount/updateAndCount/deleteAndCount (#1044). Corpus: 69 files, 476 passed | 52 expected-fail, typecheck + lint clean. failing.md matches the test.fails markers; non-ported ledgers mirror functional/<suite>/. All dispositions reviewer-gated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…s, issue regressions (229 accounted) Second porting wave for the port-all-tests project, +229 checklist boxes accounted (488 → 717). Ported & passing: - mongo composites/list + composites/object (withMongoPort): create/createMany/delete/deleteMany/findFirst/findMany/update/upsert - relationMode foreignKeys referential-action matrices: 1-to-1, 1-to-n, m-to-n (Cascade/NoAction/Restrict/SetNull; @Map + nomap), plus 17255 same/mixed-action disconnect - issue regressions: 5952 decimal, 14954 date, 21631 batching-in-tx (Promise.all forms), 29174 jsonb, 13089 dollar-in-search (mongo) Ported & failing (test.fails, faithful gap): - 29267 Uint8Array-in-JSON serialization; required-composite null; implicit default onUpdate (NoAction vs Prisma Cascade) - relation-mode-gh-m-to-n @Map variants: prisma-next rejects the mapped join-table auto-index name (>54-char prefix limit, #1047); Prisma truncates/hashes. Tracked as it.fails that flips green when fixed. Non-portable (recorded per-test in non-ported/): - relationLoadStrategy, relationMode=prisma emulation, implicit embedded mongo m2m, array-batch $transaction([...]), embedded-subfield select / composite where operators / read-side aggregate+count in mongo ORM Built against current main: fixtures emitted with the new indexes[].unique contract shape (#1047); count-only ORM terminals renamed to createAndCount/updateAndCount/deleteAndCount (#1044). Corpus: 69 files, 476 passed | 52 expected-fail, typecheck + lint clean. failing.md matches the test.fails markers; non-ported ledgers mirror functional/<suite>/. All dispositions reviewer-gated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…s, issue regressions (229 accounted) Second porting wave for the port-all-tests project, +229 checklist boxes accounted (488 → 717). Ported & passing: - mongo composites/list + composites/object (withMongoPort): create/createMany/delete/deleteMany/findFirst/findMany/update/upsert - relationMode foreignKeys referential-action matrices: 1-to-1, 1-to-n, m-to-n (Cascade/NoAction/Restrict/SetNull; @Map + nomap), plus 17255 same/mixed-action disconnect - issue regressions: 5952 decimal, 14954 date, 21631 batching-in-tx (Promise.all forms), 29174 jsonb, 13089 dollar-in-search (mongo) Ported & failing (test.fails, faithful gap): - 29267 Uint8Array-in-JSON serialization; required-composite null; implicit default onUpdate (NoAction vs Prisma Cascade) - relation-mode-gh-m-to-n @Map variants: prisma-next rejects the mapped join-table auto-index name (>54-char prefix limit, #1047); Prisma truncates/hashes. Tracked as it.fails that flips green when fixed. Non-portable (recorded per-test in non-ported/): - relationLoadStrategy, relationMode=prisma emulation, implicit embedded mongo m2m, array-batch $transaction([...]), embedded-subfield select / composite where operators / read-side aggregate+count in mongo ORM Built against current main: fixtures emitted with the new indexes[].unique contract shape (#1047); count-only ORM terminals renamed to createAndCount/updateAndCount/deleteAndCount (#1044). Corpus: 69 files, 476 passed | 52 expected-fail, typecheck + lint clean. failing.md matches the test.fails markers; non-ported ledgers mirror functional/<suite>/. All dispositions reviewer-gated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
…s, issue regressions (229 accounted) Second porting wave for the port-all-tests project, +229 checklist boxes accounted (488 → 717). Ported & passing: - mongo composites/list + composites/object (withMongoPort): create/createMany/delete/deleteMany/findFirst/findMany/update/upsert - relationMode foreignKeys referential-action matrices: 1-to-1, 1-to-n, m-to-n (Cascade/NoAction/Restrict/SetNull; @Map + nomap), plus 17255 same/mixed-action disconnect - issue regressions: 5952 decimal, 14954 date, 21631 batching-in-tx (Promise.all forms), 29174 jsonb, 13089 dollar-in-search (mongo) Ported & failing (test.fails, faithful gap): - 29267 Uint8Array-in-JSON serialization; required-composite null; implicit default onUpdate (NoAction vs Prisma Cascade) - relation-mode-gh-m-to-n @Map variants: prisma-next rejects the mapped join-table auto-index name (>54-char prefix limit, #1047); Prisma truncates/hashes. Tracked as it.fails that flips green when fixed. Non-portable (recorded per-test in non-ported/): - relationLoadStrategy, relationMode=prisma emulation, implicit embedded mongo m2m, array-batch $transaction([...]), embedded-subfield select / composite where operators / read-side aggregate+count in mongo ORM Built against current main: fixtures emitted with the new indexes[].unique contract shape (#1047); count-only ORM terminals renamed to createAndCount/updateAndCount/deleteAndCount (#1044). Corpus: 69 files, 476 passed | 52 expected-fail, typecheck + lint clean. failing.md matches the test.fails markers; non-ported ledgers mirror functional/<suite>/. All dispositions reviewer-gated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Serhii Tatarintsev <tatarintsev@prisma.io>
Linked issue
n/a — small change
At a glance
This is the committed Mongo CRUD lifecycle example; before this branch, the same call used
.updateCount(...)and returned the same result.Decision
This PR ships a hard, breaking rename of the count-only ORM mutation terminals across Mongo and SQL:
createCountbecomescreateAndCount,updateCountbecomesupdateAndCount, anddeleteCountbecomesdeleteAndCount. There are no compatibility aliases; parameter and return signatures, guards, execution behavior, and count semantics remain otherwise unchanged.Notes for the reviewer
unknown, and uses narrow command-specificblindCastreasons; this is a required type-safety cleanup, not a separate product feature or runtime behavior change.pnpm test:packages,pnpm test:integration,pnpm test:e2e, and full Supabase package attempts hit PostgreSQLECONNRESET, connection termination, and resource-contention timeouts. Every changed test file passed sequentially in isolation, and no rename-related failure was observed; the broad suites are not claimed as passing.How it fits together
AndCountnames.Promise<number>.Behavior changes & evidence
createAndCount(...). Mongo and SQL still insert the supplied records and return the inserted count. Implemented in the Mongo terminal and SQL terminal; evidenced by the Mongo lifecycle test and SQL integration test.updateAndCount(...). Filter requirements, update/default/annotation behavior, and backend count semantics are unchanged. Implemented in the Mongo terminal and SQL terminal; evidenced by the Mongo lifecycle test and SQL integration test.deleteAndCount(). Filter requirements, deleted records, and backend count semantics are unchanged. Implemented in the Mongo terminal and SQL terminal; evidenced by the Mongo lifecycle test and SQL integration test.updateAndCountanddeleteAndCountstill require.where(...), and all three terminals retainPromise<number>results and write-annotation typing. See the generated contract type tests and annotation type tests.Compatibility / migration / risk
createCountwithcreateAndCount,updateCountwithupdateAndCount, anddeleteCountwithdeleteAndCountin Mongo and SQL ORM consumers.Testing performed
pnpm install --frozen-lockfilepassed and changed no tracked files.pnpm buildpassed with 68 tasks in the earlier run.pnpm typecheckpassed 143/143 tasks.DATABASE_URLandSUPABASE_JWT_SECRETwere unavailable.pnpm check:upgrade-coverage,pnpm lint:skills,pnpm check:error-reference, affected package builds/typechecks/lints, andgit diff --checkpassed.pnpm test:packages,pnpm test:integration,pnpm test:e2e, and full Supabase package runs hit PostgreSQLECONNRESET, connection termination, or resource-contention timeouts. Every changed test file passed in isolation and no rename-related failure was observed; these broad suites are not reported as passing.Skill update
createAndCount,updateAndCount, anddeleteAndCount.updateAndCountin the RLS write example.0.16 → 0.17migration entries to the user upgrade skill and the extension-author upgrade skill.Alternatives considered
Checklist
git commit -s) per the DCO; the committed branch contains a matchingSigned-off-by:trailer.TML-NNNN: <sentence-case title>form — intentionally unchecked because there is no Linear ticket and the operator selected the repository's Conventional Commits convention instead.Summary by CodeRabbit
New Features
createAndCount(),updateAndCount(), anddeleteAndCount().Documentation
Tests