interface FinalizationGuardOptions { ensureBackupDurable: () => Promise; attemptFinalize: () => Promise; releaseGuard: () => Promise | void; } /** * Keep the desktop's post-stop guard visible until recovery metadata is * durable and the finalize request has settled at least once. */ export async function finalizeAfterDurableBackup({ ensureBackupDurable, attemptFinalize, releaseGuard, }: FinalizationGuardOptions): Promise { try { await ensureBackupDurable(); return await attemptFinalize(); } finally { await releaseGuard(); } }