wzcheng99 dbe0f57b9c T4a-2 follow-up: pin test for 3s write deadline invariant
Adds TestExecutor_Ship_WriteDeadline_Fires — explicit regression fence
for INV-REPL-SHIP-TRANSPORT-MUSCLE-001 component (3). Requested by
QA at T4a-2 validation: three of four composite properties (lazy dial,
silent drop, no-hard-stop) had explicit pin tests; the 3s deadline
had only implicit coverage. Without this pin, a future refactor could
silently drop SetWriteDeadline and the only observable signal would
be primary-write wedge on a slow replica in m01 / production
(~120s TCP retransmission timeout instead of ~3s).

Implementation: net.Pipe() — synchronous in-memory connected pair
with zero internal buffering and SetWriteDeadline support. Bypasses
kernel TCP buffers, which on Windows/Linux loopback can absorb 16+
MiB before blocking and make TCP-based timing tests fundamentally
unreliable. Earlier iterations with 8 MiB TCP payloads + SO_SNDBUF=2K
completed in 2-3 ms on Windows (auto-tuning absorbed everything).

The test asserts:
  1. Ship returns an error (not nil)
  2. Elapsed >= 2.5s (proof: the write actually wedged for most of
     the 3s deadline — if it returned faster, it wasn't the deadline
     that unblocked it)
  3. Elapsed <= 10s (proof: no hang on TCP retransmit path)
  4. Error chain contains Timeout() == true OR "write failed"

Passes in 3.00s exactly on Windows loopback — the deadline IS the
unblocking mechanism.

Required test-list alignment with mini-plan line 390 now complete
(LazyDial_HappyPath ≡ LazyDial_OnRegisteredSessionWithoutConn;
LazyDial_DialFailure_ReturnsError ✓; StaleEpoch_SilentDrop ✓;
WriteDeadline_Fires ✓).

Full core/transport suite: 8 Ship tests + all pre-existing transport
tests green. G-3 preserved.
2026-04-23 14:36:31 -07:00
Languages
Go 84.7%
Rust 7.7%
Shell 2.7%
templ 1.5%
Java 1%
Other 2.1%