Repository navigation
serve: wait for the HTTP reset before advancing the gone-client test - #751
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: The test waits for reset detection before advancing the engine and still requires cancellation at the next event.
Checked
Duplicates: 0 new functions, types or constants; existing wait and answer-count owners reused. Dryer reported 0 pairs.
Complexity: Crapper flagged no functions. The changed test removes a loop and branches.
Silent failure: 0 new sites. Both waits fail with named assertions; the permit send fails explicitly.
Tests: Source mutation check: replace the probe at crates/serve/src/api.rs:3281 with Ok(()); the reset wait asserts. Ignore the send error at crates/serve/src/worker.rs:461; the slot-release wait asserts. The PR reports the first mutant failing and all 8 module tests passing.
Gates: The engine-call bound changes from <= 8 to == 1, with a dated PIN and reason. The PR supplies an injected scheduling delay that fails the old test and passes the revised test.
Adversarial checks: The first blocked engine call proves the answer guard is active. Zero answers follows receiver destruction. The HTTP receive timeout permits reset detection while the engine is blocked. Snapshot sealing adds no counted call because this engine keeps the default synchronous snapshot policy.
Escape catalog: No patterns match. No production hot path changes.
Notes
Tests were reviewed statically and were not run locally.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
닫힌 클라이언트 시험이 HTTP 처리기의 reset 감지를 기다린 뒤 엔진을 한 번만 진행하도록 고칩니다.
What and why
a_whole_answer_whose_client_closed_ends_at_the_next_event(crates/serve/src/api.rs) resets the client's socket and then checks that the slot frees at the next engine event. The old test judged that by counting engine calls. After the reset it released the engine's gate once per step, up to 24 times, until the slot freed, and then required at most 8 calls. The reset is seen by the HTTP handler thread, which runs on its own schedule. If that thread is slow to get the CPU, the engine takes more steps first, and the test reads the scheduling gap as slow cancellation in the product.The test now waits for
state.shared.answers.in_flight() == 0, which is true once the HTTP handler has observed the reset and finished. Only then does it release the engine's gate once, wait for the slot to free, and assert exactly one engine call. This is stricter than the old<= 8bound, so the next-event cancellation contract is not weakened. The wait reusesgone_client::wait_forand its 10 second limit. The change adds no helper, no sleep and no product hook, and removes theSTEPSconstant. Product code is unchanged.The change is one test function, 7 lines added and 19 removed. The assertion carries a dated
PINwith its reason, since the bound moved. Open PR #747 also editscrates/serve/src/api.rs, but not this test.Release notes: internal: The gone-client serve test waits for the HTTP handler to see the reset before it advances the engine.
What I ran
Linux x86_64, rustc
1.100.0-nightly (e457a7b0d 2026-08-27), this change on main2a7005b8. The test is CPU only and uses no model or GPU, so there is no device path to measure. Each repeated run used the test binary built withcargo test -p bloomery-serve --lib --no-run, pinned withtasksetand run with--exact api::tests::gone_client::a_whole_answer_whose_client_closed_ends_at_the_next_event --test-threads=4.BASELINE failures=0). I could not reproduce the flake by repetition on this host.the slot still runs the request of a closed client after 24 steps(test result: FAILED. 0 passed; 1 failed).PROBE delayed cpus=0 rc=0,PROBE delayed cpus=0,1 rc=0).SUMMARY cores=1 cpus=0 passed=30 failed=0. Two cores:SUMMARY cores=2 cpus=0,1 passed=30 failed=0.gone_clientmodule on the fixed head:test result: ok. 8 passed; 0 failed.Client::checkcall toprobe_clientreplaced byOk(()), the fixed test fails after its 10 second limit withtimed out waiting for the HTTP handler to observe the reset(test result: FAILED. 0 passed; 1 failed). The source was restored byte for byte afterwards.git diff --checkis clean. I did not run fmt or clippy in this round.What I ran into
None of this blocks the PR. The 250 ms delay is an injected schedule. I could not reproduce the original flake without it, so I make no claim about its natural frequency. The two delay runs and the product-check removal were temporary local changes that are not part of the commit.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.