Skip to content

Conversation

@ymc9
Copy link
Member

@ymc9 ymc9 commented Oct 22, 2025

Summary by CodeRabbit

  • New Features

    • CRUD operations (create, update, delete, and their bulk variants) now support specifying which fields to return, providing finer control over response payloads.
  • Chores

    • Version bumped to 3.0.0-beta.12 across all packages.

Copilot AI review requested due to automatic review settings October 22, 2025 19:53
@coderabbitai
Copy link

coderabbitai bot commented Oct 22, 2025

Walkthrough

This pull request bumps the package version from 3.0.0-beta.11 to 3.0.0-beta.12 across multiple packages in the monorepo. It also enhances CRUD operations with configurable return fields for mutations and adjusts the transaction isolation level for query execution from RepeatableRead to ReadCommitted.

Changes

Cohort / File(s) Summary
Package version bumps
package.json, packages/*/package.json, samples/blog/package.json, tests/*/package.json
Version updated from 3.0.0-beta.11 to 3.0.0-beta.12 across 18 package.json files in the monorepo (root, cli, common-helpers, eslint-config, typescript-config, vitest-config, create-zenstack, dialects/sql.js, language, plugins/policy, runtime, sdk, tanstack-query, testtools, zod, samples/blog, e2e, and regression).
CRUD operation base logic
packages/runtime/src/client/crud/operations/base.ts
Added optional return-fields parameters (returnFields, fieldsToReturn) to create, update, delete, createMany, and updateMany methods; introduced mutationNeedsReadBack helper to determine if mutations require data re-fetching; updated delete return type to Promise<QueryResult<unknown>>; imported QueryResult from kysely.
Create operation handler
packages/runtime/src/client/crud/operations/create.ts
Implemented conditional read-back logic for single and bulk create operations using mutationNeedsReadBack to determine whether to fetch created records or return raw result; passes selectedFields to base create/createMany calls.
Update operation handler
packages/runtime/src/client/crud/operations/update.ts
Refactored update, updateMany, and upsert operations to use centralized needReadBack helper; conditionally reads back updated entities based on field selection; added private needReadBack(args) helper method; adjusted policy error handling for read-back scenarios.
Delete operation handler
packages/runtime/src/client/crud/operations/delete.ts
Added conditional read-back logic within transactions; changed return format from boolean-based to object with count property; wrapped delete in conditional transaction returning pre-delete or post-delete record based on needReadBack.
Transaction isolation level
packages/runtime/src/client/executor/zenstack-query-executor.ts
Changed default transaction isolation level from RepeatableRead to ReadCommitted for mutations.
Test file reorganization
tests/e2e/orm/client-api/create.test.ts, tests/e2e/orm/client-api/create-many-and-return.test.ts
Reorganized import statements; no functional changes to test logic.
Test logic adjustments
tests/e2e/orm/client-api/update-many.test.ts
Wrapped updateManyAndReturn result in assertion; renamed result variable from r to r1; adjusted subsequent references.
Upsert test refactor
tests/e2e/orm/client-api/upsert.test.ts
Changed result shaping from include to select to return only id and name; reordered imports; adjusted assertions to verify field presence/absence.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

The PR contains a large cohort of repetitive, trivial version bumps across 18 package.json files (requiring minimal review), but is offset by moderate-complexity CRUD operation changes affecting multiple files with new conditional logic, helper methods, and transaction handling adjustments. The heterogeneous nature of changes—combining homogeneous version updates with dense logic modifications in base, create, update, and delete handlers—warrants a moderate complexity assessment.

Possibly related PRs

Poem

🐰 Version bumped to beta.twelve,
With fields now chosen, records compelled,
Mutations read back when they must,
Less locking, more logic, more trust,
The test files hop, the code stands tall—
A tidy release for one and all!

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive The title "merge dev to main (v3.0.0-beta.12)" uses a procedural merge commit format that references the version bump but does not clearly describe the primary functional changes in the PR. The changeset includes significant refactoring to CRUD operations (create, update, delete) with new optional returnFields/fieldsToReturn parameters, refactored read-back logic, and a transaction isolation level change. While the title is partially related to the changeset (it references the version bump that appears across many files), it does not convey the main point of the changes—the refactoring of mutation operations. A teammate scanning the pull request history would not understand from this title alone that substantial API-level and behavioral changes are being introduced. Consider updating the title to be more descriptive of the primary changes, such as "Refactor CRUD operations with configurable field selection" or "Add optional return field parameters to mutation operations (v3.0.0-beta.12)". This would make the main intent and scope of the PR immediately clear to reviewers and future maintainers scanning the commit history.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

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.

@claude
Copy link

claude bot commented Oct 22, 2025

Claude finished @ymc9's task —— View job


Code Review Analysis

Reviewing PR #327 (dev -> main) for v3.0.0-beta.12 release. Analyzed changes across 27 files focusing on code quality, performance, security, and testing.

Todo List

  • Review core runtime CRUD operation changes
  • Analyze transaction consistency improvements
  • Check version bump consistency across packages
  • Review test coverage and updates
  • Identify potential bugs, performance issues, and security concerns
  • Provide comprehensive feedback

🔍 Code Review Summary

Strengths

🚀 Performance Improvements

  • Smart Read-Back Optimization: The new mutationNeedsReadBack() logic (base.ts:2144-2194) intelligently determines when to avoid unnecessary post-mutation reads
  • Efficient Field Selection: Returns only required fields when SQL RETURNING clause is sufficient
  • Transaction Isolation Optimization: Changed to ReadCommitted level for better performance (zenstack-query-executor.ts:93)

🧹 Code Quality

  • Consistent Version Management: All 18 packages correctly bumped to 3.0.0-beta.12 (VSCode extension intentionally different at 3.0.11)
  • Proper Error Handling: Enhanced error handling in operation handlers with specific policy violation messages
  • Type Safety: Strong TypeScript usage throughout with proper generic constraints

✅ Test Coverage

  • Tests updated to reflect new behavior in create-many-and-return.test.ts, create.test.ts, update-many.test.ts, and upsert.test.ts

⚠️ Areas for Improvement

🔒 Security Considerations

  • Transaction Isolation Downgrade: While performance-focused, the change to ReadCommitted isolation could theoretically allow phantom reads in high-concurrency scenarios. Consider documenting this trade-off.

🐛 Potential Issues

  • TODO Comments: Several production TODOs need attention:
    • create.ts:30: "avoid using transaction for simple create"
    • update.ts:80: "avoid using transaction for simple update"
    • delete.ts:24: "avoid using transaction for simple delete"
    • base.ts:2146: "refactor this check" for policy enforcement

🔧 Code Improvements

  • Type Assertions: Some as any casts in update-many operations (update.ts:111) could be replaced with proper typing
  • Magic Numbers: take: 1 could be extracted to a named constant for clarity

📊 Performance Impact

Positive:

  • Reduced unnecessary database round-trips for simple mutations
  • Lower transaction isolation level improves throughput
  • Smart field selection reduces data transfer

Considerations:

  • The read-back optimization will significantly benefit high-volume applications with simple CRUD operations
  • Memory usage should decrease due to reduced data fetching

🧪 Test Quality

Good:

  • E2E tests properly validate the new behavior
  • Update operations correctly test both successful and edge cases

Could Improve:

  • Consider adding specific tests for the new read-back optimization logic
  • Transaction isolation level changes could benefit from concurrent operation tests

🎯 Recommendations

  1. Document Performance Changes: Add release notes explaining the transaction isolation change and its implications
  2. Address TODOs: Plan to resolve the transaction optimization TODOs in upcoming releases
  3. Consider Feature Flag: The read-back optimization could be configurable for users who prefer consistency over performance
  4. Add Benchmarks: Consider adding performance benchmarks to quantify the improvements

Overall Assessment

This is a solid beta release that makes meaningful performance improvements while maintaining backward compatibility. The code quality is high, version management is consistent, and the changes are well-tested. The performance optimizations are thoughtful and will benefit production workloads.

Recommendation: ✅ Approve for merge

The changes align well with the v3.0.0-beta.12 release goals and the performance improvements will provide tangible benefits to users.


Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR merges the dev branch to main for release v3.0.0-beta.12. The changes include version bumps across all packages and significant optimizations to database operations by leveraging SQL RETURNING clauses to avoid unnecessary read-back queries when possible.

  • Version bump from 3.0.0-beta.11 to 3.0.0-beta.12 across all packages
  • Transaction isolation level changed from RepeatableRead to ReadCommitted
  • CRUD operations optimized to use SQL RETURNING instead of separate read queries when appropriate

Reviewed Changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
package.json Root package version bump
packages/cli/package.json CLI package version bump
packages/common-helpers/package.json Common helpers package version bump
packages/config/eslint-config/package.json ESLint config package version bump
packages/config/typescript-config/package.json TypeScript config package version bump
packages/config/vitest-config/package.json Vitest config package version bump
packages/create-zenstack/package.json Create-zenstack package version bump
packages/dialects/sql.js/package.json SQL.js dialect package version bump
packages/language/package.json Language package version bump
packages/plugins/policy/package.json Policy plugin package version bump
packages/runtime/package.json Runtime package version bump
packages/runtime/src/client/crud/operations/base.ts Core CRUD optimization logic with mutationNeedsReadBack helper and returning clause support
packages/runtime/src/client/crud/operations/create.ts Create operations updated to use RETURNING optimization
packages/runtime/src/client/crud/operations/delete.ts Delete operations refactored to use RETURNING and avoid pre-delete reads
packages/runtime/src/client/crud/operations/update.ts Update operations optimized with needReadBack analysis and RETURNING support
packages/runtime/src/client/executor/zenstack-query-executor.ts Transaction isolation level changed to ReadCommitted
packages/sdk/package.json SDK package version bump
packages/tanstack-query/package.json TanStack Query package version bump
packages/testtools/package.json Test tools package version bump
packages/zod/package.json Zod package version bump
samples/blog/package.json Blog sample version bump
tests/e2e/orm/client-api/create-many-and-return.test.ts Import order reorganization
tests/e2e/orm/client-api/create.test.ts Import order reorganization
tests/e2e/orm/client-api/update-many.test.ts Test updated to verify select behavior and import order reorganization
tests/e2e/orm/client-api/upsert.test.ts Test updated to verify select/omit behavior and import order reorganization
tests/e2e/package.json E2E tests package version bump
tests/regression/package.json Regression tests package version bump

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

@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: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/runtime/src/client/crud/operations/update.ts (1)

133-147: Ensure IDs are returned for upsert read-back

Creation path uses selectedFields; if it omits IDs, getIdValues cannot build a unique filter.

-        const { needReadBack, selectedFields } = this.needReadBack(args);
+        const { needReadBack, selectedFields } = this.needReadBack(args);
+        const selectedForMutation =
+            needReadBack ? this.ensureIdsSelected(this.model, selectedFields) : selectedFields;
@@
-            let mutationResult: unknown = await this.update(
+            let mutationResult: unknown = await this.update(
                 tx,
                 this.model,
                 args.where,
                 args.update,
                 undefined,
                 true,
                 false,
-                selectedFields,
+                selectedForMutation,
             );
@@
-                mutationResult = await this.create(tx, this.model, args.create, undefined, undefined, selectedFields);
+                mutationResult = await this.create(
+                    tx,
+                    this.model,
+                    args.create,
+                    undefined,
+                    undefined,
+                    selectedForMutation
+                );

Also applies to: 149-167

packages/runtime/src/client/crud/operations/base.ts (1)

2067-2067: I need to investigate further to determine if this is actually a breaking change and whether tests exist for transaction isolation behavior.

Now let me search the codebase for tests related to transaction isolation and concurrency:

Based on my verification, I've found critical information that confirms the review comment's concerns. ZenStack's documentation explicitly states that "the database's transaction isolation level should be set to at least Repeatable Read" to ensure access policies are properly enforced.

The code change at line 2086 sets the default to ReadCommitted when no isolation level is specified. This creates a breaking change:

  1. MySQL InnoDB's default is REPEATABLE READ, while PostgreSQL's default is Read Committed, meaning the new default creates dialect-specific behavior differences.

  2. More critically, to ensure access policies are properly enforced, the isolation level should be at least Repeatable Read, which can be done via the isolationLevel option when creating PrismaClient.

Cross-dialect isolation level default changed to ReadCommitted — violates access policy enforcement requirements

ZenStack's access policies require at least Repeatable Read isolation to function correctly. Setting ReadCommitted as the default bypasses this requirement and could leave policies unenforced, especially for MySQL users accustomed to REPEATABLE READ. Verify that:

  • All policy-enforcement tests pass under ReadCommitted isolation
  • Documentation is updated if this represents an intentional policy change
  • Developers explicitly override to RepeatableRead where policies are active
🧹 Nitpick comments (5)
packages/runtime/src/client/crud/operations/create.ts (1)

84-87: Avoid as any in OR filter

Define a WhereUnique type or reuse an existing one so OR: createResult.map(getIdValues(...)) is properly typed.

tests/e2e/orm/client-api/upsert.test.ts (1)

38-47: LGTM: upsert result shaping via select is correct

Assertions reflect narrowed payload and final full read-back. Consider a negative test to ensure select and include are not accepted together.

Also applies to: 52-53, 69-69

packages/runtime/src/client/crud/operations/delete.ts (1)

25-41: Add documentation clarifying policy-blocked read-back behavior

The transaction executes delete, then attempts to read back the result. If policy blocks the read, the record remains deleted and error is thrown post-transaction. This pattern mirrors update.ts (line ~63), which includes an inline comment explaining this edge case. Add similar documentation to delete.ts (around lines 42–47) to clarify this is intentional: "delete succeeded but result cannot be read back due to policy".

packages/runtime/src/client/crud/operations/update.ts (1)

181-206: Consider centralizing ID-selection pattern into BaseOperationHandler

Both create.ts and update.ts duplicate the pattern of mapping getIdValues() across result arrays in their *ManyAndReturn methods. Moving this into a reusable helper on BaseOperationHandler would reduce duplication and prevent future regressions across operations.

packages/runtime/src/client/crud/operations/base.ts (1)

246-253: Unify parameter naming: returnFields vs fieldsToReturn

Use a single name across CRUD methods (prefer fieldsToReturn) for consistency and easier API comprehension.

Also applies to: 669-670, 908-909, 1214-1215, 1945-1947

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e120f2 and 68e0072.

📒 Files selected for processing (27)
  • package.json (1 hunks)
  • packages/cli/package.json (1 hunks)
  • packages/common-helpers/package.json (1 hunks)
  • packages/config/eslint-config/package.json (1 hunks)
  • packages/config/typescript-config/package.json (1 hunks)
  • packages/config/vitest-config/package.json (1 hunks)
  • packages/create-zenstack/package.json (1 hunks)
  • packages/dialects/sql.js/package.json (1 hunks)
  • packages/language/package.json (1 hunks)
  • packages/plugins/policy/package.json (1 hunks)
  • packages/runtime/package.json (1 hunks)
  • packages/runtime/src/client/crud/operations/base.ts (16 hunks)
  • packages/runtime/src/client/crud/operations/create.ts (2 hunks)
  • packages/runtime/src/client/crud/operations/delete.ts (1 hunks)
  • packages/runtime/src/client/crud/operations/update.ts (6 hunks)
  • packages/runtime/src/client/executor/zenstack-query-executor.ts (1 hunks)
  • packages/sdk/package.json (1 hunks)
  • packages/tanstack-query/package.json (1 hunks)
  • packages/testtools/package.json (1 hunks)
  • packages/zod/package.json (1 hunks)
  • samples/blog/package.json (1 hunks)
  • tests/e2e/orm/client-api/create-many-and-return.test.ts (1 hunks)
  • tests/e2e/orm/client-api/create.test.ts (1 hunks)
  • tests/e2e/orm/client-api/update-many.test.ts (2 hunks)
  • tests/e2e/orm/client-api/upsert.test.ts (3 hunks)
  • tests/e2e/package.json (1 hunks)
  • tests/regression/package.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
{packages,samples,tests}/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place packages only under packages/, samples/, or tests/

Files:

  • packages/dialects/sql.js/package.json
  • packages/config/vitest-config/package.json
  • packages/zod/package.json
  • packages/language/package.json
  • packages/runtime/src/client/executor/zenstack-query-executor.ts
  • tests/e2e/orm/client-api/create.test.ts
  • tests/e2e/orm/client-api/create-many-and-return.test.ts
  • samples/blog/package.json
  • packages/common-helpers/package.json
  • tests/regression/package.json
  • packages/plugins/policy/package.json
  • packages/create-zenstack/package.json
  • packages/testtools/package.json
  • tests/e2e/orm/client-api/update-many.test.ts
  • tests/e2e/package.json
  • packages/runtime/src/client/crud/operations/update.ts
  • packages/cli/package.json
  • packages/config/eslint-config/package.json
  • packages/runtime/src/client/crud/operations/create.ts
  • packages/runtime/src/client/crud/operations/delete.ts
  • packages/config/typescript-config/package.json
  • packages/runtime/package.json
  • packages/tanstack-query/package.json
  • packages/runtime/src/client/crud/operations/base.ts
  • packages/sdk/package.json
  • tests/e2e/orm/client-api/upsert.test.ts
tests/e2e/**

📄 CodeRabbit inference engine (CLAUDE.md)

End-to-end tests must live under tests/e2e/

Files:

  • tests/e2e/orm/client-api/create.test.ts
  • tests/e2e/orm/client-api/create-many-and-return.test.ts
  • tests/e2e/orm/client-api/update-many.test.ts
  • tests/e2e/package.json
  • tests/e2e/orm/client-api/upsert.test.ts
package.json

📄 CodeRabbit inference engine (CLAUDE.md)

Pin the repository package manager to pnpm@10.12.1 via the packageManager field

Files:

  • package.json
🧬 Code graph analysis (4)
packages/runtime/src/client/crud/operations/update.ts (3)
packages/runtime/src/client/crud-types.ts (1)
  • WhereInput (207-243)
packages/sdk/src/schema/schema.ts (1)
  • GetModels (109-109)
packages/runtime/src/client/query-utils.ts (1)
  • getIdValues (173-179)
packages/runtime/src/client/crud/operations/create.ts (3)
packages/runtime/src/client/crud/operations/update.ts (1)
  • needReadBack (181-206)
packages/runtime/src/client/query-utils.ts (1)
  • getIdValues (173-179)
packages/runtime/src/client/crud-types.ts (1)
  • WhereInput (207-243)
packages/runtime/src/client/crud/operations/delete.ts (3)
packages/runtime/src/client/crud/operations/update.ts (1)
  • needReadBack (181-206)
packages/runtime/src/client/errors.ts (2)
  • NotFoundError (32-36)
  • RejectedByPolicyError (61-69)
packages/runtime/src/client/crud-types.ts (1)
  • DeleteManyArgs (968-971)
packages/runtime/src/client/crud/operations/base.ts (1)
packages/runtime/src/client/query-utils.ts (1)
  • requireIdFields (70-77)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build-test (20.x, sqlite)
  • GitHub Check: build-test (20.x, postgresql)
  • GitHub Check: claude-review
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (27)
tests/e2e/orm/client-api/create-many-and-return.test.ts (1)

3-4: LGTM! Import reordering improves code organization.

The import statements have been reordered to group vitest imports together and separate external dependencies from local imports, following common conventions. This is a minor readability improvement with no functional impact.

tests/e2e/orm/client-api/update-many.test.ts (2)

3-4: LGTM: Import additions are correct.

The afterEach import and schema import are properly added and utilized in the test file.


90-105: LGTM: Improved async test pattern.

The refactoring to use expect(...).resolves.toMatchObject for the first assertion is a better practice for async testing, making the test more idiomatic and readable. The variable rename to r1 maintains clarity, and the test properly validates both full and selective field returns with the updateManyAndReturn operation.

packages/tanstack-query/package.json (1)

3-3: Version bump looks good.

The version increment from 3.0.0-beta.11 to 3.0.0-beta.12 aligns with the PR objectives for this release.

tests/e2e/package.json (1)

3-3: Version bump looks good.

The version increment aligns with the PR objectives for this release.

packages/plugins/policy/package.json (1)

3-3: Version bump looks good.

The version increment aligns with the PR objectives for this release.

tests/regression/package.json (1)

3-3: Version bump looks good.

The version increment aligns with the PR objectives for this release.

packages/runtime/package.json (1)

3-3: Version bump looks good.

The version increment aligns with the PR objectives for this release.

packages/sdk/package.json (1)

3-3: Version bump looks good.

The version increment aligns with the PR objectives for this release.

package.json (1)

3-3: Version bump looks good.

The version increment aligns with the PR objectives for this release. The packageManager field correctly pins to pnpm@10.12.1 as per coding guidelines.

packages/runtime/src/client/executor/zenstack-query-executor.ts (1)

92-94: Verified: This is an intentional performance optimization.

The change from RepeatableRead to ReadCommitted was made in commit 68e0072 (Oct 22, 2025) with the explicit message "fix: use a weaker tx consistency level for better perf (#326)". This aligns with the pre-existing default in base.ts (line 2086), which already used ReadCommitted.

The mutation patterns in the codebase (single-record create/update/delete operations) do not require RepeatableRead guarantees, and hooks that load entities do so within the same transaction context. Existing tests validate that mutations and entity hooks continue to work correctly with this isolation level.

packages/config/vitest-config/package.json (1)

4-4: Version bump to 3.0.0-beta.12 approved.

Straightforward metadata update aligned with the PR's coordinated version bump across the monorepo.

packages/zod/package.json (1)

3-3: Version bump to 3.0.0-beta.12 approved.

Straightforward metadata update aligned with the coordinated version bump across the monorepo.

packages/create-zenstack/package.json (1)

3-3: Version bump to 3.0.0-beta.12 approved.

Straightforward metadata update aligned with the coordinated version bump across the monorepo.

packages/cli/package.json (1)

6-6: Version bump to 3.0.0-beta.12 approved.

Straightforward metadata update aligned with the coordinated version bump across the monorepo.

packages/language/package.json (1)

4-4: Version bump to 3.0.0-beta.12 approved.

Straightforward metadata update aligned with the coordinated version bump across the monorepo.

packages/testtools/package.json (1)

3-3: Version bump to 3.0.0-beta.12 approved.

Straightforward metadata update aligned with the coordinated version bump across the monorepo.

samples/blog/package.json (1)

3-3: Version bump to 3.0.0-beta.12 approved.

Straightforward metadata update aligned with the coordinated version bump across the monorepo.

packages/config/eslint-config/package.json (1)

3-3: Version bump to 3.0.0-beta.12 approved.

Straightforward metadata update aligned with the coordinated version bump across the monorepo.

packages/config/typescript-config/package.json (1)

3-3: Version bump approved.

The version update is consistent with the broader package-wide release to 3.0.0-beta.12.

packages/common-helpers/package.json (1)

3-3: Version bump approved.

The version update is consistent with the broader package-wide release to 3.0.0-beta.12. Workspace dependencies using workspace:* will automatically resolve to the updated versions.

packages/dialects/sql.js/package.json (1)

3-3: Version bump approved.

The version update is consistent with the broader package-wide release to 3.0.0-beta.12. External and workspace dependency references remain valid.

tests/e2e/orm/client-api/create.test.ts (1)

3-4: LGTM: import reordering is fine

No behavior change; consistent with test style elsewhere.

packages/runtime/src/client/crud/operations/delete.ts (1)

56-56: LGTM: deleteMany returns { count }

Matches the public API expectation.

packages/runtime/src/client/crud/operations/create.ts (1)

27-33: mutationNeedsReadBack does NOT guarantee ID inclusion—the concern is valid

The mutationNeedsReadBack method returns selectedFields that can omit ID fields when explicit args.select is provided. In base.ts line 346, the requireIdFields fallback only applies if returnFields is falsy, so passing a non-ID-including selectedFields directly bypasses that safety guard.

When a user explicitly selects fields without including IDs (e.g., select: { name: true }), allFieldsSelected will exclude IDs. This gets passed to create() and returned without IDs, potentially breaking transactions that need ID values for subsequent operations.

The fix ensuring ID inclusion is necessary.

packages/runtime/src/client/crud/operations/base.ts (2)

10-10: Import LGTM

Adding QueryResult is appropriate for the new delete return shape.


344-347: Returning selected scalar fields: approach looks good

Defaults to id fields when unspecified; aligns with read-back optimization.

Please confirm callers validate fieldsToReturn against actual scalar fields of the model to avoid runtime SQL errors.

Also applies to: 352-352, 772-774, 1054-1060, 1303-1305

@ymc9 ymc9 added this pull request to the merge queue Oct 22, 2025
Merged via the queue into main with commit ba3bbe8 Oct 22, 2025
16 checks passed
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.

2 participants