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: flush recovery archives through writable handles (#10697)
Adam Eivye0d0f1f5dd08
diff --git a/server/services/dataManager.archive.test.js b/server/services/dataManager.archive.test.jsindex 37054232a9..6e8fbe5c1a 100644--- a/server/services/dataManager.archive.test.js+++ b/server/services/dataManager.archive.test.js@@ -116,6 +116,27 @@ describe('Data Manager recovery archives (#10697)', () => {expect(await readdir(backup)).toEqual([basename(first.archivePath)]);});+ it('publishes recoverable health bytes when the filesystem requires writable handles for flushing', async () => {+ await seedHealth();+ const actual = await vi.importActual('fs/promises');+ controls.open = async (path, flags, ...args) => {+ const handle = await actual.open(path, flags, ...args);+ if (path.endsWith('.tar.gz')) {+ const sync = handle.sync.bind(handle);+ // Windows FlushFileBuffers rejects handles opened without write access.+ handle.sync = async () => {+ if (flags === 'r') throw Object.assign(new Error('synthetic writable-handle flush required'), { code: 'EACCES' });+ return sync();+ };+ }+ return handle;+ };+ const result = await archiveCategory('health');+ expect(await archiveBytes(result, '2024-01-01.json')).toBe('{"example":"older"}');+ expect(await readdir(health)).toEqual(['2026-10-01.json']);+ expect(await readdir(backup)).toEqual([basename(result.archivePath)]);+ });+it('keeps health sources when syncing archive bytes fails', async () => {await seedHealth();const close = vi.fn();diff --git a/server/services/dataManager.js b/server/services/dataManager.jsindex 1798bb5347..4bf53919b1 100644--- a/server/services/dataManager.js+++ b/server/services/dataManager.js@@ -440,7 +440,8 @@ export async function archiveCategory(categoryKey, options = {}) {// A hard link publishes complete bytes atomically and refuses an existing// destination. Sync bytes first, then the published directory entry before// deleting health sources. Both paths live on the same filesystem.- const archiveFile = await open(stagedArchive, 'r');+ // Windows requires write access for FlushFileBuffers; r+ preserves existing bytes.+ const archiveFile = await open(stagedArchive, 'r+');try { await archiveFile.sync(); } finally { await archiveFile.close(); }await link(stagedArchive, archivePath);// Node does not expose directory fsync on Windows.