fix(core): recognize legacy kb-* backups and canonicalize .kb/backups settings

- BackupManager.listBackups now matches kb-* and kb-pre-restore-* filenames
  alongside the fusion-* pattern, parsing timestamps from either prefix.
- canonicalizeSettings rewrites autoBackupDir: ".kb/backups" to
  ".fusion/backups" so projects upgraded from the old brand keep working
  (custom .kb/* paths remain untouched).
- createBackupManager applies the same canonicalization to settings it
  receives, so the factory path also produces backups under .fusion/backups.
- Re-export getErrorMessage from core/src/types.ts so the dashboard's vite
  "@fusion/core" alias (which points at types.ts) resolves the symbol for
  client-side consumers — fixes the mobile build-output test.

Clears all 8 pre-existing kb → fn rename failures plus the 1 test that
regressed from the new getErrorMessage import surfacing the vite alias gap.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-23 19:22:50 -07:00
parent 88d8a8fa37
commit dca56336fc
3 changed files with 29 additions and 10 deletions

View File

@@ -203,17 +203,21 @@ function compactTaskActivityLog(entries: TaskLogEntry[]): TaskLogEntry[] {
}
/**
* Canonicalizes a settings object by stripping legacy fields that are no longer valid.
* Canonicalizes a settings object by stripping legacy fields that are no longer valid
* and rewriting legacy path values left over from the kb → fn rename.
*/
function canonicalizeSettings(settings: Settings): Settings {
// Strip legacy globalMaxConcurrent from project settings - this field was
// deprecated in favor of the global-level maxConcurrent in concurrency settings.
const { globalMaxConcurrent, ...rest } = settings as Settings & { globalMaxConcurrent?: number };
if (globalMaxConcurrent !== undefined) {
return rest as Settings;
}
const base = globalMaxConcurrent !== undefined ? (rest as Settings) : settings;
return settings;
// Rewrite legacy .kb/backups → .fusion/backups for projects upgraded from the
// old brand so persisted settings keep working. Custom .kb/* paths are left alone.
if (base.autoBackupDir === ".kb/backups") {
return { ...base, autoBackupDir: ".fusion/backups" };
}
return base;
}
export interface TaskStoreEvents {