From f827df11c6cdfb180d44d8349e44ff4ed43a50ee Mon Sep 17 00:00:00 2001 From: karl Date: Tue, 13 Oct 2026 13:44:06 +0200 Subject: [PATCH] Verify VAD allocation limits and decoder overshoot contracts --- docs/SPEECH-VAD.md | 6 ++++++ tools/speech-vad/test_native.py | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/docs/SPEECH-VAD.md b/docs/SPEECH-VAD.md index e41cab5..81096d6 100644 --- a/docs/SPEECH-VAD.md +++ b/docs/SPEECH-VAD.md @@ -211,6 +211,12 @@ was scored. All three native contracts passed again with the corrected build; four mapping regressions cover centiseconds, source origin, padded tails and invalid intervals. Segmentation parameters and model remained frozen. +The expanded native contract suite then passed six tests in 0.471 seconds: +missing-model failures emit no report, oversized PCM is rejected before model +loading, and finite decoder overshoot is accepted by actual CPU inference +without input clipping. The synthetic DC overshoot input tests the input +contract only and is not included in the media quality pool. + This small VAD-only result supports testing gated ASR next. It does not establish speech recall, transcript correctness, timestamp accuracy, retrieval improvement or a general music policy. No production gate was added and original Google diff --git a/tools/speech-vad/test_native.py b/tools/speech-vad/test_native.py index d225504..9217caf 100644 --- a/tools/speech-vad/test_native.py +++ b/tools/speech-vad/test_native.py @@ -48,6 +48,32 @@ class NativeContract(unittest.TestCase): self.assertEqual(result.returncode, 2) self.assertEqual(result.stdout, b"") + def test_missing_model_is_failure_without_report(self): + with tempfile.TemporaryDirectory(prefix="searchi-vad-missing-") as scratch: + pcm = Path(scratch) / "silence.f32" + pcm.write_bytes(b"\0" * 64000) + result = subprocess.run([str(self.worker), str(Path(scratch) / "missing.bin"), str(pcm)], + capture_output=True, timeout=5) + self.assertEqual(result.returncode, 3) + self.assertEqual(result.stdout, b"") + + def test_oversized_pcm_rejected_before_model_loading(self): + with tempfile.TemporaryDirectory(prefix="searchi-vad-large-") as scratch: + pcm = Path(scratch) / "oversized.f32" + with pcm.open("wb") as stream: + stream.truncate(16000 * 600 * 4 + 4) + result = subprocess.run([str(self.worker), "missing.bin", str(pcm)], + capture_output=True, timeout=5) + self.assertEqual(result.returncode, 2) + self.assertEqual(result.stdout, b"") + + def test_finite_decoder_overshoot_is_preserved(self): + # A DC input is not speech evidence. This checks only the input contract: + # valid floating-point decoder output must not be clipped or rejected. + result = self.run_pcm(struct.pack("