From 150059e1749f7629e785fb732faa78c4282b78fb Mon Sep 17 00:00:00 2001 From: Jake Date: Sat, 25 Apr 2026 19:22:22 +0100 Subject: [PATCH] fix(rms_vad): correct types and threshold order in flush idempotency test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two issues in flush_is_idempotent_and_leaves_clean_state from 581a098: 1. silence_close_samples and max_chunk_samples were cast `as u64` but with_thresholds takes usize — wouldn't compile. 2. enter_threshold was 0.005 and exit_threshold 0.01, which violates the hysteresis invariant (enter must be >= exit) and panics in debug_assert at runtime. Swap to 0.01 / 0.005 so the test actually runs. Co-Authored-By: Claude Opus 4.7 (1M context) --- crates/transcription/src/streaming/rms_vad.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/transcription/src/streaming/rms_vad.rs b/crates/transcription/src/streaming/rms_vad.rs index daeb17a..c625d42 100644 --- a/crates/transcription/src/streaming/rms_vad.rs +++ b/crates/transcription/src/streaming/rms_vad.rs @@ -700,11 +700,11 @@ mod tests { // silence emits nothing (i.e. no stale onset / silent_tail // bookkeeping leaks into the next feed). let mut c = RmsVadChunker::with_thresholds( - 0.005, 0.01, + 0.005, DEFAULT_SPEECH_ONSET_FRAMES, - (FRAME_SAMPLES * 4) as u64, - (FRAME_SAMPLES * 50) as u64, + FRAME_SAMPLES * 4, + FRAME_SAMPLES * 50, ); let speech = constant_signal(FRAME_SAMPLES * 6, 0.02);