Skip to content

merge dev to main (v2.12.2) #2032

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 7, 2025
Merged

merge dev to main (v2.12.2) #2032

merged 3 commits into from
Mar 7, 2025

Conversation

ymc9
Copy link
Member

@ymc9 ymc9 commented Mar 7, 2025

No description provided.

Copy link
Contributor

coderabbitai bot commented Mar 7, 2025

📝 Walkthrough

Walkthrough

This pull request introduces several changes. A new sponsor entry (“Suhyl”) has been added to the README. The project version in the Gradle build script is incremented from 2.12.1 to 2.12.2. In two schema generator plugins, the filtering logic has been modified to use the includes method instead of startsWith, affecting how delegate auxiliary fields are excluded. Finally, a new regression test file has been added to verify correct schema behavior and database query operations.

Changes

File(s) Summary
README.md Added a new sponsor entry with a link, avatar image, and sponsor name "Suhyl" in the "Current Sponsors" section
packages/ide/jetbrains/build.gradle.kts Updated project version from 2.12.1 to 2.12.2
packages/schema/src/plugins/enhancer/enhance/index.ts
packages/schema/src/plugins/zod/generator.ts
Modified filtering logic to use includes(DELEGATE_AUX_RELATION_PREFIX) instead of startsWith, broadening the criteria for excluding auxiliary fields and methods
tests/regression/tests/issue-2028.test.ts Introduced a new regression test for database schema generation ensuring correct filtering of delegate fields and verifying proper relationships and unique entry queries

Sequence Diagram(s)

sequenceDiagram
    participant Interface as Schema Interface
    participant Generator as EnhancerGenerator
    participant Filter as Filtering Logic (includes check)

    Interface->>Generator: Pass properties/methods
    Generator->>Filter: Check each field for delegate prefix via includes()
    Filter-->>Generator: Return filtered properties/methods
    Generator->>Interface: Generate transformed interface
Loading
sequenceDiagram
    participant Schema as Object Schema Data
    participant Generator as ZodSchemaGenerator
    participant Filter as Filtering Logic (includes check)

    Schema->>Generator: Provide object fields
    Generator->>Filter: Filter fields based on delegate prefix using includes()
    Filter-->>Generator: Return filtered fields
    Generator->>Schema: Generate final object schema
Loading

Possibly related PRs

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

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)
tests/regression/tests/issue-2028.test.ts (2)

1-116: Consider adding a database cleanup step.

The test creates a PostgreSQL database but doesn't include cleanup logic to remove it after the test completes. While this might be handled elsewhere, it would be good practice to include cleanup to prevent test database accumulation.


3-4: Add a brief comment explaining issue #2028.

It would be helpful to include a short comment explaining what issue #2028 was about (related to delegate auxiliary fields filtering) to provide context for future maintainers.

 describe('issue 2028', () => {
+    // Tests fix for issue #2028: Delegate auxiliary fields for compound unique constraints 
+    // were not being properly excluded when using includes() instead of startsWith()
     it('regression', async () => {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8934679 and e8694e6.

⛔ Files ignored due to path filters (13)
  • 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/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
📒 Files selected for processing (5)
  • README.md (1 hunks)
  • packages/ide/jetbrains/build.gradle.kts (1 hunks)
  • packages/schema/src/plugins/enhancer/enhance/index.ts (2 hunks)
  • packages/schema/src/plugins/zod/generator.ts (1 hunks)
  • tests/regression/tests/issue-2028.test.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: OSSAR-Scan
  • GitHub Check: build-test (20.x)
  • GitHub Check: build-test (20.x)
  • GitHub Check: build-test (20.x)
  • GitHub Check: OSSAR-Scan
🔇 Additional comments (12)
packages/ide/jetbrains/build.gradle.kts (1)

12-12: Version bump for patch release.

The version has been incremented from 2.12.1 to 2.12.2, indicating a new patch release with backward-compatible bug fixes or minor changes.

README.md (1)

241-241: New sponsor added to the README.

A new sponsor entry ("Suhyl") has been added to the sponsors table. The entry follows the same formatting as existing sponsors with proper link, image, and styling.

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

247-247: Filter logic updated to be more comprehensive.

Changed field filtering from startsWith to includes for DELEGATE_AUX_RELATION_PREFIX. This modification will catch auxiliary fields that contain the prefix anywhere in their name, not just at the beginning, providing more thorough filtering.

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

568-568: Improved property filtering logic.

Changed property filtering from startsWith to includes for DELEGATE_AUX_RELATION_PREFIX, ensuring more thorough filtering of auxiliary fields in the interface.


571-571: Improved method filtering logic.

Changed method filtering from startsWith to includes for DELEGATE_AUX_RELATION_PREFIX, matching the same pattern update as for properties.


853-853: Updated auxiliary declaration filtering.

Changed filtering in findAuxDecls from startsWith to includes, making it consistent with other similar filtering changes in the codebase.

tests/regression/tests/issue-2028.test.ts (6)

1-5: Good use of testing utilities.

The test correctly leverages the appropriate testing utilities for database creation and schema loading, which makes the test setup clean and maintainable.


8-47: Well-structured schema definition that clearly demonstrates the issue.

The schema effectively models the delegation pattern with @@delegate(type) and type inheritance through model extensions. The relationships between models and compound unique constraints are properly defined.


49-54: Appropriate schema loading configuration.

Using fullZod: true is essential for this test case since you're testing the Zod schema generation behavior. The PostgreSQL provider configuration aligns with the database setup.


55-73: Good test coverage for schema validation.

The test correctly verifies that delegate auxiliary fields are excluded from the generated Zod schemas for both Bar and Baz models, which appears to be the core issue being fixed.


74-93: Comprehensive test data setup.

The test creates the necessary related entities to verify compound unique queries work correctly. This setup provides good coverage for testing the functional impact of the schema changes.


94-114: Effective functional verification.

The test correctly verifies that querying by compound unique constraints works as expected after the schema changes, ensuring both UserFolder objects can be retrieved correctly.

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