Skip to content

merge dev to main (v2.12.3) #2043

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 3 commits into from
Mar 13, 2025
Merged

merge dev to main (v2.12.3) #2043

merged 3 commits into from
Mar 13, 2025

Conversation

ymc9
Copy link
Member

@ymc9 ymc9 commented Mar 13, 2025

No description provided.

Copy link
Contributor

coderabbitai bot commented Mar 13, 2025

📝 Walkthrough

Walkthrough

This pull request makes several updates across the repository. The project version in the JetBrains Gradle build file is bumped from "2.12.2" to "2.12.3". In addition, the PR enhances type-checking in the language server validator, refines version-range logic in the Prisma enhancer, and adjusts schema generation in the Zod transformer to handle arrays. Dependency versions for Prisma packages are updated in both test scaffolding and integration tests, and a new regression test is added to verify default JSON field behaviors related to issue 2039.

Changes

File(s) Change Summary
packages/ide/jetbrains/build.gradle.kts Updated project version from "2.12.2" to "2.12.3".
packages/schema/.../validator/attribute-application-validator.ts Added a conditional block in assignableToAttributeParam to ensure that when an attribute has a Typed JSON container and a @default parameter, the resolved type of the argument is 'String'.
packages/schema/.../enhancer/enhance/index.ts Modified condition for the DynamicClientExtensionThis type to check for Prisma version between "5.16.0" and "6.5.0" (exclusive), updating the comment accordingly.
packages/schema/.../zod/transformer.ts Revised the generateObjectSchemaField method to conditionally wrap lazy-loaded schemas in .array() for array fields, ensuring proper schema generation.
script/test-scaffold.ts, tests/integration/.../cli/plugins.test.ts Upgraded Prisma dependency versions from "6.4.x" to "6.5.x" in test scaffolding and integration tests.
tests/regression/tests/issue-2039.test.ts Introduced a new test file that validates default JSON field values using asynchronous database creation and schema loading.

Sequence Diagram(s)

sequenceDiagram
    participant T as Test Runner
    participant DB as PostgreSQL Database
    participant SL as Schema Loader
    participant App as Application Model
    participant Z as Zod Validator

    T->>DB: Create database using createPostgresDb()
    T->>SL: Load schema (defines model 'Bar' with default JSON values)
    SL->>App: Initialize model with defaults (for fields foo and fooList)
    T->>App: Create a new entry in 'Bar'
    App-->>T: Return created object with default values
    T->>Z: Validate result against Zod schema
Loading

Possibly related PRs

  • chore: bump version #2042: Direct update of the version number in build.gradle.kts from "2.12.2" to "2.12.3", mirroring this PR's change.
  • chore: bump version #1568: Involves a version update in build.gradle.kts, indicating a strong code-level link through version management.
  • merge dev to main (v2.1.1) #1453: Also updates the version number in the same build file, establishing a direct connection with the current modifications.

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d4fb5ab and 7632f24.

⛔ Files ignored due to path filters (20)
  • package.json is excluded by !**/*.json
  • 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/plugins/trpc/tests/projects/nuxt-trpc-v10/package.json is excluded by !**/*.json
  • packages/plugins/trpc/tests/projects/nuxt-trpc-v11/package.json is excluded by !**/*.json
  • packages/plugins/trpc/tests/projects/t3-trpc-v11/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
  • tests/integration/test-run/package.json is excluded by !**/*.json
  • tests/integration/tests/frameworks/nextjs/test-project/package.json is excluded by !**/*.json
  • tests/integration/tests/frameworks/trpc/test-project/package.json is excluded by !**/*.json
📒 Files selected for processing (7)
  • packages/ide/jetbrains/build.gradle.kts (1 hunks)
  • packages/schema/src/language-server/validator/attribute-application-validator.ts (2 hunks)
  • packages/schema/src/plugins/enhancer/enhance/index.ts (1 hunks)
  • packages/schema/src/plugins/zod/transformer.ts (1 hunks)
  • script/test-scaffold.ts (1 hunks)
  • tests/integration/tests/cli/plugins.test.ts (2 hunks)
  • tests/regression/tests/issue-2039.test.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: OSSAR-Scan
  • GitHub Check: build-test (20.x)
  • GitHub Check: build-test (20.x)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: build-test (20.x)
  • GitHub Check: OSSAR-Scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (8)
script/test-scaffold.ts (1)

22-22: Dependency version updated successfully

The Prisma dependencies have been updated from 6.4.x to 6.5.x, which aligns with the versions used in other parts of the project.

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

12-12: Version bump for new release

Project version has been incremented from 2.12.2 to 2.12.3 as part of this release. This matches the PR title indicating a merge to main for v2.12.3.

tests/integration/tests/cli/plugins.test.ts (2)

78-78: Dependency version updated successfully

The @prisma/client dependency has been updated from 6.4.x to 6.5.x, ensuring consistency with other updated packages in the project.


88-88: Dependency version updated successfully

The prisma development dependency has been updated from 6.4.x to 6.5.x to maintain version alignment across the codebase.

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

240-242:

❓ Verification inconclusive

Type compatibility fix for Prisma version range

The code has been updated to handle a version-specific type parameter in DynamicClientExtensionThis. This change ensures type compatibility by only applying the generic parameter ClientOptions for Prisma versions between 5.16.0 and 6.5.0, as this parameter is apparently no longer needed in 6.5.0 or has been handled differently.

This update is important as it prevents potential type errors when using the enhancer with the newly updated Prisma 6.5.x dependencies.


🏁 Script executed:

#!/bin/bash
# Check the Prisma changelog to validate the type changes in 6.5.0

rg -A 10 -B 10 "DynamicClientExtensionThis" --type typescript

Length of output: 96


Below is a revised review comment. Since our initial automated search using the --type typescript flag produced an error and no evidence was obtained from that command, please verify manually that the Prisma changelog confirms that the generic parameter ClientOptions is only needed for Prisma versions 5.16.0–6.4.x (with the change not applicable in 6.5.0 and later).

Review Update: Manual Verification Required

The update in packages/schema/src/plugins/enhancer/enhance/index.ts (lines 240–242) conditionally applies the ClientOptions generic parameter based on the Prisma version via:

        // Prisma 5.16.0...6.5.0 introduced a new generic parameter to `DynamicClientExtensionThis`
        const hasClientOptions =
            prismaVersion && semver.gte(prismaVersion, '5.16.0') && semver.lt(prismaVersion, '6.5.0');

This change aims to prevent type errors by only including the generic parameter when Prisma is between versions 5.16.0 and 6.4.x. Since our attempt to automate validation with:

rg -A 10 -B 10 "DynamicClientExtensionThis" -g "*.ts"

did not yield the expected results (likely due to file type flag issues), please manually verify that Prisma 6.5.0 and above have indeed removed or altered the handling of the ClientOptions parameter on DynamicClientExtensionThis.

Location to verify: packages/schema/src/plugins/enhancer/enhance/index.ts, lines 240–242
Action required: Confirm via the Prisma documentation/changelog that the conditional application correctly reflects the changes in Prisma 6.5.0.

packages/schema/src/language-server/validator/attribute-application-validator.ts (1)

270-274: Good addition for type validation of JSON fields with default values.

This change correctly handles the case where a field is of type Typed JSON with a @default attribute by ensuring the argument is a string literal. This aligns with how JSON values need to be stored as strings in databases.

packages/schema/src/plugins/zod/transformer.ts (1)

200-202: Excellent fix for handling array types in JSON schema generation.

This change properly handles JSON fields that are arrays of type definitions by conditionally wrapping the lazy-loaded schema with .array() when needed. This ensures that array JSON fields with type definitions are correctly validated.

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

1-42: Well-structured regression test for issue #2039.

This regression test effectively validates that:

  1. Default values for both single and array JSON fields are properly applied when creating new records
  2. The generated Zod schemas correctly validate typed JSON input

The test covers both runtime behavior and schema generation, providing good coverage for the bug fix.

✨ 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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

@ymc9 ymc9 merged commit a4acf35 into main Mar 13, 2025
13 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