Conversation
WalkthroughAdds client-visible session ID handling: middleware ensures an Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ 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). (3)
Comment |
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (21.42%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #2347 +/- ##
==========================================
- Coverage 51.19% 50.88% -0.32%
==========================================
Files 1059 1049 -10
Lines 28854 28518 -336
Branches 6302 6293 -9
==========================================
- Hits 14771 14510 -261
+ Misses 13690 13612 -78
- Partials 393 396 +3
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/deploy-web/src/context/FlagProvider/FlagProvider.tsx(2 hunks)apps/deploy-web/src/middleware.ts(1 hunks)apps/deploy-web/src/utils/localStorage.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{ts,tsx,js}: Never use typeanyor cast to typeany. Always define the proper TypeScript types.
Never use deprecated methods from libraries.
Don't add unnecessary comments to the code.
Files:
apps/deploy-web/src/context/FlagProvider/FlagProvider.tsxapps/deploy-web/src/middleware.tsapps/deploy-web/src/utils/localStorage.ts
⏰ 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). (3)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
apps/deploy-web/src/context/FlagProvider/FlagProvider.tsx (1)
25-28: LGTM! Session ID properly integrated into flag context.The addition of
sessionIdto the Unleash context aligns with the PR objective of providing stable session identification across FE, SSR, and API for consistent feature flag evaluation.apps/deploy-web/src/middleware.ts (1)
23-39: LGTM! Session cookie generation is well-implemented.The session ID generation and cookie configuration are appropriate for the use case:
crypto.randomUUID()provides sufficient randomness for feature flag session tracking- Cookie attributes (SameSite, Secure, MaxAge) are properly configured
httpOnly: falseis correctly documented as necessary for client-side accessThe security trade-off of making the cookie JavaScript-accessible is acceptable since the session ID is used only for feature flag evaluation, not authentication or authorization.
apps/deploy-web/src/utils/localStorage.ts (1)
9-11: LGTM! Migration properly cleans up legacy session storage.The new migration correctly removes the old localStorage-based session ID (
unleash:repository:sessionId), which is now replaced by the cookie-based implementation. The migration follows the established pattern and will execute automatically for users upgrading from older versions.
7ee9add to
95f14aa
Compare
Why
It's important to have the same session id on FE, SSR, API to have stable feature flag selection in case of gradual FF rollout or when specifying strategy with filters by sessionId
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.