fix: preserve Rust Whisper audio until flush succeeds - #13075
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Addressed in 9a1723c. The review finding was valid: Verified in
|
|
Reviewed the Rust Whisper buffering change in sdks/device/rust — a well-scoped fix for the audio-loss pattern from #13011: a runner error used to discard a full 5-second batch via What I verified on 9a1723c:
One non-blocking note for a maintainer: flush() is caller-driven, so when the Rust SDK later gains the stop/close lifecycle being discussed in #13011, wiring flush() into it would avoid losing final words; keeping that cross-language contract out of this PR is the right scope call. Thanks @beyondlong — clear description, honest verification notes (including what was NOT run), and good test discipline. No security or product-fit concerns; leaving formal merge sign-off to a human maintainer. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Rust SDK bug fix, confidence 5/5: adds flush() so failed/short final buffers aren't discarded, scoped diff, 10 new tests covering retry/empty/tail cases, confirmed not already on main.
|
Thank you for reviewing and merging #13075, @kodjima33. Could you confirm whether the US$25 bounty proposed in #13011 (comment) is approved for this merged Rust Whisper fix? The contribution guide directs payment claims to team@basedhardware.com with the bounty link and PayPal account. I will keep payout details private and follow that process if eligibility is confirmed. |
What changed and why
Rust Whisper callers cannot transcribe a final audio buffer shorter than five seconds, and a runner error currently discards a full buffer before the caller can retry. Add a public
flush()that clears audio only after success and share that path withappend_pcm. Related to #13011; this PR covers only the Rust Whisper buffer, not the full cross-language issue.Product invariants affected
none
How it was verified
From
sdks/device/rust,cargo test --features stt-whisperpassed all 10 tests,cargo fmt --checkpassed, andcargo clippy --features stt-whisper -- -D warningspassed. The README example was compiled and executed against the production library; its injected runner received the full 160,000-byte batch and then the 640-byte final tail.Default-feature Cargo tests also passed (3 tests). The original API regression was run against the original production implementation before changing it: the retry returned
Ok(None)instead of the retained batch's transcript. A separate public API executable reproduces that failure against the baseline and succeeds against the patch. No Bluetooth hardware, real Whisper model, or live provider was exercised.scripts/pr-preflight --lane local --metadata-only --pr-body-file <draft>exited 0; its 90-day failure-class guard skipped because the checkout is shallow. Fullmake preflightdid not pass: the workflow apt-bounds wrapper tried to provision the canonical backend Python environment and stopped at a missingbackend/.python-versionin this sparse checkout. Running the underlying apt-bounds tests directly with the available Python/PyYAML passed all 18 tests. This is not a claim that the full repository gate passed; rerun it in a provisioned checkout before submission.Tests
Seven feature-gated tests cover failed-batch retention, empty flush, final-tail delivery and subsequent appends, empty-transcript clearing, full batch plus tail, explicit retry for partial/full buffers, and oversized-append compatibility. Exact PCM bytes and runner call counts are asserted on the error/retry paths.
Failure class (fixes)
Failure-Class: none
This is a localized in-memory SDK buffer lifetime fix. The existing durable-store replacement and teardown-finalizer classes have different owners and prevention primitives; this change does not alter their registries or claim to close the cross-language lifecycle work.