Skip to content

✨ server: add future requirement to bridge - #1071

Merged
cruzdanilo merged 1 commit into
mainfrom
eea
Jun 24, 2026
Merged

✨ server: add future requirement to bridge#1071
cruzdanilo merged 1 commit into
mainfrom
eea

Conversation

@mainqueg

@mainqueg mainqueg commented Jun 4, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Bridge provider details now include an optional future KYC link (URL + effective date) for upcoming requirements within a configured future window.
  • Tests
    • Added tests covering selection, timing, aggregation, and error handling for future KYC link behavior, including cases where the field is explicitly undefined.
  • Chores
    • Added a release changeset recording a patch bump for the future KYC link update.

@changeset-bot

changeset-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 149d39f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@exactly/server Patch

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

@sentry

sentry Bot commented Jun 4, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
1107 1 1106 1
View the full list of 1 ❄️ flaky test(s)
local::local

Flake rate in main: 86.21% (Passed 4 times, Failed 25 times)

Stack Traces | 310s run time
Assertion is false: "\$[\s\d,.\xa0]+, AVAILABLE BALANCE" is visible

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread server/utils/ramps/bridge.ts Outdated
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds an optional futureRequirement to Bridge provider responses, parses Bridge future requirements, selects the earliest eligible future item within a 30-day window, wires it into getProvider(), and updates tests and release notes.

Changes

Bridge future requirement response

Layer / File(s) Summary
Response and customer schemas
server/api/ramp.ts, server/utils/ramps/bridge.ts
Adds optional futureRequirement to the Bridge provider response schema and extends Bridge customer parsing for endorsements[].future_requirements entries with effective_date and pending.
Future requirement selection
server/utils/ramps/bridge.ts
Adds the helper that flattens future requirements, filters eligible entries by pending state and date window, selects the earliest effective date, generates a KYC link, and wires the result into the active getProvider() path.
Provider behavior tests
server/test/utils/bridge.test.ts
Updates ACTIVE provider expectations for missing future requirements and adds cases for eligible selection, exclusion rules, invalid dates, failures, and multi-endorsement ordering.
Release note
.changeset/swift-otters-prepare.md
Adds a changeset declaring a patch release for @exactly/server with the future requirement note.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • exactly/exa#950: Also changes the Bridge provider response path and related schema/tests in server/utils/ramps/bridge.ts, server/api/ramp.ts, and server/test/utils/bridge.test.ts.
  • exactly/exa#1079: Also modifies Bridge getProvider() behavior and the ACTIVE/ONBOARDING control flow in the same utility.
  • exactly/exa#814: Earlier Bridge provider type and link-field changes in the same area.

Suggested reviewers

  • nfmelendez
  • cruzdanilo
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the main change: adding a future requirement field to the Bridge server provider.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch eea
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch eea

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread server/utils/ramps/bridge.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c3e6cdfd-6eac-4198-88d8-b9cb4d4a7451

📥 Commits

Reviewing files that changed from the base of the PR and between 5c3f91c and 7ef7228.

📒 Files selected for processing (4)
  • .changeset/swift-otters-prepare.md
  • server/api/ramp.ts
  • server/test/utils/bridge.test.ts
  • server/utils/ramps/bridge.ts

Comment thread server/test/utils/bridge.test.ts Outdated
Comment thread server/utils/ramps/bridge.ts Outdated
@mainqueg
mainqueg force-pushed the eea branch 2 times, most recently from 406ecf2 to 74e0362 Compare June 12, 2026 15:38

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
server/utils/ramps/bridge.ts (1)

1063-1068: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Exclude past-due requirements from the future window filter.

Line 1066 only enforces the upper bound, so already-expired effective_date values (negative delta) are still eligible and can produce futureKYCLink incorrectly.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 406ecf2 and 74e0362.

📒 Files selected for processing (4)
  • .changeset/swift-otters-prepare.md
  • server/api/ramp.ts
  • server/test/utils/bridge.test.ts
  • server/utils/ramps/bridge.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread server/utils/ramps/bridge.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread server/utils/ramps/bridge.ts Outdated
Comment thread server/utils/ramps/bridge.ts
@cruzdanilo
cruzdanilo requested a review from itofarina as a code owner June 12, 2026 19:32
@cruzdanilo cruzdanilo linked an issue Jun 22, 2026 that may be closed by this pull request
@mainqueg mainqueg changed the title ✨ server: add future kyc link to bridge provider ✨ server: add future requirement to bridge provider Jun 23, 2026
@mainqueg
mainqueg force-pushed the eea branch 2 times, most recently from 3a44227 to 8f9a962 Compare June 24, 2026 13:05
@mainqueg mainqueg changed the title ✨ server: add future requirement to bridge provider ✨ server: add future requirement to bridge Jun 24, 2026
@cruzdanilo
cruzdanilo merged commit 149d39f into main Jun 24, 2026
3 of 4 checks passed
@cruzdanilo
cruzdanilo deleted the eea branch June 24, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

server: european kyc requirements

2 participants