✨ server: add future requirement to bridge - #1071
Conversation
🦋 Changeset detectedLatest commit: 149d39f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky test(s)
|
There was a problem hiding this comment.
Code Review
This pull request adds support for a future KYC link in the Bridge provider. It updates the ProviderInfo and CustomerResponse schemas, implements a helper function futureKYCLink to filter and retrieve the earliest future requirement within a 30-day window, and adds comprehensive test coverage. Feedback suggests refactoring the futureKYCLink function to return a consistent Promise by declaring it async, replacing toSorted with sort for better compatibility, and using async/await with try/catch for improved readability.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds an optional ChangesBridge future requirement response
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ef72285cd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: c3e6cdfd-6eac-4198-88d8-b9cb4d4a7451
📒 Files selected for processing (4)
.changeset/swift-otters-prepare.mdserver/api/ramp.tsserver/test/utils/bridge.test.tsserver/utils/ramps/bridge.ts
406ecf2 to
74e0362
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
server/utils/ramps/bridge.ts (1)
1063-1068:⚠️ Potential issue | 🟠 Major | ⚡ Quick winExclude past-due requirements from the future window filter.
Line 1066 only enforces the upper bound, so already-expired
effective_datevalues (negative delta) are still eligible and can producefutureKYCLinkincorrectly.proposed fix
function futureKYCLink(bridgeUser: InferOutput<typeof CustomerResponse>, redirectUri?: string) { + const now = Date.now(); const next = bridgeUser.endorsements .flatMap((endorsement) => endorsement.future_requirements ?? []) .filter( - (requirement) => - requirement.pending.length === 0 && - new Date(requirement.effective_date).getTime() - Date.now() <= FutureKYCWindowMs, + (requirement) => { + const delta = new Date(requirement.effective_date).getTime() - now; + return requirement.pending.length === 0 && delta >= 0 && delta <= FutureKYCWindowMs; + }, ) .toSorted((a, b) => new Date(a.effective_date).getTime() - new Date(b.effective_date).getTime())[0];
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4bc3a048-7ed4-4302-850b-99d02d6f0fa9
📒 Files selected for processing (4)
.changeset/swift-otters-prepare.mdserver/api/ramp.tsserver/test/utils/bridge.test.tsserver/utils/ramps/bridge.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74e036270c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b75da58303
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
3a44227 to
8f9a962
Compare
Summary by CodeRabbit
undefined.