Skip to content

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

fix: refuse an unconvertible legacy-store restore before transferring anything (#12626)

[._.]/ Adam Eivy17d59c8d47ea
diff --git a/server/services/backupLegacyStores.js b/server/services/backupLegacyStores.js
index 55f0bcd45c..5c6195ef56 100644
--- a/server/services/backupLegacyStores.js
+++ b/server/services/backupLegacyStores.js
@@ -70,6 +70,11 @@ export async function snapshotLegacySplitStores(srcDir, scope) {
const readable = ok && value !== null && typeof value === 'object' && !Array.isArray(value) && entry.readable(value);
found.push({ ...entry, readable });
}
+ // Migrations take the install root and join `data/` themselves. Refuse before
+ // any transfer, so a store that cannot be converted is never restored over.
+ if (found.some(entry => entry.readable) && basename(PATHS.data) !== 'data') {
+ throw new Error(`Cannot convert restored legacy stores: data directory ${PATHS.data} is not <install>/data`);
+ }
return found;
}
@@ -85,10 +90,6 @@ export const describeLegacySplitStores = stores => stores.map(({ store, legacyFi
*/
export async function convertRestoredLegacySplitStores(stores) {
if (stores.length === 0) return [];
- // Migrations take the install root and join `data/` themselves.
- if (basename(PATHS.data) !== 'data') {
- throw new Error(`Cannot convert restored legacy stores: data directory ${PATHS.data} is not <install>/data`);
- }
const stamp = new Date().toISOString().replace(/[:.]/g, '-');
const results = [];
for (const entry of stores) {