Skip to content

test: make three load-sensitive tests model the node and planner exactly - #2726

Merged
thiras merged 1 commit into
mainfrom
fix/2663-2723-test-model-flakes
Oct 28, 2026
Merged

thiras merged 1 commit into
mainfrom
fix/2663-2723-test-model-flakes

Conversation

@thiras

@thiras thiras commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

What

Three tests failed under load because they modelled the product wrongly. The node and the planner are correct, so this PR changes tests only.

Closes #2663
Closes #2723

cli_bundle_pull_stripes_a_complement_across_two_holders (#2663)

The fixture put the donor a on both holders. Its comment said a "stays below the multi-source floor", but there is no such floor. split_evenly (crates/client/src/segment.rs) splits a run across every holder that covers it, and that is by design. When both lane builds land in one batch (spare = lanes − seeds = 1), a is split at group 63. The second piece sends its left-boundary proof path again: 7 parent hashes × 64 B = 448 B. The numbers in the issue match exactly. The lanes billed 1,036,288 + 1,010,200 for a's two pieces, which is wire_a (2,046,040) + 448. The rest is 209,112 + 226,788 = b's complement (435,900). In that case the more > wire_a check and the opens check fail as well.

The fix: only holder_x holds a, and holder_y holds b only. The pull also runs with --proxy-warming false, so holder_y cannot join a as a warming proxy. a now has one lane and pulls whole. b's complement still stripes across both holders. The exact-billing and opens assertions are unchanged. The per-holder check now names its holders (billed_y > 0 && billed_x > wire_a), because the fixture makes it known which holder served a. The wire_complement < wire_a guard only existed to tell the max/min apart, so it is removed.

over_cap_stream_is_reset_without_signing_a_response (#2723)

write_frame sends the length prefix and the payload as two separate write_all calls. The node sheds an over-cap stream before it reads anything, with STOP_SENDING APP_ERR_RATE_LIMITED (0x10). That stop can arrive between the two writes. The test now builds prefix + payload with support::frame_len_prefix and sends them in one write_all, as the sibling tests do. It also accepts WriteError::Stopped(0x10) as the expected signal and fails on any other write error. The recv2 reset and metrics assertions are unchanged.

over_cap_stream_is_reset_before_its_request_is_read read stream_cap_full once, right after the reset. The serve task records that counter only after the client has seen the reset. The test now calls support::assert_inbound_failures_attributed(&metrics, 1) first, the settle pattern from #2716. (wait_for_metric_line was removed in #2716 before it merged.)

throwaway_open_torn_down_before_real_open_still_serves (#2723)

The <= 2 bound counted every ranged GET, including the serviceability probe (bytes=0-16383). One probe plus the cancelled draw plus the re-draw is 3. The test now counts the probe separately (probe_range_val), as #2311 did for the sibling test. It asserts probes <= 1, which holds because of the range-confirmed latch, and draws <= 2. It does not require the re-draw to start at byte 0.

Reviewer notes

Verification

  • Write race, shown red: I put the old two-write form back with a 50 ms sleep between the prefix and the payload. It failed every time with write second request: sending stopped by peer: error 16. The same split write with the delay passes once it goes through the new Stopped(0x10) arm. The final form uses one write.
  • Throwaway, shown red: I ran the old test 15 times with 24 busy-loop CPU hogs on a 16-core machine. It failed once, with a torn-down throwaway costs at most one duplicate draw, saw 3. An instrumented run of the new version counted probes=1 draws=1 in a normal pass, so a 3 is 1 probe + 2 draws.
  • e2e: bundle striping over-bills 448 wire bytes under parallel load #2663: this flake happens about 1 run in 13, so I did not try to reproduce it. The cause above comes from the request counts in the issue.
  • cargo nextest run -p decdn-node --test origin_range_pull, 15 times under the same CPU load: 15/15 passed, 25 tests each run.
  • cargo nextest run -p decdn-node --test client_loopback -E 'test(over_cap)', 15 times under load: 15/15 passed, 2 tests each run.
  • cargo nextest run -p decdn-e2e --features anvil-e2e --retries 0 -E 'binary(cli_bundle_pull_range_dedup)', 15 times, after cargo build -p decdn-cli -p decdn-node: the striping test passed 15/15. Other failures were client: the self-heal re-drive of a bundle head leaves about 2 MiB delivered but unpaid #2722 (twice) and one metrics-port bind collision (Address already in use) in the untouched cli_bundle_pull_pays_exactly_a_scattered_complement.
  • cargo clippy --workspace --all-targets --all-features -- -D warnings: exit 0. cargo fmt -- --check: exit 0. The pre-commit hooks passed.

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings October 28, 2026 20:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

main f2bc01c fix/2663-2723-test-m... e43ff80 +/-
77% 77% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

cli_bundle_pull_stripes_a_complement_across_two_holders seeded the donor
`a` on both holders and claimed `a` stays below a multi-source floor. No
such floor exists: split_evenly splits a run across every holder that
covers it. When both lane builds land in one batch, `a` splits at group
63, and the second piece re-sends seven bao parent hashes (448 B), so the
exact billing, the per-holder split and the open count all fail. Only
holder_x now holds `a`, and the pull runs with proxy warming off, so `a`
has one lane and pulls whole. `b`'s complement still stripes across both.

over_cap_stream_is_reset_without_signing_a_response wrote stream 2's
request with write_frame, which writes the prefix and the payload
separately. The node sheds an over-cap stream before it reads anything,
so its STOP_SENDING (RATE_LIMITED) can land between the two writes. The
frame now goes out in one write, and a Stopped(RATE_LIMITED) write error
counts as the expected signal. The sibling
over_cap_stream_is_reset_before_its_request_is_read now settles the
inbound-failure counters before it reads stream_cap_full.

throwaway_open_torn_down_before_real_open_still_serves bounded every
ranged GET at 2, which counts the serviceability probe. One probe plus
the cancelled draw and its re-draw is 3. The test now counts the probe
apart (at most 1, the range-confirmed latch) and the draws (at most 2).

Closes #2663
Closes #2723

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@thiras
thiras force-pushed the fix/2663-2723-test-model-flakes branch from e43ff80 to 690346a Compare October 28, 2026 22:35
@thiras
thiras merged commit fe65325 into main Oct 28, 2026
9 checks passed
@thiras
thiras deleted the fix/2663-2723-test-model-flakes branch October 28, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants