Skip to content

merge dev to main (v2.16.1) #2174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 7, 2025
Merged

merge dev to main (v2.16.1) #2174

merged 7 commits into from
Jul 7, 2025

Conversation

ymc9
Copy link
Member

@ymc9 ymc9 commented Jul 7, 2025

No description provided.

Copy link
Contributor

coderabbitai bot commented Jul 7, 2025

📝 Walkthrough

Walkthrough

This update introduces several enhancements and refactorings across the codebase. It replaces the external traverse library with a new local simpleTraverse utility for object traversal, improves handling and sharing of JSON type definitions in Prisma client code generation, adds WSL environment detection to telemetry, updates the JetBrains IDE package changelog and version, and adds a regression test for JSON-typed Prisma fields.

Changes

Files/Paths Change Summary
packages/ide/jetbrains/CHANGELOG.md, build.gradle.kts Changelog updated to formalize a release note and add a fix; version bumped from 2.15.0 to 2.16.1.
packages/runtime/src/enhancements/node/delegate.ts, policy/policy-utils.ts Replaced traverse with local simpleTraverse utility; updated traversal logic and method signatures; renamed and refactored field-level guard aggregation method.
packages/runtime/src/local-helpers/index.ts, simple-traverse.ts Added and exported new simpleTraverse utility for recursive object traversal.
packages/schema/src/plugins/enhancer/enhance/index.ts Improved Prisma client type generation: centralized JSON type definitions, adjusted import paths, and changed extra type generation to synchronous.
packages/schema/src/telemetry.ts, utils/is-wsl.ts Added WSL environment detection utility and included WSL info in telemetry payload.
tests/regression/tests/issue-2168.test.ts Added regression test for handling of JSON-typed Prisma model fields.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Regression Test
    participant SchemaGen as Schema Generator
    participant ClientGen as Prisma Client Generator
    participant Main as main.ts

    Test->>SchemaGen: Load schema with JSON-typed field
    SchemaGen->>ClientGen: Generate Prisma client and models
    ClientGen->>Main: Export Profile type and models
    Main->>Main: Import Profile type
    Main->>Main: Create Profile object and log to console
Loading
sequenceDiagram
    participant PolicyUtil
    participant simpleTraverse

    PolicyUtil->>simpleTraverse: Traverse object for guard aggregation
    simpleTraverse-->>PolicyUtil: Invoke callback per node
    PolicyUtil->>PolicyUtil: Aggregate/merge field-level guards
Loading

Possibly related PRs

  • zenstackhq/zenstack#2172: Adds the isWsl detection utility and corresponding property to the Telemetry class, directly related to the new WSL detection logic.
  • zenstackhq/zenstack#2160: Refactors traversal logic by replacing the external traverse library with the local simpleTraverse utility, mirroring the main changes here.
  • zenstackhq/zenstack#2167: Renames and refactors the getFieldReadGuards method to getCombinedFieldOverrideReadGuards in the PolicyUtil class, directly matching the method changes in this update.

Warning

Review ran into problems

🔥 Problems

Check-run timed out after 90 seconds. Some checks/pipelines were still in progress when the timeout was reached. Consider increasing the reviews.tools.github-checks.timeout_ms value in your CodeRabbit configuration to allow more time for checks to complete.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
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: 0

🧹 Nitpick comments (2)
packages/ide/jetbrains/CHANGELOG.md (1)

5-7: Consider improving grammar for clarity.

The changelog structure is well-organized, but consider adding the article "the" for better readability.

-   Prefer to use "stdlib.zmodel" from user's node_modules folder.
+   Prefer to use "stdlib.zmodel" from the user's node_modules folder.
packages/runtime/src/local-helpers/simple-traverse.ts (1)

14-19: Consider using a Set for circular reference detection.

The current implementation uses Array.some() for circular detection which has O(n) complexity. For deeply nested structures, this could become a performance bottleneck.

-    const parents: any[] = [];
+    const parents = new Set<any>();

     function walker(node: any) {
         const isObject = typeof node === 'object' && node !== null;
-        const isCircular = isObject && parents.some((p) => p === node);
+        const isCircular = isObject && parents.has(node);

And update the usage:

-            parents.push(node);
+            parents.add(node);
-            parents.pop();
+            parents.delete(node);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9596d33 and 85938b3.

⛔ Files ignored due to path filters (15)
  • package.json is excluded by !**/*.json
  • packages/ide/jetbrains/.idea/gradle.xml is excluded by !**/*.xml
  • packages/ide/jetbrains/package.json is excluded by !**/*.json
  • packages/language/package.json is excluded by !**/*.json
  • packages/misc/redwood/package.json is excluded by !**/*.json
  • packages/plugins/openapi/package.json is excluded by !**/*.json
  • packages/plugins/swr/package.json is excluded by !**/*.json
  • packages/plugins/tanstack-query/package.json is excluded by !**/*.json
  • packages/plugins/trpc/package.json is excluded by !**/*.json
  • packages/runtime/package.json is excluded by !**/*.json
  • packages/schema/package.json is excluded by !**/*.json
  • packages/sdk/package.json is excluded by !**/*.json
  • packages/server/package.json is excluded by !**/*.json
  • packages/testtools/package.json is excluded by !**/*.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !**/*.yaml
📒 Files selected for processing (10)
  • packages/ide/jetbrains/CHANGELOG.md (1 hunks)
  • packages/ide/jetbrains/build.gradle.kts (1 hunks)
  • packages/runtime/src/enhancements/node/delegate.ts (2 hunks)
  • packages/runtime/src/enhancements/node/policy/policy-utils.ts (5 hunks)
  • packages/runtime/src/local-helpers/index.ts (1 hunks)
  • packages/runtime/src/local-helpers/simple-traverse.ts (1 hunks)
  • packages/schema/src/plugins/enhancer/enhance/index.ts (5 hunks)
  • packages/schema/src/telemetry.ts (3 hunks)
  • packages/schema/src/utils/is-wsl.ts (1 hunks)
  • tests/regression/tests/issue-2168.test.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
packages/runtime/src/enhancements/node/delegate.ts (3)
packages/runtime/src/local-helpers/simple-traverse.ts (1)
  • simpleTraverse (12-61)
packages/runtime/src/constants.ts (1)
  • DELEGATE_AUX_RELATION_PREFIX (69-69)
packages/runtime/src/enhancements/node/utils.ts (1)
  • prismaClientValidationError (14-16)
packages/schema/src/telemetry.ts (1)
packages/schema/src/utils/is-wsl.ts (1)
  • isWsl (4-18)
packages/schema/src/plugins/enhancer/enhance/index.ts (3)
packages/schema/src/plugins/zod/generator.ts (1)
  • project (165-167)
packages/sdk/src/code-gen.ts (1)
  • saveSourceFile (25-38)
packages/language/src/ast.ts (1)
  • DataModel (56-66)
🪛 LanguageTool
packages/ide/jetbrains/CHANGELOG.md

[uncategorized] ~7-~7: You might be missing the article “the” here.
Context: ... - Prefer to use "stdlib.zmodel" from user's node_modules folder. ## 2.13.0 ### ...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

⏰ 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). (6)
  • GitHub Check: dependency-review
  • GitHub Check: build-test (20.x)
  • GitHub Check: OSSAR-Scan
  • GitHub Check: build-test (20.x)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: build-test (20.x)
🔇 Additional comments (18)
packages/schema/src/utils/is-wsl.ts (1)

4-18: Well-implemented WSL detection utility.

The layered approach for WSL detection is robust and follows best practices:

  • Platform check first (performance optimization)
  • OS release string check (most reliable method)
  • Fallback to /proc/version file check
  • Proper error handling for file system operations
packages/schema/src/telemetry.ts (3)

11-11: Clean integration of WSL detection.

The import follows the established pattern and is consistent with other utility imports.


46-46: Consistent telemetry property addition.

The WSL detection property follows the same pattern as other environment detection properties like isDocker.


110-110: Appropriate telemetry payload inclusion.

The isWsl property is correctly added to the telemetry payload alongside other environment information.

packages/ide/jetbrains/build.gradle.kts (1)

12-12: Version bump aligns with PR objectives.

The version update from 2.15.0 to 2.16.1 is consistent with the PR title indicating a v2.16.1 release.

packages/ide/jetbrains/CHANGELOG.md (1)

9-13: Good changelog organization.

Moving the @default support for @json fields from unreleased to a specific version (2.13.0) provides better version tracking and release clarity.

tests/regression/tests/issue-2168.test.ts (1)

3-46: Comprehensive regression test for JSON-typed fields.

The test effectively validates JSON type handling across multiple aspects:

  • Schema compilation with JSON-typed fields
  • Type generation and export
  • TypeScript usage and imports
  • End-to-end functionality

The test structure with extraSourceFiles is particularly good as it validates that the generated types can be properly imported and used in actual code.

packages/schema/src/plugins/enhancer/enhance/index.ts (5)

124-130: LGTM! Clean implementation of conditional JSON types export.

The conditional export of JSON types for the new Prisma client generator is properly implemented and follows the expected pattern.


246-246: Good improvement: using fixed package import path.

Switching from a relative path to the fixed package import '@prisma/client/runtime/library' improves maintainability and reduces fragility.


495-502: Well-structured approach for shared JSON type definitions.

Creating a centralized json-types.ts file and using the SDK's saveSourceFile function ensures consistency with other generated files.


515-531: Excellent implementation of targeted JSON type imports.

The code correctly:

  • Imports runtime types for $Types.Skip usage
  • Conditionally imports only the JSON types actually used by each model
  • Deduplicates type names using Set
  • Uses the correct relative import path

943-943: Appropriate simplification: removing unnecessary async.

The generateExtraTypes method doesn't perform any asynchronous operations, so removing the async keyword simplifies the code without affecting functionality.

packages/runtime/src/local-helpers/simple-traverse.ts (1)

22-32: Well-implemented update mechanism.

The update function correctly handles parent reference updates and prevents further traversal of updated nodes.

packages/runtime/src/local-helpers/index.ts (1)

1-1: Export addition looks good.

The new export for simple-traverse is correctly added.

packages/runtime/src/enhancements/node/delegate.ts (1)

16-16: Successful migration to local traverse utility.

The replacement of the external traverse library with the local simpleTraverse utility is correctly implemented. The callback signature change is properly handled.

Also applies to: 489-497

packages/runtime/src/enhancements/node/policy/policy-utils.ts (3)

17-17: Clean migration to simpleTraverse utility.

The replacement of traverse with simpleTraverse is correctly implemented in both prefixConstraintVariables and getCheckerConstraint methods. The callback signatures are properly updated.

Also applies to: 691-708


472-475: Improved method naming and implementation.

The rename from getFieldReadGuards to getCombinedFieldOverrideReadGuards better describes the method's purpose. The implementation clearly combines field-level override read guards with proper handling of edge cases.

Also applies to: 960-982


612-614: Helpful comment clarification.

The updated comment better explains that fields in the where clause must satisfy field-level read policies.

@ymc9 ymc9 merged commit b73b3de into main Jul 7, 2025
17 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.

4 participants