🥅 server: skip retries for replay reverts#758
Conversation
🦋 Changeset detectedLatest commit: 03fdfa3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
WalkthroughAdds a changeset and implements Replay-specific short-circuit handling in panda server hooks: Replay revert errors are detected in multiple catch blocks, the active tracing span is marked, and the handler returns success to skip retry logic; tests for these replay scenarios are added. Changes
Sequence Diagram(s)mermaid Client->>Server: POST transaction payload Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 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. Comment |
Summary of ChangesHello @nfmelendez, 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 robustness by intelligently handling 'Replay' errors that can occur during contract interactions. By specifically identifying and acknowledging these errors with an 'ok' response, the system avoids redundant retries and reduces noise in error monitoring, leading to more efficient and stable operation. The changes also improve observability by adding relevant tracing attributes for these specific error scenarios. Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request correctly handles Replay errors from contract interactions by returning a 200 OK status, preventing webhook retries for both collection and refund flows. The changes are well-tested. While there is some duplicated error-handling logic, we will defer abstraction for now to avoid premature optimization, as per repository guidelines. A security audit has commenced, with the scope defined and SAST Reconnaissance tasks identified for the relevant files.
|
@coderabbitai review |
|
@cursor review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@server/hooks/panda.ts`:
- Around line 732-739: Extract a small predicate function (e.g.,
isReplay(error)) that returns true when error is an instance of BaseError with
error.cause an instance of ContractFunctionRevertedError and
error.cause.data?.errorName === "Replay"; then replace the duplicated inline
checks in both catch sites (the blocks using the same condition) with calls to
isReplay(error), remove the redundant re-setting of the "panda.transaction" span
attribute (leave only the existing span attribute set earlier), and in the catch
blocks only set/getActiveSpan()?.setAttributes({ "panda.replay": true }) and
return c.json({ code: "ok" }) when isReplay(error) is true.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #758 +/- ##
==========================================
+ Coverage 67.67% 67.73% +0.06%
==========================================
Files 206 206
Lines 6932 6940 +8
Branches 2171 2175 +4
==========================================
+ Hits 4691 4701 +10
+ Misses 2052 2049 -3
- Partials 189 190 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit
Bug Fixes
Tests