Skip to content

fix(edit-transcript): guard segment re-injection to only synthetic splits - #74

Merged
natashaannn merged 3 commits into
mainfrom
fix/edit-transcript-synthetic-dedup
May 15, 2026
Merged

fix(edit-transcript): guard segment re-injection to only synthetic splits#74
natashaannn merged 3 commits into
mainfrom
fix/edit-transcript-synthetic-dedup

Conversation

@natashaannn

Copy link
Copy Markdown
Member

Summary

  • When re-running transcription/alignment from scratch, segment timestamps shift. Old transcript.json segments that failed the 0.5s time-based match were incorrectly treated as user-created > SPEAKER splits and re-appended alongside all the new segments — doubling every entry in transcript.doc.txt.
  • Fix: segments created by > SPEAKER splits are now marked with synthetic: true at creation time. The re-injection filter gates on that flag, so only genuine user-created splits survive a retranscription; stale real segments are discarded.
  • Also removes six pre-existing unused imports in edit-transcript.test.js that ESLint flagged once the file was touched.

Test plan

  • npm test -- --testPathPattern=edit-transcript → 112 tests pass, 0 failures
  • Full suite (npm test) → 188 tests pass, 0 failures, 3 E2E pass
  • New assertions: > SPEAKER split marks the created segment with synthetic: true and real segments do not carry synthetic: true
  • Reproduces the bug: before the fix, re-running the pipeline with different timestamps caused every segment to appear twice in transcript.doc.txt

🤖 Generated with Claude Code

natashaannn and others added 3 commits May 15, 2026 12:25
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>
@natashaannn
natashaannn merged commit 69cdedf into main May 15, 2026
1 check passed
@natashaannn
natashaannn deleted the fix/edit-transcript-synthetic-dedup branch May 15, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant