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
test(node): cover prefetch record_served through the live cdn/client/v1 serve loop #900
kind:testTest coverage, flakes, fixtures or the e2e harnessprio:lowWhen convenientrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Follow-up to #820 / PR #899 (live DHT prefetch acquisition). The demand-quality auto-throttle's served-bytes numerator is fed by PrefetchEngine::note_served_if_prefetched, called from the client serve path (crates/node/src/handlers/client.rs, in the accepted-voucher branch of collect_voucher).
Both halves of the credit contract are currently tested independently:
tag-on-acquire — the e2e prefetch_acquire_pulls_and_records_spend asserts engine.acquired().contains(...) after a prefetch pull;
tag → credit — the unit test note_served_credits_only_prefetched_hashes proves a tagged hash credits record_served and an untagged one does not.
What is not covered: an actual cdn/client/v1 serve of a prefetch-acquired blob driving note_served_if_prefetched from the live serve handler — i.e. the wiring through the real serve loop.
Scope
Add a test that, after a node prefetch-acquires a blob, performs a real paid client pull of that blob from the node and asserts the demand-quality ratio moved (i.e. record_served fired via the serve path). The node_origin_pull.rs / client_loopback.rs harnesses already have the paid-delivery machinery to build on.
Notes
Impact of the current gap is bounded to the demand-quality analytics input (throttle bias on a miss is the safe direction — toward more throttling), not payment or delivery correctness — hence it was deemed a non-blocking follow-up during the PR feat(node): wire live DHT prefetch acquisition + ledger feedback (#820) #899 review rather than a merge blocker.
Lower-priority adjacent coverage that could ride along: semaphore-saturation (prefetch_acquire_dropped_saturated), throttle/budget gate blocking a live acquisition, and the reused-channel per-pull spend delta value.
Follow-up to the now-closed #820 / PR #899, this task asks for an integration test that closes the untested wiring between the live cdn/client/v1 serve path and PrefetchEngine::note_served_if_prefetched. The two halves of the credit contract (tag-on-acquire and tag→credit) are unit-tested in isolation; what's missing is a test that drives the full loop end-to-end with real paid delivery. Scope is deliberately narrow and the impact of the gap is bounded to demand-quality analytics (throttle biases toward more throttling on miss, which is the safe direction).
📊 Assessment
Dimension
Value
Reasoning
Type
Task
Adding integration test coverage — not a bug or new feature
Test coverage task; explicitly marked non-blocking and lower priority in issue
Coding agent
Suitable
Clear requirements, well-scoped, references existing harnesses (node_origin_pull.rs, client_loopback.rs) with paid-delivery machinery already in place; success criterion is concrete (demand-quality ratio moves after a paid pull of a prefetch-acquired blob)
Build on the existing client_loopback.rs or node_origin_pull.rs test harness — both already have the paid-delivery setup needed.
Sequence: (a) start node, (b) trigger prefetch acquisition for a known blob (ensuring engine.acquired().contains(hash)), (c) perform a real cdn/client/v1 paid pull of that blob, (d) assert demand_quality_ratio or served-bytes counter incremented via PrefetchEngine public API.
The note_served_if_prefetched call is inside the accepted-voucher branch of collect_voucher in crates/node/src/handlers/client.rs — the test must go through the voucher acceptance path, not a bypass.
Optional adjacent coverage (noted in issue) that could ride along:
prefetch_acquire_dropped_saturated — semaphore saturation drop
Throttle/budget gate blocking a live acquisition
Reused-channel per-pull spend delta value
Key invariant to verify: if note_served_if_prefetched is never called (e.g., due to a future refactor moving the call site), the test should fail — so assert a concrete counter/ratio value rather than just "no panic".
kind:testTest coverage, flakes, fixtures or the e2e harnessprio:lowWhen convenientrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Activity
github-actions commentedon Jun 14, 2026
🎯 Triage report
Follow-up to the now-closed #820 / PR #899, this task asks for an integration test that closes the untested wiring between the live
cdn/client/v1serve path andPrefetchEngine::note_served_if_prefetched. The two halves of the credit contract (tag-on-acquire and tag→credit) are unit-tested in isolation; what's missing is a test that drives the full loop end-to-end with real paid delivery. Scope is deliberately narrow and the impact of the gap is bounded to demand-quality analytics (throttle biases toward more throttling on miss, which is the safe direction).📊 Assessment
testing,lowadded (kept existingtechnical,rust)node_origin_pull.rs,client_loopback.rs) with paid-delivery machinery already in place; success criterion is concrete (demand-quality ratio moves after a paid pull of a prefetch-acquired blob)🔗 Similar issues
💡 Notes and suggestions
Recommended approach:
client_loopback.rsornode_origin_pull.rstest harness — both already have the paid-delivery setup needed.engine.acquired().contains(hash)), (c) perform a realcdn/client/v1paid pull of that blob, (d) assertdemand_quality_ratioor served-bytes counter incremented viaPrefetchEnginepublic API.note_served_if_prefetchedcall is inside the accepted-voucher branch ofcollect_voucherincrates/node/src/handlers/client.rs— the test must go through the voucher acceptance path, not a bypass.Optional adjacent coverage (noted in issue) that could ride along:
prefetch_acquire_dropped_saturated— semaphore saturation dropKey invariant to verify: if
note_served_if_prefetchedis never called (e.g., due to a future refactor moving the call site), the test should fail — so assert a concrete counter/ratio value rather than just "no panic".Add this agentic workflows to your repo
To install this agentic workflow, run
test(node): cover prefetch record_served through the live cdn/client/…