-
Notifications
You must be signed in to change notification settings - Fork 61
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(ids-api): Fix validity dates where clause in scope check. #17600
Conversation
WalkthroughThe pull request modifies the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing Touches
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
🧹 Nitpick comments (1)
libs/auth-api-lib/src/lib/delegations/delegation-scope.service.ts (1)
Line range hint
31-140
: Architecture improvement: Centralized validity checks.This refactoring improves the codebase by:
- Centralizing validity date checks into a reusable utility
- Maintaining consistency with other validity checks in the codebase
- Following the DRY principle
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
libs/auth-api-lib/src/lib/delegations/delegation-scope.service.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
libs/auth-api-lib/src/lib/delegations/delegation-scope.service.ts (1)
Pattern libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
🔇 Additional comments (2)
libs/auth-api-lib/src/lib/delegations/delegation-scope.service.ts (2)
31-31
: LGTM! Good refactoring to centralize validity checks.The new imports support the centralization of scope validity logic into a dedicated utility function, improving code maintainability and consistency.
Also applies to: 33-33
140-140
: Verify the behavior of getScopeValidityWhereClause.The change aligns with the PR objective to fix validity dates in the where clause. However, let's verify that the new utility function maintains the same validity check behavior.
Run the following script to analyze the implementation of
getScopeValidityWhereClause
:✅ Verification successful
The getScopeValidityWhereClause implementation is correct and properly handles validity dates
The utility function correctly implements date validity checks, including proper handling of current, future, and past delegations. For the
NOW
validity check used in the PR, it ensures delegations are active by verifyingvalidFrom <= today
AND (validTo >= today
ORvalidTo IS NULL
).🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of getScopeValidityWhereClause # Find the implementation ast-grep --pattern 'export function getScopeValidityWhereClause($_) { $$$ }' # Find all other usages for consistency rg -A 5 'getScopeValidityWhereClause'Length of output: 4506
Script:
#!/bin/bash # Get the complete implementation of getScopeValidityWhereClause and DelegationValidity ast-grep --pattern 'export const getScopeValidityWhereClause = $_' # Find DelegationValidity enum definition ast-grep --pattern 'export enum DelegationValidity { $$$ }' # Get the complete scopes.ts file for context cat libs/auth-api-lib/src/lib/delegations/utils/scopes.tsLength of output: 5706
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17600 +/- ##
==========================================
- Coverage 35.57% 35.57% -0.01%
==========================================
Files 7030 7030
Lines 150466 150467 +1
Branches 42959 42959
==========================================
- Hits 53534 53533 -1
- Misses 96932 96934 +2 Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Datadog ReportAll test runs ✅ 10 Total Test Services: 0 Failed, 10 Passed Test ServicesThis report shows up to 10 services
🔻 Code Coverage Decreases vs Default Branch (1)
|
What
Fix validity dates
where
clause in scope check.Why
To align with the validity check used elsewhere.
Screenshots / Gifs
Attach Screenshots / Gifs to help reviewers understand the scope of the pull request
Checklist:
Summary by CodeRabbit