-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
Conversation
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
📝 WalkthroughWalkthroughThis update introduces several enhancements and refactorings across the codebase. It replaces the external Changes
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
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
Possibly related PRs
Warning Review ran into problems🔥 ProblemsCheck-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
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
⛔ 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'ssaveSourceFile
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 localsimpleTraverse
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
withsimpleTraverse
is correctly implemented in bothprefixConstraintVariables
andgetCheckerConstraint
methods. The callback signatures are properly updated.Also applies to: 691-708
472-475
: Improved method naming and implementation.The rename from
getFieldReadGuards
togetCombinedFieldOverrideReadGuards
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.
No description provided.