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: restore no longer fails an intact snapshot when Finder rewrites a hashed .DS_Store (#11866)
Adam Eivye07eb0c7821f
diff --git a/server/services/backup.js b/server/services/backup.jsindex 35e090c493..55f37aadcf 100644--- a/server/services/backup.js+++ b/server/services/backup.js@@ -992,7 +992,7 @@ export async function generateManifest(snapshotDataDir, manifestPath, pgDumpPath}throw manifestReadFailure('data stat', err);});- if (!info || !info.isFile()) continue;+ if (!info || !info.isFile() || isOsMetadataFile(basename(entry))) continue;files[entry] = await sha256File(filePath).catch(err => { throw manifestReadFailure('data hash', err); });}@@ -1444,7 +1444,9 @@ function manifestDataEntries(manifest, srcDir, subdirFilter) {if (dataPaths.has(normalized)) return null;dataPaths.add(normalized);- if (isRestorePreservedPath(normalized)) continue;+ // Still recorded in dataPaths (inventory consistency), but never hashed:+ // Finder may rewrite a hashed metadata file that restore never transfers.+ if (isRestorePreservedPath(normalized) || isOsMetadataFile(segments.at(-1))) continue;if (!subdirFilter || normalized === subdirFilter || normalized.startsWith(`${subdirFilter}/`)) {selected.push({ filePath, expectedHash });}diff --git a/server/services/backup.test.js b/server/services/backup.test.jsindex da4a5d5b06..6f356eb719 100644--- a/server/services/backup.test.js+++ b/server/services/backup.test.js@@ -2190,6 +2190,19 @@ describe('generateManifest', () => {expect(manifest.files).not.toHaveProperty('dangling-link');expect((await fsp.lstat(joinPath(dataDir, 'dangling-link'))).isSymbolicLink()).toBe(true);});++ it('records no OS metadata files in a new manifest', async () => {+ const fsp = await vi.importActual('fs/promises');+ const dataDir = joinPath(tmpRoot, 'data');+ await fsp.mkdir(joinPath(dataDir, 'images'), { recursive: true });+ await fsp.writeFile(joinPath(dataDir, 'images', 'example.png'), 'png');+ await fsp.writeFile(joinPath(dataDir, 'images', '.DS_Store'), 'finder');+ await fsp.writeFile(joinPath(dataDir, 'images', '._example.png'), 'appledouble');+ const { generateManifest } = await import('./backup.js');+ const manifest = await generateManifest(dataDir, joinPath(tmpRoot, 'manifest.json'));+ expect(Object.keys(manifest.files)).toEqual([joinPath('images', 'example.png')]);+ expect(manifest.fileCount).toBe(1);+ });});describe('restoreSnapshot manifest verification', () => {@@ -2309,6 +2322,22 @@ describe('restoreSnapshot manifest verification', () => {]));});+ it.each(['modified', 'deleted'])('restores a snapshot whose manifest hashed a .DS_Store that was later %s', async (change) => {+ // Manifests written before OS metadata was excluded still list it; Finder+ // rewriting that file must not fail verification of an intact snapshot.+ const relativePath = 'images/example.png';+ const metaPath = 'images/.DS_Store';+ await writeManifest({+ [relativePath]: await writeSnapshotFile(relativePath, 'snapshot data'),+ [metaPath]: await writeSnapshotFile(metaPath, 'original finder metadata'),+ });+ if (change === 'modified') await writeSnapshotFile(metaPath, 'finder rewrote this');+ else await realFs.unlink(joinPath(snapshotDataDir, metaPath));++ await expect(finishRestore({ dryRun: true }))+ .resolves.toMatchObject({ verification: { status: 'verified', checkedFiles: 1 } });+ });+it.each(['brain/', './brain', 'brain/.', 'brain//'])('selects and verifies the same files for the equivalent scope %s',async (spelling) => {