Skip to content

De-triplicate the restart-naming block into CrashRecoveryPlanner.planRestart #170

Description

@fmasi

Flagged by the PR-6 (#139) Opus code-council (architecture lens).

The "no-live-pipeline restart naming" block — stripSegmentSuffixCrashRecoveryPlanner.safeRestartChunkIndexbaseName = "\(sessionId)-\(idx)"incrementedSegment(...) → stamp newSentinel.chunkIndex = idx — now appears in three places:

  • TranscriberCore/RecordingCoordinator.handleXPCCrash (moved there by PR-6)
  • TranscriberApp/TranscriberApp.swift recoverIfNeeded (~L316-335)
  • TranscriberApp/TranscriberApp.swift setupCrashHandler (~L382+)

This is precisely the logic #135 (chunk-index vs segment namespace collision) and #154 finding 6 (chunkIndex floor) already bit on. Three copies means a future fix must land in all three or silently drop audio.

Fix: hoist it into a pure CrashRecoveryPlanner.planRestart(sentinel:outputDirectory:) -> (baseName: String, newSentinel: RecordingSentinel) (CrashRecoveryPlanner already owns safeRestartChunkIndex, so it's the natural home) and call it from all three sites. Pre-existing duplication — PR-6 deliberately left the two launch-time app sites untouched to keep its blast radius small; this is the consolidation follow-up. Related: #139.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions