Skip to content

fix(network): product-truth rollback detector instead of kernel-port probing - #815

Merged
danshapiro merged 1 commit into
mainfrom
fix/network-rollback-detector
Sep 20, 2026
Merged

danshapiro merged 1 commit into
mainfrom
fix/network-rollback-detector

Conversation

@danshapiro

Copy link
Copy Markdown
Owner

What

Fixes the fourth base-gate flake (gate at 8255c0f, rust phase): network::tests::configure_rolls_back_the_listener_when_persist_fails burned 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:port and 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 awaits serve_on, which awaits the old accept loop's close barrier before replying).

Fix

RebindController now 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 is 127.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 warnings clean; fmt clean.

Note

This intentionally touches production Rust (net_bind.rs) — rust-gate runs the full workspace suite.

…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.
@danshapiro
danshapiro merged commit 8dea394 into main Sep 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant