-
-
Couldn't load subscription status.
- Fork 126
chore: improve code comments #2167
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
📝 WalkthroughWalkthroughThe code refactors and renames a method related to field-level override read guards in policy utilities, updating its usage and clarifying comments. The new method explicitly combines field-level override read guards using a logical AND, and related comments and import statements are adjusted for clarity. No core logic or control flow is altered. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant PolicyUtil
participant CrudContract
Client->>PolicyUtil: injectAuthGuardAsWhere(args)
PolicyUtil->>PolicyUtil: getCombinedFieldOverrideReadGuards(db, model, args)
PolicyUtil->>CrudContract: Retrieve field-level override read guards
PolicyUtil->>PolicyUtil: Combine guards with logical AND
PolicyUtil-->>Client: Return merged read guard constraints
✨ 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
🔭 Outside diff range comments (1)
packages/runtime/src/enhancements/node/policy/policy-utils.ts (1)
965-972: Ensure nested object selections are honored inselectchecksThe boolean-only check drops fields when using nested
selectobjects (e.g.select: { author: { select: { id: true } } }). Update both occurrences of the filter to treat any defined, non-false value as selected:• packages/runtime/src/enhancements/node/policy/policy-utils.ts (around line 965)
• packages/runtime/src/enhancements/edge/policy/policy-utils.ts (around line 965)- fields = allFields.filter(f => args.select?.[f.name] === true); + fields = allFields.filter(f => { + const sel = args.select?.[f.name]; + // treat any defined, non-false value (object or boolean) as selected + return sel !== undefined && sel !== false; + });
🧹 Nitpick comments (1)
packages/runtime/src/enhancements/node/policy/policy-utils.ts (1)
970-973: Potential duplicateFieldInfoinstances – usename-based de-dup
!fields.includes(f)relies on reference identity; ifallFieldsis
re-iterated the same field objects are returned, this is fine, but
using aSet<string>keyed byf.namewould be more robust and O(1).
Not critical, but worth a small refactor.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/runtime/src/enhancements/node/policy/policy-utils.ts(5 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/runtime/src/enhancements/node/policy/policy-utils.ts (2)
packages/runtime/src/enhancements/node/policy/handler.ts (1)
update(723-762)packages/runtime/src/types.ts (1)
CrudContract(86-86)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: build-test (20.x)
- GitHub Check: build-test (20.x)
- GitHub Check: dependency-review
- GitHub Check: build-test (20.x)
- GitHub Check: OSSAR-Scan
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
packages/runtime/src/enhancements/node/policy/policy-utils.ts (1)
691-697: 👍 SimplersimpleTraverseupdate callThe removal of the extra parentheses around
updateimproves
readability without altering behaviour.
No description provided.