fix(edit-transcript): guard segment re-injection to only synthetic splits - #74
Merged
Merged
Conversation
When re-running transcription/alignment from scratch, segment timestamps shift. Old transcript.json segments that fail the 0.5s time-based match were incorrectly treated as synthetic (> SPEAKER splits) and re-appended alongside all new segments, doubling every entry in transcript.doc.txt. Fix: mark segments created by > SPEAKER splits with synthetic:true. Only segments carrying that flag are re-injected; real unmatched segments from a stale run are discarded, which is correct after a full retranscribe. Also removes pre-existing unused imports in edit-transcript.test.js that were flagged by ESLint once the file was touched. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Documents the synthetic?: boolean field that edit-transcript writes when a > SPEAKER split creates a new segment, closing the TypeScript type gap flagged in the PR #74 review. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extracts the synthetic segment re-injection filter from main() into an exported pure function so the guard can be unit-tested without real I/O. Adds 3 unit tests covering: synthetic re-injection, real segment exclusion, and already-matched id exclusion. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
transcript.jsonsegments that failed the 0.5s time-based match were incorrectly treated as user-created> SPEAKERsplits and re-appended alongside all the new segments — doubling every entry intranscript.doc.txt.> SPEAKERsplits are now marked withsynthetic: trueat creation time. The re-injection filter gates on that flag, so only genuine user-created splits survive a retranscription; stale real segments are discarded.edit-transcript.test.jsthat ESLint flagged once the file was touched.Test plan
npm test -- --testPathPattern=edit-transcript→ 112 tests pass, 0 failuresnpm test) → 188 tests pass, 0 failures, 3 E2E pass> SPEAKER split marks the created segment with synthetic: trueandreal segments do not carry synthetic: truetranscript.doc.txt🤖 Generated with Claude Code