You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
node: E2E test that concurrent same-hash window pull-through requests open ONE upstream pull (no double spend) #895
kind:testTest coverage, flakes, fixtures or the e2e harnessprio:lowWhen convenientrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Follow-up from the #893 review (implements #856). Test-coverage gap.
Gap
The cache-level coalescing primitive is unit-tested (crates/cache/src/engine.rstee_sink_coalesces_concurrent_fills), but the handler-side consequence has no end-to-end test: at crates/node/src/handlers/client.rs:898 a TeeOpen::InFlight must NOT open a second upstream pull — it waits via await_coalesced_fill, then serves-or-misses. This is the no-double-spend guarantee (#305) at the layer that actually spends real USDC.
Suggested test
Two concurrent leaf requests for the same uncached hash against node B (window provider attached):
assert a single upstream pull (via progress_log / upstream bytes ≈ one blob, not two),
assert both leaves are served (or the second cleanly serves from the coalesced fill).
Concurrency makes this harder to write deterministically (hence low priority), but it pins a correctness guarantee the unit test cannot.
This is a targeted test-coverage gap: the cache-level coalescing primitive has a unit test (tee_sink_coalesces_concurrent_fills in crates/cache/src/engine.rs), but there is no handler-level E2E test verifying that TeeOpen::InFlight at crates/node/src/handlers/client.rs:898 suppresses a second upstream pull. Since this path is where real USDC vouchers are emitted, the correctness guarantee (#305, now closed) is unverified at the layer that actually has economic consequences. The filer explicitly marks this low-priority due to concurrency determinism difficulty, and the description is self-contained with a clear test shape.
Scenario is clearly described, but the concurrency harness is non-trivial — a coding agent would need the existing E2E test infrastructure pattern (window provider setup, progress_log or upstream-bytes assertion hook) spelled out to avoid a flaky test.
Existing unit test to mirror: crates/cache/src/engine.rs → tee_sink_coalesces_concurrent_fills — use this for the coalescing assertion pattern.
Handler under test: crates/node/src/handlers/client.rs:898 — the TeeOpen::InFlight arm calls await_coalesced_fill; the test should verify this arm is hit for the second request, not a new try_pull_through.
Upstream-pull counting: the issue suggests using progress_log or comparing upstream bytes ≈ one blob. An alternative is a counter on the origin mock/stub — fire two concurrent requests, assert the origin was fetched exactly once.
Concurrency determinism suggestions:
Use a tokio::sync::Barrier to synchronize both request tasks so they arrive at the handler simultaneously (before the first fill completes).
Introduce a deliberate delay in the origin stub to widen the concurrency window and make the race reliably exercisable.
Assert both: upstream_fetch_count == 1 AND responses_served == 2 (or second cleanly serves from local blobs after coalesced fill).
Sub-task checklist:
Set up an in-process node B with a window provider (USDC channel stub) and a slow origin adapter.
Spawn two concurrent cdn/client/v1 requests for the same uncached hash.
Assert both requests receive the blob successfully (or second cleanly serves from completed fill).
Verify no double voucher emission on the upstream side.
Risk note: If this test is flaky due to scheduling, a tokio::test(flavor = "multi_thread") with explicit barriers is preferable to current_thread. The existing pattern in tee_sink_coalesces_concurrent_fills may already demonstrate the right approach.
kind:testTest coverage, flakes, fixtures or the e2e harnessprio:lowWhen convenientrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Activity
fix(node): address PR #893 review round 2 (deposit-guard doc, error s…
github-actions commentedon Jun 13, 2026
🎯 Triage report
This is a targeted test-coverage gap: the cache-level coalescing primitive has a unit test (
tee_sink_coalesces_concurrent_fillsincrates/cache/src/engine.rs), but there is no handler-level E2E test verifying thatTeeOpen::InFlightatcrates/node/src/handlers/client.rs:898suppresses a second upstream pull. Since this path is where real USDC vouchers are emitted, the correctness guarantee (#305, now closed) is unverified at the layer that actually has economic consequences. The filer explicitly marks this low-priority due to concurrency determinism difficulty, and the description is self-contained with a clear test shape.📊 Assessment
technical,rust,testing,low(all already applied)progress_logor upstream-bytes assertion hook) spelled out to avoid a flaky test.🔗 Similar issues
tee_sinkunit test was added, which is exactly the coverage gap this issue identifies.💡 Notes and suggestions
Where to look when implementing:
crates/cache/src/engine.rs→tee_sink_coalesces_concurrent_fills— use this for the coalescing assertion pattern.crates/node/src/handlers/client.rs:898— theTeeOpen::InFlightarm callsawait_coalesced_fill; the test should verify this arm is hit for the second request, not a newtry_pull_through.progress_logor comparing upstream bytes ≈ one blob. An alternative is a counter on the origin mock/stub — fire two concurrent requests, assert the origin was fetched exactly once.Concurrency determinism suggestions:
tokio::sync::Barrierto synchronize both request tasks so they arrive at the handler simultaneously (before the first fill completes).upstream_fetch_count == 1ANDresponses_served == 2(or second cleanly serves from local blobs after coalesced fill).Sub-task checklist:
cdn/client/v1requests for the same uncached hash.Risk note: If this test is flaky due to scheduling, a
tokio::test(flavor = "multi_thread")with explicit barriers is preferable tocurrent_thread. The existing pattern intee_sink_coalesces_concurrent_fillsmay already demonstrate the right approach.Add this agentic workflows to your repo
To install this agentic workflow, run
feat(node): window-paced pull-through for regional proxy warming (#856)…
test(node): pin no-double-spend coalescing for concurrent same-hash p…