Skip to content

✨ server: expose unknown decline reasons - #1275

Open
aguxez wants to merge 1 commit into
mainfrom
unknown-reasons
Open

✨ server: expose unknown decline reasons#1275
aguxez wants to merge 1 commit into
mainfrom
unknown-reasons

Conversation

@aguxez

@aguxez aguxez commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Unknown transaction decline reasons are now shown using the original provider message instead of a generic fallback.
    • Added monitoring alerts when an unrecognized decline reason is detected.
  • Bug Fixes

    • Improved decline-reason recognition for known, unknown, and locally requested declines.
    • Pending requests no longer override a transaction’s saved decline reason.
    • Declined activity now consistently uses the most relevant decline reason.
  • Tests

    • Added coverage for provider messages, requested reasons, pending requests, and monitoring alerts.

@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2260dba

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

coderabbitai Bot commented Aug 31, 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 246fa9f6-0c73-44e2-b56d-b8d54b693f72

📥 Commits

Reviewing files that changed from the base of the PR and between cd097f5 and 2260dba.

📒 Files selected for processing (6)
  • server/api/activity.ts
  • server/hooks/panda.ts
  • server/test/hooks/panda.test.ts
  • server/test/utils/panda.test.ts
  • server/utils/panda.ts
  • server/workers/hook/worker.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The change preserves unknown Panda decline reasons, filters requested bodies by declined status, reports unmatched created-action reasons to Sentry, updates activity and worker handling, and adds a patch changeset for @exactly/server.

Changes

Panda decline reason handling

Layer / File(s) Summary
Decline reason normalization
server/utils/panda.ts, server/test/utils/panda.test.ts
decline classifies known reasons, preserves unmatched reasons, and reports match status. requestedDeclineReason extracts the latest declined requested reason from validated payloads.
Webhook and activity propagation
server/hooks/panda.ts, server/api/activity.ts, server/test/hooks/panda.test.ts, server/test/api/activity.test.ts, .changeset/many-steaks-slide.md
The webhook preserves unknown provider reasons, reports unmatched created-action reasons to Sentry, and uses generic text for unknown local requested reasons. Activity selects the latest declined operation and preserves valid requested reasons. A patch release is declared for @exactly/server.
Declined webhook worker handling
server/workers/hook/worker.ts, server/test/workers/hook.test.ts
The worker considers only requested bodies with status: "declined". Unmatched stored reasons fall back to "webhook declined".

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: 🔵 Low · up to 2260d

The PR exposes normalized or preserved provider decline reasons in authenticated activity responses. It is mergeable with owner awareness because provider-originated text now has broader user-visible semantics and validation coverage is not complete across all consumers; authentication and account-data scoping are unchanged.

Sequence Diagram(s)

sequenceDiagram
  participant PandaWebhook
  participant decline
  participant Sentry
  participant HookWorker
  participant PandaActivity
  PandaWebhook->>decline: resolve raw decline reason
  decline-->>PandaWebhook: mapped message or raw reason
  PandaWebhook->>Sentry: capture unmatched created-action reason
  PandaWebhook->>HookWorker: store declined webhook payload
  HookWorker->>decline: check stored reason match
  HookWorker->>PandaActivity: deliver declined reason
Loading
🚥 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 and concisely describes the main change: exposing unknown decline reasons in the server.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch unknown-reasons
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch unknown-reasons

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.

@aguxez
aguxez marked this pull request as ready for review August 31, 2026 22:47

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

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/hooks/panda.ts Outdated
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.24390% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.64%. Comparing base (f76c1f1) to head (2260dba).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
server/api/activity.ts 78.57% 0 Missing and 3 partials ⚠️
server/hooks/panda.ts 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1275      +/-   ##
==========================================
+ Coverage   72.51%   73.64%   +1.12%     
==========================================
  Files         275      276       +1     
  Lines       13254    13464     +210     
  Branches     4610     4751     +141     
==========================================
+ Hits         9611     9915     +304     
+ Misses       3306     3220      -86     
+ Partials      337      329       -8     
Flag Coverage Δ
e2e 72.89% <78.04%> (+0.38%) ⬆️

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.

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

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/utils/panda.ts Outdated
Comment thread server/utils/panda.ts Outdated
Comment thread server/hooks/panda.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: ac5a21acae

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/hooks/panda.ts Outdated
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