Retry SDK indexing on transient timeout before failing#2720
Retry SDK indexing on transient timeout before failing#2720thedavidmeister wants to merge 4 commits into
Conversation
Fixes #2327. Timed-out indexing promises (deposit / withdraw / order txs) surfaced as a hard failure on the very first timeout, even though the timeout is transient (the subgraph just hasn't indexed the tx yet). createSdkIndexingFn now retries the SDK call up to DEFAULT_MAX_RETRIES (3) total attempts on a timeout result, with the existing retry() backoff, before marking the transaction failed. Only timeouts are retried: a successful result, a non-timeout hard error, and a rejection thrown by the SDK call itself are all surfaced after a single attempt (unchanged behavior). Adds a retry() util to ui-components mirroring the webapp one, since TransactionManager lives in ui-components and cannot import from webapp (webapp depends on ui-components, not the reverse). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 37 minutes and 10 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
To be clear on disposition: this PR is not being discarded — the retry/backoff mechanic and its tests are sound. It's blocked by #2327, which has been re-scoped to add a typed timeout discriminant ( The only part of this PR that changes once #2327 lands is the detection: |
Depends on #2327.
Problem
Timed-out indexing promises for deposit / withdraw / order transactions surfaced as a hard failure on the very first timeout, even though the timeout is transient (the subgraph just hasn't indexed the tx yet). This produced spurious "failed" toasts for transactions that actually succeeded on-chain.
Change (TS / ui-components only)
createSdkIndexingFninpackages/ui-components/src/lib/providers/transactions/TransactionManager.tsnow retries the SDK indexing call up toDEFAULT_MAX_RETRIES(3) total attempts on a timeout result, using the existingretry()backoff, before marking the transaction failed withSUBGRAPH_TIMEOUT_ERROR. This covers every flow routed throughcreateSdkIndexingFn: deposit, withdraw, vaults-withdraw-all, add-order, remove-order, and take-order.Only timeouts are retried. A successful result, a non-timeout hard error result, and a rejection thrown by the SDK call itself are all surfaced after a single attempt (unchanged fail-fast behavior).
A
retry()util (mirroring the one inpackages/webapp/src/lib/retry.ts) is added to ui-components becauseTransactionManagerlives in ui-components and cannot import from webapp (webapp depends on ui-components, not the reverse).Tests (all discriminating — verified to fail against the pre-change code)
New
createSdkIndexingFn > timeout retry behaviorblock plus updated existing timeout tests:SUBGRAPH_TIMEOUT_ERROR+onError(catches no-retry: 1 call).SUCCESS+onSuccess, no error state) when a retry after a timeout returns valid data (catches no-retry: fails on first timeout).should handle SDK timeout error in awaitIndexingFntests (remove-order, deposit) were updated to a persistent-timeout mock +toHaveBeenCalledTimes(3), reflecting the new retry behavior.Reverting only the source change makes exactly these 4 retry assertions fail, confirming they discriminate.
Verification
TransactionManager.test.ts: 55/55 pass (39ms under fake timers, no real backoff waits).@rainlanguage/ui-componentssuite: 634 tests pass / 100 test files pass. The 2 failing test files (CodeMirrorDotrain.test.ts,License.test.ts) are pre-existing, environment-caused (Failed to resolve entry for package "@rainlanguage/ui-components"— the package self-entry is built by CI'snpm run build -w @rainlanguage/ui-components); confirmed identical on cleanmainwith my changes stashed.prettier --list-different+eslint): clean. Prettier format: no changes.🤖 Generated with Claude Code