Skip to content

migrate's per-store failure report understates a partially-applied migration #6767

Description

@JSONbored

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

  • Re-read of the real post-failure version in migrateStore's catch branch
  • Regression test with a migrations array where a later migration throws after earlier ones succeed, asserting the reported versionAfter reflects real partial progress

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions