fix(transcription): persist real segment end times, not a fixed 1s span#4
Open
farce1 wants to merge 1 commit into
Open
fix(transcription): persist real segment end times, not a fixed 1s span#4farce1 wants to merge 1 commit into
farce1 wants to merge 1 commit into
Conversation
Every transcript segment was stored with end_time_ms = start + 1000ms, and the diarization alignment query recomputed the same fabricated span instead of reading the stored column. VAD segments span 0.15-25s, so speaker-to-text overlap was wrong for any segment != ~1s, degrading diarization and exports. Compute the real duration from the decoded chunk's sample count (samples_to_ms) and carry it on SegmentResult; store start+duration as end_time_ms and read the real end_time_ms column during alignment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Transcript segments were persisted with
end_time_ms = start_time_ms + 1000(a fabricated 1-second span), and the diarization alignment query (diarization/worker.rs) ignored the stored column and recomputed the samestart + 1000span. Since VAD segments range ~0.15–25s, speaker-to-text overlap was wrong for any segment that isn't ~1s long, degrading diarization accuracy and exported timestamps.This computes the real segment duration from the decoded chunk's sample count and uses it consistently on both the write and read sides.
Changes
transcription/worker.rs: add pure helperssamples_to_ms+build_segment_result; carryduration_mson each segment (removes duplicated inline timestamp math; uses saturating arithmetic).transcription/mod.rs:SegmentResultgainsduration_ms; persistend_time_ms = start + durationinstead ofstart + 1000.diarization/worker.rs: alignment query reads the realend_time_mscolumn instead of(start_time_ms + 1000). The existingend_time_ms.max(start + 1)guard handles zero/short spans.Verification (TDD)
worker.rs(incl. a regression guard asserting real duration ≠ the old fixed 1000ms).cargo check --all-targets✅,cargo clippy --all-targets --all-features -- -D warnings✅,cargo test→ the 4 new tests pass; the only failures are the pre-existingmodel_archive_consts_tests(theREPLACE_WITH_SHA256 release placeholders), unrelated to this change.main's CI is currently red on three maintainer-only release blockers, all independent of this change:release-config-check—REPLACE_WITH_SHA256/pubkey placeholders (Plan 03 Task 0).Rust Checks—vendor/vc_redist.x64.exeis not committed yet (Plan 05 Task 1); the Tauri build script fails on the missing resource. (Verified locally with a temporary untracked placeholder; not committed.)Frontend Checks— separate pre-existing failure.Do not merge until release prep is complete. This is a staged hardening fix (Track A) from a Handy (cjpais) vs openNotes transcription review; code-only, no new deps.