SIGN IN SIGN UP

pbz: alive() was oscillating because readyState !== OPEN is three cases

The convergence pass cleared alive() by reasoning; an adversarial pass
measured it against real undici and convicted it. Both are partly right,
and the disagreement is the finding: readyState !== OPEN is not one
situation, it is three, and rounds 4 and 5 each fixed one and broke
another.

From CLOSED the close event has landed or is a tick away. From
CONNECTING the socket may still open normally — round 4 recorded the
death immediately and would have killed those permanently. From CLOSING
undici parks INDEFINITELY when a peer sends a close frame without a FIN:
measured, no event ever arrives, so round 5's "the close event is one
task away" is simply false there. The cost was not theoretical — a
parked waiter ran out its full timeout and resolved null, which callers
report as "the device may be slow" about a device that is gone, and
README states that distinction as a contract. A poller made it worse:
using() re-armed the idle backstop while undead, pushing the death out
forever.

The fixed point is neither branch: refuse the send, arm a short grace
timer, and let a real close or error win if one comes. A real event beats
it within a tick and keeps its code; nothing comes in the CLOSING case,
so the timer records an undetailed death that a late code can still
upgrade. The new test takes 30 SECONDS to fail against round 5's
behaviour, which is the defect measured rather than described.

It also recovered the five seconds round 5 claimed: those three tests
leaked idle timers precisely because nothing recorded a death. The
protocol file goes 6.2s -> 1.45s.

Also: defrag quoted the host and left the backup path bare in the same
sentence; pbz.mjs printed a bare host in pasteable advice; the
CONNECTING case claimed a socket was "no longer open" when it had never
opened; and a test comment claimed a per-chunk check guarded a live
hazard while the code called it forward-defence.

240 tests, typecheck green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZnUXRsLLnt2A7pR3X4Luj
T
Tarek Rached committed
70931e3da62a1512ae5689ad2b211b666473ca55
Parent: 098116d