Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: gate database restore on valid preview (#6671)
[._.]/ Adam Eivy70a2c13e7224
diff --git a/client/src/components/settings/BackupTab.jsx b/client/src/components/settings/BackupTab.jsxindex 5a50bff3fc..5f747abbbd 100644--- a/client/src/components/settings/BackupTab.jsx+++ b/client/src/components/settings/BackupTab.jsx@@ -195,6 +195,7 @@ export function BackupTab() {const handleRestoreDb = async (snapshotId) => {setRestorePreview(null);+ setRestoreTarget(null);// Dry-run first to show what would restore, then open the confirm modal.const preview = await restoreDatabase({ snapshotId, dryRun: true }, { silent: true }).catch(() => null);@@ -202,6 +203,12 @@ export function BackupTab() {toast.error(preview?.reason === 'no_dump' ? 'No DB dump in this snapshot' : 'DB restore unavailable');return;}+ if (preview.status !== 'ok') {+ toast.error(preview.reason === 'manifest_mismatch'+ ? 'Snapshot dump failed integrity verification'+ : `DB restore unavailable: ${preview.reason || 'unknown'}`);+ return;+ }setRestorePreview(preview);setRestoreTarget(snapshotId);};diff --git a/client/src/components/settings/BackupTab.test.jsx b/client/src/components/settings/BackupTab.test.jsxindex 1f2dbbc928..1387f8a38a 100644--- a/client/src/components/settings/BackupTab.test.jsx+++ b/client/src/components/settings/BackupTab.test.jsx@@ -183,6 +183,21 @@ describe('BackupTab', () => {expect(toast.error).toHaveBeenCalledWith('No DB dump in this snapshot');expect(screen.queryByText(/Restore database\?/i)).toBeNull();});++ it('aborts and reports an integrity failure before confirmation', async () => {+ withSnapshot();+ restoreDatabase.mockResolvedValue({ status: 'failed', reason: 'manifest_mismatch' });+ await renderTab();++ await act(async () => {+ fireEvent.click(await screen.findByRole('button', { name: /Restore DB/i }));+ });++ expect(restoreDatabase).toHaveBeenCalledTimes(1);+ expect(restoreDatabase).toHaveBeenCalledWith({ snapshotId: 'snap-2026-06-09', dryRun: true }, { silent: true });+ expect(toast.error).toHaveBeenCalledWith('Snapshot dump failed integrity verification');+ expect(screen.queryByText(/Restore database\?/i)).toBeNull();+ });});describe('Run Now gating (saved state)', () => {