You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[soundness] hy-check(channel_liveness): use-after-close, double-close, use-after-drain, and double-drain bypass linear SPSC channel typestate lifecycle invariants (#4200 regression) #4346
In compiler/crates/hy-check/src/channel_liveness.rs, SPSC channel capabilities (hy.send_cap[T], hy.recv_cap[T]) maintain a ChannelTypestate enum (Fresh, Active, Closed, Drained, Moved). However, transitions from terminal states (Closed and Drained) are entirely unverified in operation check-sites:
Use-After-Close (Method Send): Calling tx.send(val) after tx.close() is silently accepted. In Go/Hybrid runtime semantics, sending on a closed channel produces a fatal runtime panic (panic: send on closed channel).
Use-After-Close (Statement Send): tx <- val and select { case tx <- val: } check only is_moved(&cap), ignoring tx_state == ChannelTypestate::Closed. They silently accept sending on a closed capability.
Double-Close: Calling tx.close() a second time on an already closed send capability is silently accepted. In Go/Hybrid runtime semantics, closing an already closed channel produces a fatal runtime panic (panic: close of closed channel).
Use-After-Drain (Method Recv): Calling rx.recv() after rx.drain() is silently accepted.
Use-After-Drain (Expression Receive): <-rx and select { case <-rx: } check only is_moved(&cap), ignoring rx_state == ChannelTypestate::Drained. They silently accept receiving from a drained capability.
Double-Drain: Calling rx.drain() a second time on an already drained receive capability is silently accepted.
This directly violates GUARANTEES.md Row 13 ("Concurrency and Sendability") and SPEC §10 (Track W-026, #4200), which requires static typestate enforcement preventing runtime channel lifecycle panics.
Target Commit
Commit 7cf29833 (upstream/main, Session 183).
Minimal Repro 1: Send After Close (tx.close() then tx.send())
Activity
fix(hy-check): enforce typestate preconditions for close, drain, send…
fix(hy-check): enforce typestate preconditions for close, drain, send…
fix(hy-check): enforce typestate preconditions for close, drain, send…
fix(hy-check): enforce typestate preconditions for close, drain, send…
fix(hy-check): enforce typestate preconditions for close, drain, send…
fix(hy-check): enforce typestate preconditions for close, drain, send…