slice-4 (dev-a): Task 1 — AdvisoryEvent + ReflexMetrics + barge_in_flush trait #7
Reference in New Issue
Block a user
Delete Branch "slice-4-dev-a-reflex"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What lands
Task 1 of the slice-4 plan — the critical-path foundation. Everything else in slice-4 depends on this merging first.
crates/rutster-media/src/reflex.rs:AdvisoryEventenum (SpeechStarted/SpeechStopped),ReflexMetrics(4AtomicU64counters +new()/snapshot()),ReflexMetricsSnapshot(Debug+PartialEq+Eq). 3 inline tests.crates/rutster-media/src/pcm.rs: addedAudioPipe::barge_in_flush(&mut self)default method (delegates toclear_playout_ring) — the kill-now path.EchoAudioPipeinherits the default unchanged.crates/rutster-media/src/lib.rs:pub mod reflex;+ re-exports (Reflexintentionally omitted — Task 2 defines it; flagged inline) +//!module-map catalogue entry.What this proves
The foundational types + trait hook that every later slice-4 task consumes: Task 2 (
Reflex<P>state machine), Task 2b (LocalVadReflex<P>primary trigger), Task 3 (theTapAudioPipe::barge_in_flushoverride), Task 4 (advisory_txwiring), Tasks 5–7 (composition + dedicated thread). Without Task 1, none of them compile.Deviation from the verbatim brief (flagged for review)
The brief's verbatim
reflex.rsincludeduse tokio::sync::mpsc;anduse crate::pcm::{AudioPipe, AudioSource, AudioSink, PcmFrame};.tokiois not a dependency ofrutster-media(Cargo.toml lists onlyrutster-call-model,opus,str0m,thiserror,tracing), so the verbatim import is a hard compile error + an unused-import warning (promoted to error by-D warnings). Both imports are forward-references — onlyReflex<P>(Task 2) consumes them. The implementer stripped both and left an inline comment flagging that Task 2 must reintroduce the imports AND addtokio = { workspace = true }tocrates/rutster-media/Cargo.toml. Task 1's actual surface (enum, metrics, trait method, tests) is unaffected and matches the brief's intent verbatim.Also: the brief's module-doc comment said
LocalVadReflex<P>is "deferred per slice-4 §1.2" — stale (Task 2b builds it this slice as the primary trigger). Prose corrected to state it lands via Task 2b (spec §6.4).Seam gate
crates/rutster-media/src/loop_driver.rs+crates/rutster-media/src/rtc_session.rsare byte-identical to slice-3 (verified viagit diff --exit-code origin/main -- <those files>). Not touched.Verification
cargo fmt --all --check— cleancargo clippy --all --all-targets -- -D warnings— cleancargo test --all— all green (rutster-media lib: 14 passed, 11 pre-existing + 3 new; all other crates pass)Signed-off-by: opencode controller <controller@local>)Merge instructions
Reflex<P>) and dev-b's Tasks 3/4 parallelize.1a21452e49tod06e79cc50