Skip to content

node: harden tests and telemetry around the mid-stream pool-solvency re-check #2630

Closed

Description

@yigitdot

Hardening and test follow-ups for the mid-stream pool-solvency re-check in the paid delivery loops. Line refs are against current main.

  • Loop-level solvency test for the serve-miss leg. drained_pool_stops_stream_after_its_floor_is_repaid (crates/node/tests/client_loopback.rs:6761) drives the cache-hit delivery loop (crates/node/src/handlers/client/delivery.rs:615). The mirror re-check in the serve-miss leg (crates/node/src/handlers/client/serve_leg.rs:659) has no loop-level PoolExhausted test. Both sites call the same unit-tested helper, pool_funds_committed (crates/node/src/handlers/client/mod.rs:2381). A test would pair the serve-miss fixtures with DrainingPoolView (crates/node/tests/client_loopback.rs:6533) and spawn_handler_server_with_draining_pool (crates/node/tests/client_loopback.rs:6561).
  • Observability of the mid-stream re-check.
    • When pool_view_status_cached (crates/node/src/handlers/client/mod.rs:1662) returns None, the re-check is skipped by design (fail-open; the on-chain redeem is the backstop), but nothing records the skip. Add a debug log or counter in that arm so an operator can tell "check passed" from "check did not run". Sites: delivery.rs:614, serve_leg.rs:658.
    • On the stop path, write_reject(...).await? (delivery.rs:617, serve_leg.rs:661) runs before the ServeEnd::Stopped return. If the client has already gone, the write error routes through log_stream_end (crates/node/src/handlers/client/dispatch.rs:284), so serve_stream_midstream_pool_exhausted (crates/node/src/handlers/client/outcome.rs:149) does not count the stop and its warn does not fire. Log and meter before the write.
  • (optional) Zero-rate edge. min_payment (crates/incentive/src/rate.rs:104) prices a floor at zero when rate_per_mb == 0, so admission (try_reserve_floor, crates/node/src/handlers/client/mod.rs:2403) and the direct-serve re-validation (crates/node/src/handlers/client/dispatch.rs:1422) pass at any remaining. Nothing billable is at stake at a zero rate, and the pool_funds_committed doc states the caveat. For uniformity, the re-validation could route through pool_funds_committed too.

Activity

  1. added
    kind:test
    prio:low
    area:node
    area:payments
    on Oct 26, 2026
  2. moved this from Backlog to In progress in deCDNon Oct 30, 2026
  3. moved this from In progress to Done in deCDNon Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:nodearea:paymentskind:testprio:low

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions