Repository navigation
fix(e2e): advance voucher watermark across ClientFixture::fetch retries (#1062) - #1125
Conversation
…es (#1062) ClientFixture::fetch retried stream_fetch in a loop while reusing one immutable ChannelContext pinned at prior_nonce/bytes/amount = ZERO. Once the node's chain watcher had observed the channel, an attempt that consumed a voucher then failed mid-stream advanced the node's last_nonce, so every subsequent retry replayed nonce 0 and was rejected (StaleNonce / BytesRegression) until the 45s deadline expired. Swap stream_fetch -> stream_fetch_tracked with a per-attempt &mut VoucherProgress, and fold progress.acked() back into a now-mutable ctx in the retry arm. This mirrors the production watermark-advance idiom (persist_buyer_progress in node_origin.rs, the CLI in fetch.rs, and the client_reused_channel_resumes integration test). When nothing was acked (the common pre-observation failure) acked() is None and ctx stays at zero, preserving existing behavior for a never-observed channel. Verified: cargo build + clippy clean; the full anvil-e2e suite (7 tests, including smoke_compose_fixtures which drives ClientFixture::fetch) passes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Warning Review limit reached
Next review available in: 31 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?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 reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. 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, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (1)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Gas snapshotNo gas changes vs base. |
Contracts coverageLine coverage: 88.71% (2452/2764 lines) |
There was a problem hiding this comment.
Code Review
This pull request updates the end-to-end client fixture to use stream_fetch_tracked instead of stream_fetch. This allows tracking the acked voucher watermark via VoucherProgress on failures, updating the ChannelContext with the advanced nonce, bytes delivered, and amount before retrying. This prevents replaying stale nonces after mid-stream failures. No review comments were provided, so there is no feedback to address.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Coverage reportTotal: 80.31% (was 80.34%, ▼ 0.03%) — 44803/55788 lines
History
|
…eadline Follow-up to the retry review on #1062. The retry guard (`Err(e) if now < deadline`) retried EVERY error as if it were the transient watcher-catch-up condition, so a deterministic failure — corrupt delivery (HashMismatch), a buyer-side size-cap rejection (BlobTooLargeClaim), or a terminal voucher desync (UpstreamVoucherRejected, e.g. a stale nonce from one-sided ack loss, deposit exhaustion, an expired channel) — spun ~90 times over the full 45s budget and then surfaced as "paid fetch failed", misframing corruption/desync as a readiness timeout. Add an is_retryable() classifier and gate the retry arm on it. Only the transient conditions the loop exists to wait out stay retryable: the node's up-front "delivery refused: UnknownChannel" pre-observation refusal (a plain string error, not a typed sentinel), transport errors, a per-attempt PullTimeout, and the node's explicit RetryLater resend signal. Every typed terminal error now returns its real cause immediately. This also tightens the one-sided-ack-loss residual noted in the review: a replayed stale nonce now fails fast rather than spinning to the deadline. Verified: cargo build + clippy clean; full anvil-e2e suite (7 tests) passes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The `matches!` on the voucher-reject reason exceeded the 100-col limit; rustfmt wraps it. Fixes the rustfmt CI job on #1125. Co-Authored-By: Claude Opus 4.8 <[email protected]>
altanoruc
left a comment
There was a problem hiding this comment.
One issue in the new fail-fast classifier: stream_fetch_tracked currently erases every initial delivery-side StreamError into a plain anyhow string at bail!("delivery refused: {:?}", resp.error), while is_retryable defaults all untyped errors to true. That means terminal wire refusals such as BlobTooLarge, InternalError, and EvictedSinceProbe still retry for the full 45s budget, despite the comment saying only watcher catch-up/transport/timeout/RetryLater are retryable.
Could we preserve the refusal as a typed error (carrying the StreamError) and classify it here? NotFound will necessarily remain retryable because UnknownChannel is intentionally wire-indistinguishable from cache miss and several other cases, but the distinct terminal variants can fail fast as intended.
What
Closes #1062.
The e2e
ClientFixture::fetchretriesstream_fetchin a loop (to wait out the node's chain-watcher catch-up) while reusing one immutableChannelContextpinned atprior_nonce = prior_bytes_delivered = prior_amount = ZERO. Once the node has observed the channel, an attempt that consumes a voucher then fails mid-stream advances the node'slast_nonce; every subsequent retry then replays nonce 0 and is rejected (StaleNonce/BytesRegression) until the 45s deadline expires.Fix
Swap
stream_fetch→stream_fetch_trackedwith a per-attempt&mut VoucherProgress, and foldprogress.acked()back into a now-mutablectxin the retry arm. This mirrors the production watermark-advance idiom already used bypersist_buyer_progress(node_origin.rs), the CLIfetch.rs, and theclient_reused_channel_resumesintegration test — the fixture's "store" is just its in-memoryctx.When nothing was acked (the common pre-observation failure),
acked()returnsNoneandctxstays at zero, preserving today's correct behavior for a never-observed channel.Chose advancing the context over the issue's alternative (re-open a fresh channel per attempt), which would cost an
openChanneltx per retry, leave dangling channels, and changechannel_idbetween attempts (breaking the deterministicFetchOutcome.channel_id).Notes for reviewers
VoucherProgressinclient-pull/src/lib.rs; not something this fixture change closes.Verification
cargo build -p decdn-e2e— cleancargo clippy -p decdn-e2e --all-targets -- -D warnings— cleancargo nextest run -p decdn-e2e --features anvil-e2e --no-fail-fast— 7/7 passed, includingsmoke_compose_fixtureswhich drivesClientFixture::fetch🤖 Generated with Claude Code