fix(persistence): harden cross-layer ownership

- Validate and sanitize renderer event payloads before UI projection
- Fence stale enqueue cleanup by native lifecycle generation
- Canonicalize empty startup hydration and harden SQLite backup durability
- Add real-postcondition IPC, restart, storage, and queue regressions
This commit is contained in:
NimBold
2026-08-22 04:11:02 +03:30
parent e6d276e28e
commit 3bcad639e2
9 changed files with 432 additions and 34 deletions
+20
View File
@@ -38,6 +38,26 @@ const ACTIVE_DOWNLOAD_STATUSES: ReadonlySet<DownloadStatus> = new Set([
'moving',
]);
const DOWNLOAD_STATUSES: ReadonlySet<string> = new Set([
'ready',
'staged',
'downloading',
'processing',
'seeding',
'waitingToSeed',
'paused',
'completed',
'failed',
'queued',
'retrying',
'verifying',
'moving',
]);
/** Runtime guard for values arriving from the untyped Tauri event channel. */
export const isDownloadStatus = (status: unknown): status is DownloadStatus =>
typeof status === 'string' && DOWNLOAD_STATUSES.has(status);
export const isActiveDownloadStatus = (status: DownloadStatus): boolean =>
ACTIVE_DOWNLOAD_STATUSES.has(status);