Skip to content

🐛 server: handle failed onboarding tasks in manteca#831

Closed
mainqueg wants to merge 1 commit into
mainfrom
status
Closed

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

Conversation

@mainqueg

@mainqueg mainqueg commented Feb 23, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes
    • Updated onboarding determination so required onboarding tasks in a FAILED state are treated as requiring onboarding, directing users to complete verification and logging a warning.
  • Tests
    • Added coverage for the FAILED required-task scenario to ensure the provider reports the correct onboarding status.
  • Chores
    • Added a patch-release changeset entry documenting the fix.

@changeset-bot

changeset-bot Bot commented Feb 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 916ad9e

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
Copy Markdown

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

coderabbitai Bot commented Feb 23, 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

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

Failed onboarding task detection

Layer / File(s) Summary
Schema and type updates
server/utils/ramps/manteca.ts
The internal onboardingTaskStatus constant is expanded to include FAILED and reordered; OnboardingTaskInfo type derives its status picklist from the updated constant.
Provider status logic for failed and pending tasks
server/utils/ramps/manteca.ts
In getProvider, a new required-task FAILED status check is added ahead of PENDING; when triggered, it logs a Sentry warning with exception type "has failed tasks" and returns ONBOARDING with full currencies. The PENDING branch is updated to remove mantecaUser from Sentry logging context.
Test coverage for failed status
server/test/utils/manteca.test.ts
Adds a unit test asserting that when required onboarding tasks include FAILED status, getProvider returns ONBOARDING.
Changelog entry
.changeset/fancy-ends-dance.md
Introduces a new Changesets file marking @exactly/server as a patch release with a note describing the bugfix for handling failed onboarding tasks in manteca.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant getProvider
  participant Sentry
  Caller->>getProvider: request provider status
  getProvider->>getProvider: check required task statuses
  alt any required task == FAILED
    getProvider->>Sentry: captureException with "has failed tasks"
    getProvider-->>Caller: return ONBOARDING (full currencies)
  else any required task == PENDING
    getProvider->>Sentry: captureException with "has pending tasks"
    getProvider-->>Caller: return ONBOARDING or NOT_STARTED
  else no FAILED or PENDING
    getProvider-->>Caller: continue normal flow
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • exactly/exa#1106: Implements handling for failed onboarding tasks in manteca.getProvider with test coverage and Sentry logging, directly addressing the feature requirement.

Possibly related PRs

  • exactly/exa#812: Both PRs modify onboardingTaskStatus schema in server/utils/ramps/manteca.ts; this PR adds FAILED to the status list that the related PR exposes in hooks.

Suggested reviewers

  • cruzdanilo
  • nfmelendez
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding handling for failed onboarding tasks in the manteca utility, which is the primary focus across all modified files.
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.

✏️ 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 status
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code 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.

@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 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.

Comment thread server/utils/ramps/manteca.ts
Comment thread server/utils/ramps/manteca.ts

@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: 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

Comment thread server/utils/ramps/manteca.ts Outdated
@sentry

sentry Bot commented Feb 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.81%. Comparing base (8cfb810) to head (916ad9e).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #831      +/-   ##
==========================================
+ Coverage   75.70%   75.81%   +0.10%     
==========================================
  Files         245      245              
  Lines       11917    12001      +84     
  Branches     4197     4227      +30     
==========================================
+ Hits         9022     9098      +76     
- Misses       2572     2573       +1     
- Partials      323      330       +7     
Flag Coverage Δ
e2e 75.51% <100.00%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mainqueg mainqueg force-pushed the status branch 2 times, most recently from 89fe898 to a9371a2 Compare March 3, 2026 13:35

@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: 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 thread server/test/utils/manteca.test.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: a9371a283e

ℹ️ 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/manteca.ts Outdated

@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: 57715d6bad

ℹ️ 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/manteca.ts Outdated
@mainqueg mainqueg force-pushed the status branch 2 times, most recently from fefcf6a to c1e8bcd Compare June 23, 2026 16:48

@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: c1e8bcd019

ℹ️ 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/manteca.ts

@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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
server/utils/ramps/manteca.ts (1)

256-281: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the duplicated Sentry warning block.

The withScope + addEventProcessor + captureException block in the FAILED branch (Lines 258-267) is now nearly identical to the PENDING branch (Lines 272-281), differing only by the type string. With two uses, extracting a small helper removes the duplication and keeps the two paths consistent.

♻️ Proposed refactor — shared warning helper
-  if (Object.values(mantecaUser.onboarding).some((task) => task.required && task.status === "FAILED")) {
-    // TODO handle failed required tasks
-    withScope((scope) => {
-      scope.addEventProcessor((event) => {
-        if (event.exception?.values?.[0]) event.exception.values[0].type = "has failed tasks";
-        return event;
-      });
-      captureException(new Error("has failed tasks"), {
-        level: "warning",
-        fingerprint: ["{{ default }}", "has failed tasks"],
-      });
-    });
+  if (Object.values(mantecaUser.onboarding).some((task) => task.required && task.status === "FAILED")) {
+    // TODO handle failed required tasks
+    warnOnboarding("has failed tasks");
     return { onramp: { currencies }, status: "ONBOARDING" as const };
   }

-  if (Object.values(mantecaUser.onboarding).some((task) => task.required && task.status === "PENDING")) {
-    withScope((scope) => {
-      scope.addEventProcessor((event) => {
-        if (event.exception?.values?.[0]) event.exception.values[0].type = "has pending tasks";
-        return event;
-      });
-      captureException(new Error("has pending tasks"), {
-        level: "warning",
-        fingerprint: ["{{ default }}", "has pending tasks"],
-      });
-    });
+  if (Object.values(mantecaUser.onboarding).some((task) => task.required && task.status === "PENDING")) {
+    warnOnboarding("has pending tasks");
     return { onramp: { currencies }, status: "NOT_STARTED" as const };
   }

with, near the bottom of the file alongside other supporting declarations:

function warnOnboarding(type: string) {
  withScope((scope) => {
    scope.addEventProcessor((event) => {
      if (event.exception?.values?.[0]) event.exception.values[0].type = type;
      return event;
    });
    captureException(new Error(type), { level: "warning", fingerprint: ["{{ default }}", type] });
  });
}

As per coding guidelines: "extract and abstract only with reuse (two or more uses) or foot-gun encapsulation."

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7af9decf-f8f4-4982-a69d-1deec26a5cad

📥 Commits

Reviewing files that changed from the base of the PR and between fefcf6a and c1e8bcd.

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

Comment thread server/utils/ramps/manteca.ts
@mainqueg mainqueg force-pushed the status branch 3 times, most recently from 7345024 to e4ea95e Compare June 24, 2026 12:39
@mainqueg

mainqueg commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

duplicated of #1130

@mainqueg mainqueg closed this Jul 2, 2026
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.

2 participants