Skip to content

Persist system-audio keep regions on takes - #15

Merged
tadaspetra merged 2 commits into
mainfrom
claude/vigorous-joliot-32e8e9
Aug 21, 2026
Merged

Persist system-audio keep regions on takes#15
tadaspetra merged 2 commits into
mainfrom
claude/vigorous-joliot-32e8e9

Conversation

@tadaspetra

Copy link
Copy Markdown
Owner

What changed

System-audio "keep" regions detected while a take records were only held in a renderer in-memory Map (takeSystemAudioActivity), so they were lost on app restart. For takes with hasSystemAudio=true, re-running Transcribe & Cut after a restart would silence-cut regions that contain audible screen sound (music, demos, narration) but no mic speech.

  • src/shared/domain/project.ts: new TakeSpeechSegment interface and normalizeTakeSpeechSegments() (drops non-record entries, non-finite or inverted/zero-length ranges, coerces text to a trimmed string, sorts by start), plus a systemAudioSegments: TakeSpeechSegment[] field on Take hydrated in normalizeProjectData — legacy project files default to []. Since saveProjectToDisk spreads takes, the field round-trips through save/load with no serializer changes.
  • src/renderer/app.ts: recording finalize stamps systemAudioSegments on the pushed take from the captured activity segments; transcribeAndCutTake prefers the persisted ranges and falls back to the in-session Map for takes recorded before persistence existed.

Tests

Written first (both failed before the implementation) in tests/unit/project-domain.test.ts:

  • normalizeTakeSpeechSegments edge cases: invalid entries dropped, text coercion, sorting.
  • normalizeProjectData round-trip: legacy takes hydrate to []; serialize → re-normalize preserves the ranges.

Notes for reviewers

  • Recovery paths (orphan/crash recovery) still build partial take objects and rely on normalization defaults — those takes get systemAudioSegments: [], matching prior behavior since recovery never had activity data.
  • pnpm run check exits 0 (lint, typecheck, 535 unit/integration tests, Electron e2e smoke). Caveat: the package:smoke step is a pre-existing silent false-pass on Node 26 (extract-zip's promise never settles inside @electron/packager, the event loop drains, and the script exits 0 without packaging). Unrelated to this change; tracked separately.

🤖 Generated with Claude Code

tadaspetra and others added 2 commits August 21, 2026 07:22
System-audio activity ranges captured during recording were only held in
a renderer in-memory Map, so an app restart lost them and a later
Transcribe & Cut would silence-cut regions with audible screen sound but
no mic speech.

Add a systemAudioSegments field to Take with defensive normalization
(normalizeTakeSpeechSegments), stamp it at recording finalize, and make
Transcribe & Cut prefer the persisted ranges with the in-session map as
fallback for takes recorded before persistence existed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Both branches introduced TakeSpeechSegment: main for persisted
transcriptSegments (bad-take detection), this branch for persisted
systemAudioSegments. Keep main's stricter normalizeTakeSpeechSegments
(clamps negatives, collapses whitespace) as the single definition,
stamp both fields at recording finalize, and make the Remove Bad Takes
protection set prefer the persisted system-audio ranges with the
in-session map and waveform envelope as fallbacks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tadaspetra
tadaspetra merged commit adca9a6 into main Aug 21, 2026
@tadaspetra
tadaspetra deleted the claude/vigorous-joliot-32e8e9 branch August 21, 2026 12:27
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