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: keep transient backup status out of persisted writes (#8628)
[._.]/ Adam Eivybef7f1beefc5
diff --git a/server/services/backup.js b/server/services/backup.jsindex eede97f0bf..78f4db1738 100644--- a/server/services/backup.js+++ b/server/services/backup.js@@ -1606,7 +1606,8 @@ export async function getState() {export async function saveState(patch, onFailure) {return queueStateWrite(() => (async () => {await ensureDir(join(PATHS.data, 'backup'));- const current = await getState();+ // Status projections are read-only and must never become durable state.+ const current = await readJSONFile(STATE_PATH, DEFAULT_STATE, { strict: true });const updated = { ...current, ...patch };await atomicWrite(STATE_PATH, updated);failedStateProjection = null;diff --git a/server/services/backup.test.js b/server/services/backup.test.jsindex e5932675c9..1a4abb0800 100644--- a/server/services/backup.test.js+++ b/server/services/backup.test.js@@ -2969,8 +2969,9 @@ describe('runBackup lifecycle', () => {atomicWrite.mockRejectedValueOnce(new Error('still unavailable'));await expect(saveState({ status: 'ok' })).rejects.toThrow('still unavailable');expect((await getState()).status).toBe('error');- await saveState({ status: 'ok', error: null });+ await saveState({ pgBackup: { status: 'skipped' } });expect(await getState()).toMatchObject({ status: 'ok', error: null, lastSnapshotId: 'previous-snapshot' });+ expect(await readJson(joinPath(dataRoot, 'backup', 'state.json'))).toMatchObject({ status: 'ok', error: null });// Prove the overlay is gone, rather than merely masked by matching values.const fsp = await actualFs();await fsp.writeFile(joinPath(dataRoot, 'backup', 'state.json'), JSON.stringify({ status: 'ok', lastSnapshotId: 'recovered-snapshot' }));