Skip to content

📈 server: improve panda failure telemetry#794

Merged
cruzdanilo merged 3 commits intomainfrom
capture
Feb 17, 2026
Merged

📈 server: improve panda failure telemetry#794
cruzdanilo merged 3 commits intomainfrom
capture

Conversation

@cruzdanilo
Copy link
Copy Markdown
Member

@cruzdanilo cruzdanilo commented Feb 17, 2026


Open with Devin

Summary by CodeRabbit

  • New Features

    • Added a new analytics event for collection failures and included a reasonName field on rejected-transaction tracking.
  • Bug Fixes

    • Improved revert-reason extraction and fingerprinting across refund/collect/withdraw flows, enriching telemetry and enabling conditional suspension on settlement failures.
  • Tests

    • Updated tests to assert expanded tracking events, enriched error payloads, and settlement-failure behaviors.
  • Chores

    • Added changesets documenting telemetry improvements.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 17, 2026

🦋 Changeset detected

Latest commit: 8ade540

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 17, 2026

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

Rename and replace the revert-fingerprint utility with revertFingerprint, add revertReason, update hooks/keeper/tests to use them, and expand telemetry (add PandaCollectionFailed, richer Segment events and Sentry fingerprints/tags/contexts) for panda settlement/refund and withdraw error paths.

Changes

Cohort / File(s) Summary
Changesets
.changeset/swift-otter-report.md, .changeset/gentle-lions-shout.md
Add patch changesets documenting telemetry improvements for panda settlement/refund failures.
New utilities
server/utils/revertReason.ts, server/utils/revertFingerprint.ts
Add revertReason to derive human-readable revert reasons (with fallbacks and optional arg formatting) and revertFingerprint to produce structured fingerprint arrays (uses revertReason and WrappedError extraction).
Removed utility
server/utils/fingerprintRevert.ts
Remove old fingerprintRevert (replaced by revertFingerprint).
Keeper logic
server/utils/keeper.ts
Replace manual revert parsing with revertReason(...); switch Sentry fingerprinting to revertFingerprint(...); update imports and error capture.
Telemetry types
server/utils/segment.ts
Add PandaCollectionFailed analytics event type and add optional reasonName to TransactionRejected properties.
Hooks
server/hooks/panda.ts, server/hooks/block.ts, server/hooks/activity.ts
Replace fingerprintRevert with revertFingerprint; integrate revertReason to compute reason/reasonName; enrich Segment track calls and Sentry captureException payloads with fingerprint, reason, reasonName and pandaCollection context; adjust terminal-withdraw and settlement error handling flows.
Tests
server/test/hooks/panda.test.ts, server/test/hooks/block.test.ts, server/test/utils/revertFingerprint.test.ts
Update imports/expectations to revertFingerprint; add/adjust assertions for TransactionRejected and PandaCollectionFailed tracking and enhanced Sentry capture for timeout/settlement/collection failure scenarios.

Sequence Diagram(s)

sequenceDiagram
  actor Client
  participant Hook as Panda/Block Hook
  participant Keeper as Keeper/Contract
  participant Segment as Analytics
  participant Sentry as Sentry

  Client->>Hook: initiate collection/settlement
  Hook->>Keeper: call contract (e.g., exaSend / collect)
  Keeper-->>Hook: returns or throws
  alt error (revert/failure)
    Hook->>Hook: reason = revertReason(error, {...})
    Hook->>Hook: fingerprint = revertFingerprint(error)
    Hook->>Segment: track("TransactionRejected", { ..., reason, reasonName })
    Hook->>Segment: track("PandaCollectionFailed", { ..., reason, reasonName, settlement })
    Hook->>Sentry: captureException(error, { fingerprint, tags, pandaCollection })
    Hook-->>Client: return error (may suspend user if settlement=true)
  else success
    Hook->>Segment: track success events
    Hook-->>Client: return success response
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • nfmelendez
🚥 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 accurately summarizes the main change: improving panda failure telemetry across the codebase through refactored error handling utilities and enriched error tracking.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch capture

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.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @cruzdanilo, 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 significantly improves the server's telemetry for Panda settlement failures. By refactoring error handling utilities and introducing detailed Segment tracking events, the system can now capture more granular information about why transactions are rejected or collections fail. This enhancement provides better visibility into issues, aiding in debugging and understanding user experience related to card operations.

Highlights

  • Error Handling Refactor: The utility function fingerprintRevert was renamed to revertFingerprint for clarity and a new revertReason utility was introduced to standardize error reason extraction from contract reverts and other errors.
  • Improved Panda Settlement Telemetry: Enhanced telemetry for Panda settlement failures by adding new Segment track events (TransactionRejected and PandaCollectionFailed) with comprehensive details, including card mode, merchant information, and specific revert reasons.
  • Centralized Error Reason Extraction: Error reason extraction logic was centralized into the new revertReason utility, replacing repetitive inline logic across server/hooks/activity.ts, server/hooks/block.ts, server/hooks/panda.ts, and server/utils/keeper.ts.
  • New Test Coverage: Added a new test case in server/test/hooks/panda.test.ts specifically to verify the reporting of settlement collection failures, ensuring the new telemetry is correctly captured.
Changelog
  • .changeset/swift-otter-report.md
    • Added a new changeset file for improved panda settlement failure telemetry.
  • server/hooks/activity.ts
    • Updated import and usage of fingerprintRevert to revertFingerprint.
  • server/hooks/block.ts
    • Updated import and usage of fingerprintRevert to revertFingerprint.
    • Imported new revertReason utility.
    • Replaced manual revert reason extraction with revertReason.
  • server/hooks/panda.ts
    • Updated import and usage of fingerprintRevert to revertFingerprint.
    • Imported new revertReason utility.
    • Modified card query to include mode column.
    • Added new TransactionRejected Segment track event for refund failures.
    • Added new TransactionRejected and PandaCollectionFailed Segment track events for collection failures with extensive context and tags.
  • server/test/hooks/block.test.ts
    • Updated import and usage of fingerprintRevert to revertFingerprint.
  • server/test/hooks/panda.test.ts
    • Imported segment for spying on tracking calls.
    • Added track spies to existing test cases.
    • Added a new test case to verify reporting of settlement collection failures, including TransactionRejected and PandaCollectionFailed events.
  • server/utils/keeper.ts
    • Removed unused BaseError and ContractFunctionRevertedError imports.
    • Replaced inline error reason extraction with the new revertReason utility.
    • Updated fingerprintRevert usage to revertFingerprint.
  • server/utils/revertFingerprint.ts
    • Renamed file from fingerprintRevert.ts to revertFingerprint.ts.
    • Refactored revertFingerprint to utilize the new revertReason utility for more consistent error fingerprinting.
  • server/utils/revertReason.ts
    • Added a new utility file revertReason.ts to centralize logic for extracting human-readable reasons from various error types, especially contract revert errors.
  • server/utils/segment.ts
    • Added new type definitions for the PandaCollectionFailed Segment event, including detailed properties for tracking.
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.

@sentry
Copy link
Copy Markdown

sentry bot commented Feb 17, 2026

Sentry Issue: SERVER-HK

@sentry
Copy link
Copy Markdown

sentry bot commented Feb 17, 2026

Sentry Issue: SERVER-HF

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

@sentry
Copy link
Copy Markdown

sentry bot commented Feb 17, 2026

Codecov Report

❌ Patch coverage is 91.48936% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.50%. Comparing base (b55bd79) to head (8ade540).
⚠️ Report is 4 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
server/hooks/panda.ts 93.24% 1 Missing and 4 partials ⚠️
server/utils/revertReason.ts 70.00% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #794      +/-   ##
==========================================
+ Coverage   68.88%   69.50%   +0.62%     
==========================================
  Files         207      208       +1     
  Lines        7048     7274     +226     
  Branches     2232     2332     +100     
==========================================
+ Hits         4855     5056     +201     
- Misses       2010     2025      +15     
- Partials      183      193      +10     
Flag Coverage Δ
e2e 69.23% <82.97%> (+16.82%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

gemini-code-assist[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

sentry[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@cruzdanilo cruzdanilo changed the title 📈 server: improve panda settlement failure telemetry 📈 server: improve panda failure telemetry Feb 17, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

sentry[bot]

This comment was marked as resolved.

Copy link
Copy Markdown

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

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

ℹ️ 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".

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 9 additional findings in Devin Review.

Open in Devin Review

@cruzdanilo cruzdanilo merged commit 8ade540 into main Feb 17, 2026
13 checks passed
@cruzdanilo cruzdanilo deleted the capture branch February 17, 2026 21:33
@coderabbitai coderabbitai bot mentioned this pull request Mar 30, 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.

1 participant