fix(core): five sweep lows — seal-lane fallback, flush partial, codec echo, idle clamp, pair-name UTF-8
From the 2026-07-20 punktfunk-core quality sweep's adjudicated lows (~/punktfunk-sweeps/punktfunk-core-2026-07-20.json), each with a regression test: - session: the two-lane seal's dead-worker fallback dropped the frame's back half and returned Ok with half an access unit; the corpse lane was also never respawned. The send-failure arm now reclaims the tail (single-lane seals the WHOLE frame) and both failure arms drop the lane so the next large frame respawns it. A recv-side death now surfaces as an error instead of silent truncation. - reassemble: Reassembler::reset() left pending_partial parked, so a pre-flush stale partial survived Session::flush_backlog and was delivered as the first "frame" after a jump-to-live. - caps: resolve_codec echoed a non-conformant multi-bit preferred byte verbatim (downstream from_wire folds it to HEVC — possibly outside the shared set). It now isolates one bit of the intersection. - endpoint: stream_transport_idle only floored the value; an absurd operator-supplied idle timeout blew past QUIC's VarInt ms ceiling and panicked host startup through the expect. Clamped to 1s..1h. - pairing: PairRequest::encode cut the device name at a raw byte-64 boundary, splitting multi-byte UTF-8 (host showed U+FFFD forever); it now shares Hello's char-boundary truncate_to. The frozen-FEC-ceiling finding (reassemble.rs:109) was already fixed on main by the sweep's high-severity commit — skipped as stale. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,10 +26,12 @@ fn stream_transport() -> Arc<quinn::TransportConfig> {
|
||||
/// path is PINGed at least twice per window and a single lost PING (wifi roam / brief blip) won't
|
||||
/// false-close. `idle` is clamped to a ≥1s floor so a misconfigured tiny value can't tear live
|
||||
/// sessions down. Active sessions are unaffected either way: video keeps the connection live and
|
||||
/// the keep-alive holds it open through quiet control periods.
|
||||
/// the keep-alive holds it open through quiet control periods. Clamped to a 1 s..1 h window:
|
||||
/// the ceiling keeps an absurd operator-supplied value inside QUIC's VarInt millisecond range,
|
||||
/// so the conversion below genuinely cannot fail (it used to panic host startup instead).
|
||||
fn stream_transport_idle(idle: std::time::Duration) -> Arc<quinn::TransportConfig> {
|
||||
use std::time::Duration;
|
||||
let idle = idle.max(Duration::from_secs(1));
|
||||
let idle = idle.clamp(Duration::from_secs(1), Duration::from_secs(3600));
|
||||
let keep_alive = (idle / 2).min(Duration::from_secs(4));
|
||||
let mut t = quinn::TransportConfig::default();
|
||||
t.max_idle_timeout(Some(
|
||||
@@ -305,4 +307,13 @@ mod tests {
|
||||
assert_eq!(a, endpoint::cert_fingerprint(b"cert-a"));
|
||||
assert_ne!(a, endpoint::cert_fingerprint(b"cert-b"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn absurd_idle_timeout_is_clamped_not_a_panic() {
|
||||
// The conversion to quinn's IdleTimeout fails past the QUIC VarInt millisecond
|
||||
// ceiling — an operator-supplied huge PUNKTFUNK_IDLE_TIMEOUT_MS used to panic host
|
||||
// startup through the `expect`. Both extremes must construct.
|
||||
let _ = super::stream_transport_idle(std::time::Duration::MAX);
|
||||
let _ = super::stream_transport_idle(std::time::Duration::ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user