fix(network): product-truth rollback detector instead of kernel-port probing - #815
Merged
Merged
Conversation
…he kernel namespace The wildcard-gone detector plain-bound 127.0.0.2:port and treated ANY failure as 'the 0.0.0.0 listener survived (no rollback)' — Env-classified with five fresh-port retries. Under the full parallel suite the kernel reassigns the just-released port to sibling tests' wildcard listeners often enough to burn all five attempts (the 2026-09-19 base gate, 5/5, while the same test passed isolated 15/15 and under partial load): the probe conflated OUR listener with anyone's on that port number. The controller now records its CURRENT listener's bound address (current_bind_addr: written under the same lock scope as the listener swap, after the new bind AND after the previous accept loop's close barrier), and the detector asserts that address is loopback:port — an in-memory product-truth read with zero environmental exposure. A REAL rollback regression fails it deterministically, so the check upgrades from Env (retried) to Product (fail-fast); the serving probe (a real connect to our own listener) stays Env for the documented WSL2 transient. Mutation-checked: skipping the rollback rebind trips the new Product assertion; restored, the full freshell-server suite is green (1007/1007), fmt+clippy clean.
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.
What
Fixes the fourth base-gate flake (gate at 8255c0f, rust phase):
network::tests::configure_rolls_back_the_listener_when_persist_failsburned all five of its environmental retries with "listener left on 0.0.0.0 after failed persist (no rollback), or a transient detector-bind artifact" — 5/5 identical, while passing isolated 15/15, full-binary 3/3, and under freshell-ws load 0/6.Root cause
The wildcard-gone detector plain-bound
127.0.0.2:portand treated ANY failure as "the 0.0.0.0 listener survived." But the probe conflates OUR listener with anyone's on that port number: under the full parallel suite, the kernel reassigns the just-released port to sibling tests' wildcard listeners often enough that every retry attempt loses the lottery. The product's rollback itself is airtight (the handler awaitsserve_on, which awaits the old accept loop's close barrier before replying).Fix
RebindControllernow records its current listener's bound address (written under the same lock scope as the listener swap, after the new bind and the old close barrier), and the detector asserts that address is127.0.0.1:port— an in-memory product-truth read with zero environmental exposure. A real rollback regression fails it deterministically, so the check upgrades from Env (retried) to Product (fail-fast). The serving probe (real connect to our own listener) stays Env for the documented WSL2 transient.Mutation-checked: skipping the rollback rebind trips the new Product assertion. Full freshell-server suite 1007/1007 green; workspace clippy
-D warningsclean; fmt clean.Note
This intentionally touches production Rust (net_bind.rs) — rust-gate runs the full workspace suite.