-
Notifications
You must be signed in to change notification settings - Fork 1
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
fix user id #184
fix user id #184
Conversation
WalkthroughThe changes in this pull request involve the removal of the Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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
Documentation and Community
|
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 and nitpick comments (2)
packages/api/src/router/environment.ts (2)
173-173
: Add session verification.
The change to use ctx.session.user.id
improves security by preventing impersonation. However, we should add a null check for the session context.
Consider adding a type guard or assertion:
- .set({ status: "approved", userId: ctx.session.user.id })
+ .set({
+ status: "approved",
+ userId: ctx.session?.user?.id ??
+ (() => { throw new Error("User session required") })()
+ })
233-233
: Add session verification (similar to approve mutation).
The change to use ctx.session.user.id
is good, but needs the same session verification as the approve mutation.
Apply the same session verification pattern:
- .set({ status: "rejected", userId: ctx.session.user.id })
+ .set({
+ status: "rejected",
+ userId: ctx.session?.user?.id ??
+ (() => { throw new Error("User session required") })()
+ })
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (3)
- apps/webservice/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/FlowPolicyNode.tsx (3 hunks)
- apps/webservice/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/PolicyApprovalRow.tsx (0 hunks)
- packages/api/src/router/environment.ts (2 hunks)
💤 Files with no reviewable changes (1)
- apps/webservice/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/PolicyApprovalRow.tsx
🔇 Additional comments (3)
apps/webservice/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/FlowPolicyNode.tsx (3)
36-36
: LGTM: Component signature updated correctly.
The removal of the userId
prop aligns with the PR objective to handle user identification through session context instead of prop drilling.
193-193
: LGTM: Component usage updated correctly.
The ApprovalDialog
is now correctly invoked without the userId
prop, maintaining all existing functionality while simplifying the props interface.
54-54
: Verify mutation calls are updated consistently.
The mutation calls have been correctly updated to remove the userId
parameter. Let's verify that all related mutation definitions are consistent.
Also applies to: 62-62
✅ Verification successful
Mutation calls are consistently updated across the codebase
The verification shows that all mutation calls in the codebase are using the new signature with just releaseId
and policyId
parameters. The only instances found are in FlowPolicyNode.tsx and they match the expected pattern without userId
. No inconsistencies were detected.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any remaining approve/reject mutation calls that might still use userId
rg -g '*.{ts,tsx}' 'environment\.policy\.approval\.(approve|reject)\..*mutate.*userId'
Length of output: 88
Script:
#!/bin/bash
# Search for all approve/reject mutation calls in the codebase
rg -g '*.{ts,tsx}' 'policy\.approval\.(approve|reject)\.mutate'
# Search for the mutation definitions in the router
rg -g '*.{ts,tsx}' 'approval.*approve.*=.*publicProcedure|approval.*reject.*=.*publicProcedure'
Length of output: 163
Script:
#!/bin/bash
# Search for any mutation calls with mutateAsync
rg -g '*.{ts,tsx}' '\.mutateAsync.*releaseId.*policyId'
# Search for router definitions related to approval
ast-grep --pattern 'approval: {
$$$
approve: $_,
reject: $_,
$$$
}'
Length of output: 528
Summary by CodeRabbit
New Features
userId
parameter from relevant components and API calls.Bug Fixes
currentUserId
in thePolicyApprovalRow
component.Documentation
userId
parameter in the approval and rejection procedures.