From 36bb4caa3f8b60c06f3b89974c49def685a8f6c8 Mon Sep 17 00:00:00 2001 From: opencode controller Date: Sun, 28 Jun 2026 20:02:30 -0400 Subject: [PATCH] =?UTF-8?q?fix(slice-1):=20F6=20=E2=80=94=20drop=20dead=20?= =?UTF-8?q?Channel.created=5Fat=20field?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adversarial review F6 (Low, confirmed): Channel.created_at: Instant was drafted 'for the idle timeout' (spec §5.1) but the timer keys off RtcSession.last_rtp_rx (and now last_rtp_rx after F4), never creation time. The field was never read; the Instant import it pulled is dropped with it. Spec §5.1 already reconciled in 8680f2b (struct sketch + comment). Spec §4.5 already specified 'no RTP' (60 s); the contradiction with the old 5-min lineage is closed. Refactor phase — full test suite + clippy green; no behavior change. --- crates/rutster-call-model/src/lib.rs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/crates/rutster-call-model/src/lib.rs b/crates/rutster-call-model/src/lib.rs index 6770fd2..162fffc 100644 --- a/crates/rutster-call-model/src/lib.rs +++ b/crates/rutster-call-model/src/lib.rs @@ -59,7 +59,6 @@ mod tests { } } -use std::time::Instant; use uuid::Uuid; /// Newtype wrapping a `Uuid` for the channel id. @@ -133,25 +132,24 @@ pub enum Direction { /// The unifying leg object — one peer = one `Channel` (spec §5.1). /// -/// Slice 1 carries signaling state only. Fields that arrive later, listed -/// in spec §5.6, are absent by design — adding them is a backwards- -/// compatible field add: +/// Slice 1 carried signaling state only; slice-2 added `tap` (spec §5.2, §6). +/// Other fields arrive later, listed in spec §5.6, by backwards-compatible +/// addition: /// - `media: Option` — second consumer. /// - `audiohooks: Vec` — escalation rung 2. -/// - `tap: Option` — step 2. +/// +/// (F6 review patch: an earlier sketch carried `created_at: Instant` "for +/// the idle timeout," but the timer keys off `RtcSession.last_rtp_rx`, not +/// creation time. The field was dead; the work-pool would have populated +/// it on every `new_inbound` and never read it. Dropped along with its +/// `Instant` import.) #[derive(Debug)] pub struct Channel { pub id: ChannelId, pub state: ChannelState, pub direction: Direction, - /// For the 60 s idle timeout (spec §4.5). `Instant` is a monotonic - /// clock — choosing it over `SystemTime` means we're measuring - /// elapsed wall-time within this process, NOT a calendar time the - /// user could change mid-call. The monotonic clock is the right - /// tool for "has this peer been silent for 60 seconds?" - pub created_at: Instant, /// NEW (slice-2, spec §5.2, §6): None until Connected, set on Connected, - /// cleared on Closing. State invariant — see the table below. + /// cleared on Closing. State invariant — see the table in slice-2 spec §6. pub tap: Option, } @@ -162,7 +160,6 @@ impl Channel { id: ChannelId::new(), state: ChannelState::New, direction: Direction::Inbound, - created_at: Instant::now(), tap: None, } }