Context
packages/loopover-miner/lib/migrate-cli.js:68-93 (migrateStore)'s catch branch reports versionAfter: versionBefore — "nothing changed" — but schema-version.js's applySchemaMigrations commits each migration in its own transaction specifically so a failure part-way through leaves the file at the last fully-applied version. If open(dbPath) throws while applying migration N of several pending ones, migrations before N have already committed to disk, and the real on-disk version has already advanced past versionBefore. migrateStore's catch block never re-reads the actual post-failure version, so its failed result misreports what's actually on disk.
Requirements
- In the catch branch, re-read the current on-disk version (guarded by its own try, since a genuinely corrupt file may still be unreadable) rather than assuming
versionAfter === versionBefore.
Deliverables
Test Coverage Requirements
99%+ Codecov patch coverage on every changed line and branch, plus a regression test that reproduces the exact failure mode described above and asserts it's fixed.
Expected Outcome
A partial-migration failure is reported with the version it actually landed at, not a misleading "nothing changed."
Links & Resources
packages/loopover-miner/lib/migrate-cli.js:68-93, packages/loopover-miner/lib/schema-version.js:52-65.
Context
packages/loopover-miner/lib/migrate-cli.js:68-93(migrateStore)'s catch branch reportsversionAfter: versionBefore— "nothing changed" — butschema-version.js'sapplySchemaMigrationscommits each migration in its own transaction specifically so a failure part-way through leaves the file at the last fully-applied version. Ifopen(dbPath)throws while applying migration N of several pending ones, migrations before N have already committed to disk, and the real on-disk version has already advanced pastversionBefore.migrateStore's catch block never re-reads the actual post-failure version, so itsfailedresult misreports what's actually on disk.Requirements
versionAfter === versionBefore.Deliverables
migrateStore's catch branchversionAfterreflects real partial progressTest Coverage Requirements
99%+ Codecov patch coverage on every changed line and branch, plus a regression test that reproduces the exact failure mode described above and asserts it's fixed.
Expected Outcome
A partial-migration failure is reported with the version it actually landed at, not a misleading "nothing changed."
Links & Resources
packages/loopover-miner/lib/migrate-cli.js:68-93,packages/loopover-miner/lib/schema-version.js:52-65.