David's ask: back up the brain before the one-time upgrade, drop it after. On open, when the on-disk format is stale (a 7.x→8.0 rebuild will run) and the store holds data, brainy hard-link-snapshots the brain dir to a sibling `<brainDir>.migration-backup` BEFORE any provider rebuilds — near-zero cost/space (shared inodes; the store is immutable-by-rename), instant even at scale. Removed automatically once the upgrade verifies + stamps the marker; retained on failure for rollback. Default-on; opt out with `migrationBackup: false`. - Reuses the existing snapshotToDirectory() hard-link farm via new optional adapter methods createMigrationBackup()/removeMigrationBackup() (filesystem only — feature-detected; memory + non-fs are a graceful no-op). - Taken before the native provider inits, so it captures true pre-migration state; a prior failed upgrade's backup is reused, not overwritten. - Best-effort: a backup failure never blocks the upgrade (the migration is itself safe — reads canonical, reconstructable, self-heals). Catastrophe-insurance against a migration bug, not a data-loss guard or an off-device backup. 4 lifecycle tests (adapter hard-link / reuse / remove-without-touching-live / empty→null; stale-epoch reopen create+remove; opt-out; memory no-op). Gates: typecheck 0, build 0, test:unit 1753/1753, layout-migration suite 5/5. |
||
|---|---|---|
| .. | ||
| api | ||
| benchmarks | ||
| comprehensive | ||
| configs | ||
| fixtures/import | ||
| helpers | ||
| integration | ||
| integrations | ||
| performance | ||
| regression | ||
| scripts | ||
| transaction | ||
| unit | ||
| vfs | ||
| critical-neural-validation.test.ts | ||
| critical-performance-benchmark.test.ts | ||
| model-loading.test.ts | ||
| package-size-breakdown.test.ts | ||
| package-size-limit.test.ts | ||
| setup-integration.ts | ||
| setup-semantic.ts | ||
| setup-unit.ts | ||
| setup.ts | ||
| type-utils.unit.test.ts | ||