Skip to content

🐛 server: handle failed onboarding tasks in manteca#831

Draft
mainqueg wants to merge 1 commit intomainfrom
status
Draft

🐛 server: handle failed onboarding tasks in manteca#831
mainqueg wants to merge 1 commit intomainfrom
status

Conversation

@mainqueg
Copy link
Contributor

@mainqueg mainqueg commented Feb 23, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Treat failed onboarding tasks as requiring onboarding so users are directed to complete verification and the condition is logged.
  • Tests

    • Added a test covering the failed-onboarding-task scenario to ensure correct provider status.
  • Chores

    • Added a changelog/changeset entry for a patch release.

@changeset-bot
Copy link

changeset-bot bot commented Feb 23, 2026

🦋 Changeset detected

Latest commit: a9371a2

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

@gemini-code-assist
Copy link

Summary of Changes

Hello @mainqueg, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the server's manteca utility by introducing robust handling for users who have failed required onboarding tasks. The primary goal is to ensure that such users are correctly identified and their status reflects the need to complete their onboarding, improving the user experience and system accuracy. The changes include new logic, updated type definitions, and corresponding test coverage.

Highlights

  • Failed Onboarding Task Handling: Implemented logic within the manteca utility to correctly identify and handle users who have failed required onboarding tasks. Previously, these users might not have been categorized appropriately.
  • Status Update: Users with one or more failed required onboarding tasks will now be assigned an ONBOARDING status, ensuring they are directed back to complete their onboarding process.
  • Error Reporting: Integrated Sentry exception capturing for instances where a user is found to have failed required onboarding tasks, providing visibility into these occurrences.
  • Test Coverage: Added a new test case to manteca.test.ts to verify that the getProvider function returns the ONBOARDING status when a user has failed required tasks.
  • Type Definition Update: Updated the onboardingTaskStatus type definition to include 'FAILED' as a possible status, aligning with the new handling logic.
Changelog
  • .changeset/fancy-ends-dance.md
    • Added a new changeset file for the patch.
  • server/test/utils/manteca.test.ts
    • Added a test case to verify that getProvider returns ONBOARDING status for users with failed required tasks.
  • server/utils/ramps/manteca.ts
    • Implemented logic to detect and handle users with failed required onboarding tasks, returning an ONBOARDING status.
    • Added Sentry exception capturing for failed onboarding task scenarios.
    • Updated the onboardingTaskStatus array to include 'FAILED' as a valid status.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Feb 23, 2026

Walkthrough

Detects FAILED required onboarding tasks in manteca: getProvider now treats FAILED as requiring onboarding, logs a Sentry warning, and returns ONBOARDING; onboardingTaskStatus was expanded to include FAILED; a unit test and a changeset entry were added.

Changes

Cohort / File(s) Summary
Changeset entry
.changeset/fancy-ends-dance.md
Adds a patch changeset for @exactly/server describing a bugfix for handling failed onboarding tasks in manteca.
Manteca logic
server/utils/ramps/manteca.ts
Adds a pre-PENDING check for required onboarding tasks with status FAILED; logs a Sentry warning ("has failed tasks") and returns ONBOARDING with full currencies and empty cryptoCurrencies. Updates onboardingTaskStatus to include FAILED and reorders values; adjusts related types.
Tests
server/test/utils/manteca.test.ts
Adds test asserting getProvider returns ONBOARDING when a required onboarding task has FAILED status.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant getProvider as "getProvider\n(server/utils/ramps/manteca.ts)"
  participant Sentry as "Sentry"
  Caller->>getProvider: request provider info
  getProvider->>getProvider: fetch onboarding tasks
  alt any required task == FAILED
    getProvider->>Sentry: captureWarning("has failed tasks", context)
    getProvider-->>Caller: return ONBOARDING (full currencies, cryptoCurrencies: [])
  else no FAILED (pending or none)
    getProvider-->>Caller: continue existing flow (NOT_STARTED / ONBOARDING)
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • nfmelendez
  • cruzdanilo
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately summarizes the main change: handling failed onboarding tasks in the manteca utility, which is reflected across test, implementation, and type definition updates.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch status

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 and usage tips.

Copy link

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

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 aims to explicitly handle user onboarding tasks with a 'FAILED' status by introducing a check in the getProvider function in manteca.ts, ensuring these cases are logged to Sentry and the user's status is correctly set to 'ONBOARDING'. A medium-severity security vulnerability has been identified: the error handling now logs a complete user object containing Personally Identifiable Information (PII) to an external service, which requires remediation to protect user data. Additionally, a suggestion has been made regarding a TODO comment for improved long-term maintainability by tracking it in a project management tool.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b2b810 and 8478f3a.

📒 Files selected for processing (3)
  • .changeset/fancy-ends-dance.md
  • server/test/utils/manteca.test.ts
  • server/utils/ramps/manteca.ts

@sentry
Copy link

sentry bot commented Feb 24, 2026

✅ All tests passed.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63c2115 and a9371a2.

📒 Files selected for processing (3)
  • .changeset/fancy-ends-dance.md
  • server/test/utils/manteca.test.ts
  • server/utils/ramps/manteca.ts

Comment on lines +353 to +367
it("returns ONBOARDING when user has failed required tasks", async () => {
vi.spyOn(globalThis, "fetch").mockResolvedValueOnce(
mockFetchResponse({
...mockOnboardingUser,
onboarding: {
EMAIL_VALIDATION: { required: true, status: "COMPLETED" },
IDENTITY_VALIDATION: { required: true, status: "FAILED" },
},
}),
);

const result = await manteca.getProvider(account, "AR");

expect(result.status).toBe("ONBOARDING");
});
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Strengthen this scenario to lock precedence and response shape.

Add a required PENDING task alongside FAILED and assert onramp fields so this test protects both branch order and payload contract.

♻️ Suggested test hardening
     it("returns ONBOARDING when user has failed required tasks", async () => {
       vi.spyOn(globalThis, "fetch").mockResolvedValueOnce(
         mockFetchResponse({
           ...mockOnboardingUser,
           onboarding: {
-            EMAIL_VALIDATION: { required: true, status: "COMPLETED" },
+            EMAIL_VALIDATION: { required: true, status: "PENDING" },
             IDENTITY_VALIDATION: { required: true, status: "FAILED" },
           },
         }),
       );

       const result = await manteca.getProvider(account, "AR");

       expect(result.status).toBe("ONBOARDING");
+      expect(result.onramp.currencies).toEqual(["ARS", "USD"]);
+      expect(result.onramp.cryptoCurrencies).toEqual([]);
     });

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.

1 participant