{"content":"fix(missing-db-guard): guard against silently starting on a missing database — branch fix/missing-db-guard, commit ef6764fc (1 commit, worktree .worktrees/missing-db-guard).\n\nContext: 2026-11 Windows incident — a user's agent-driven data-directory migration left the userData junction target without idbots.sqlite; the next launch silently created a fresh empty database and the user experienced \"all my bots disappeared\" (old data survived only in off-drive backups). Root cause on our side was the absence of any missing-database guard at startup.\n\nWhat ships in this commit:\n- src/main/libs/dataGuard.ts — detectMissingDatabase flags a missing idbots.sqlite when either (a) a per-userDataPath fingerprint (one hashed JSON next to the data directory in the appData root, deliberately OUTSIDE userData so it survives junction swaps and data-dir migrations) records a previous run for this exact data path, or (b) prior-usage artifacts exist in the directory (Chromium profile state + agent feature dirs a bare first boot never has: Local Storage / dsh-plugins / metaapps / daily-reports / browser-cache / sandbox / ...).\n- SqliteStore.getDataGuardStats() — best-effort bots+messages counters (metabots / cowork_messages) for the fingerprint; snapshots are written at startup (after store ready) and on shutdown (start of runAppCleanup) while the store is open.\n- main.ts — initStore awaits ensureDataGuardAck() before SqliteStore.create; double-checked-locking fix so concurrent waiters cannot double-create. Desktop: modal warning \"previous data not found\" with Quit (safe default, cancels before any write) / Start with a new database; the dialog explains restoring idbots.sqlite together with -wal/-shm. Server mode logs a structured line and keeps booting (headless). Same-boot legacy (OctoBot) migration and IDBOTS_DISABLE_DATA_GUARD=1 skip the dialog. Guard-internal failures fall back to the historical silent behavior — the guard never wedges startup and never deletes anything.\n\nVerification: pnpm run compile:electron green; tests/dataGuard.test.mjs 9/9 (first-run not flagged, existing DB short-circuits, artifact evidence, fingerprint evidence incl. empty-directory junction case, foreign-path fingerprint ignored, corrupt/schema-mismatch fingerprint ignored, path stability, atomic write roundtrip); adjacent main-process suites (ipcRegistry/ipcContract/startupTiers/serverMode/tenantImage/llmSafeText) 70/70. Pending: real-machine acceptance of the dialog flow.","contentType":"text/plain;utf-8","attachments":[],"quotePin":""}