Repository navigation
test(node): settle the inbound-stream counters before one-shot metrics reads - #2716
Merged
Merged
Conversation
…k test The test read the encoded metrics as soon as the client saw the second refusal, but the server records the pool_closing reset reason when its serve_stream task ends, after the response is on the wire (dispatch.rs ServeEnd::meter). On a loaded runner the client wins that race and reads 1. Adds a bounded wait_for_metric_line helper to tests/support (same deadline/sleep pattern as assert_inbound_failures_attributed) and uses it for the final counter assertion. The behavior under test is unchanged. Closes #2682 Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
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.
…ck tests the_timestamp_gate_precedes_every_signed_refusal and stream_request_with_skewed_timestamp_resets_without_response read the encoded metrics once, right after the client saw the reset or refusal. The serve task meters a stream's end after the response is on the wire, so the same race as the closing-pool test applies. Both now poll each counter line with support::wait_for_metric_line. Closes #2713 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 5 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
…c1737 # Conflicts: # crates/node/tests/client_loopback.rs
…metrics read The serve task meters a stream's reason and its completed/failed count after the client has seen the stream end, so a metrics read taken right after a refusal or delivery can see a counter one short. Polling one line for an exact value hid that but could stop on a passing value an over-count goes through, and split checks that belong to one snapshot. Every client_loopback read of a counter the serve task bumps now first waits on support::assert_inbound_failures_attributed (refusals and resets) or the new support::assert_inbound_streams_ended (completed deliveries), then reads the metrics once with the original assertions. wait_for_metric_line is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
thiras
approved these changes
Oct 28, 2026
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
client_loopback tests read the encoded metrics once, as soon as the client saw the server's refusal, reset or last byte. The server meters the stream's reason, and then its completed/failed count, when its serve_stream task ends, after the client already has the reply (dispatch.rs, ServeEnd::meter then inbound_stream_ended). On a loaded runner the client wins that race and reads a counter one short.
Every read of a counter the serve task bumps now waits for the stream counts first, then reads the metrics once with the original assertions and messages:
support::assert_inbound_failures_attributed(&metrics, N), which also fails if the reason counters do not claim each failure exactly once (so an over-count times out instead of passing on its way up);support::assert_inbound_streams_ended(&metrics, completed, failed)with the same deadline/sleep pattern.28 call sites across 27 tests, including
a_closing_pool_is_unfunded_to_its_lane_and_not_found_to_anyone_else(#2682),the_timestamp_gate_precedes_every_signed_refusalandstream_request_with_skewed_timestamp_resets_without_response(#2713). Left unchanged: reads of counters bumped before the reply goes out (idle close, serve cache hit) and… 0reads, which cannot flake. The behavior under test is unchanged.Verified: client_loopback 5× plus 2× at
--test-threads 64, all 173 pass; raising one N by one times out with the metrics dump.Closes #2682
Closes #2713
🤖 Generated with Claude Code