Skip to content

fix(miner): laptop-state.sqlite3 is missing from both doctor's integrity sweep and migrate's proactive-migration list #8641

Description

@JSONbored

⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.

Context

packages/loopover-miner/lib/status.ts's storeIntegrityChecks (lines 388-413) enumerates every
durable local SQLite store using resolveLocalStoreDbPath, with its own comment stating "Keep in
sync with migrate-cli.js's STORES list." packages/loopover-miner/lib/migrate-cli.ts's STORES
(lines 52-87) is the second half of that pair. This exact category of gap — a store omitted from
one or both lists — has been fixed repeatedly before (#6928, #7238, #8036, #8318/#8470), each time
adding the missing store to both lists.

laptop-state.sqlite3 (packages/loopover-miner/lib/laptop-init.ts) uses the identical
resolveLocalStoreDbPath + applySchemaMigrations pattern as every one of the 17 stores already
enumerated in both lists, but is absent from both today.

packages/loopover-miner/DEPLOYMENT.md compounds the gap: it lists laptop-state.sqlite3 as the
first entry in its store table (lines 71-78) and claims two things about it that are no longer
true:

Net effect: a corrupted laptop-state.sqlite3 is invisible to doctor's deep integrity check, and
migrate never proactively brings it up to date the way it does the other 17 stores.

Requirements

  • Add ["laptop-state", resolveLaptopStateDbPath(env)] (or the equivalent call used by the other
    16 entries) to storeIntegrityChecks in packages/loopover-miner/lib/status.ts.
  • Add the matching entry to migrate-cli.ts's STORES array.
  • Update the hardcoded "seventeen stores" assertion in test/unit/miner-migrate-cli.test.ts:46 and
    the name list in test/unit/miner-status.test.ts:132-148 to reflect eighteen stores including
    laptop-state.
  • Fix DEPLOYMENT.md's two stale claims (lines 75-78): laptop-state does support a
    LOOPOVER_MINER_LAPTOP_STATE_DB override, and it is (after this PR) covered by the deep
    store-integrity:laptop-state check, not just the shallow SELECT 1.

Deliverables

  • storeIntegrityChecks (status.ts) includes a laptop-state entry using the same deep
    PRAGMA integrity_check path as the other 17 stores.
  • migrate-cli.ts's STORES includes the matching laptop-state entry, so migrate proactively
    brings it up to date like every other store.
  • test/unit/miner-migrate-cli.test.ts and test/unit/miner-status.test.ts are updated to
    assert eighteen stores (not seventeen), with a dedicated case proving laptop-state.sqlite3's
    integrity is checked and its schema migrated the same way as a sibling store.
  • DEPLOYMENT.md's store table entry for laptop-state.sqlite3 accurately states it supports
    the LOOPOVER_MINER_LAPTOP_STATE_DB override and is covered by doctor's deep integrity
    check.

All Deliverables above are required in the same PR.

Test Coverage Requirements

packages/loopover-miner/** is measured by codecov/patch (99%+ target, branch-counted). The new
test cases must exercise both the "healthy" and "corrupted" branches of the new
store-integrity:laptop-state check, and the "needs migration" branch of migrate-cli.ts's
handling of the new STORES entry, mirroring the existing fixture pattern already used for the
other 17 stores in the same test files.

Expected Outcome

doctor reports store-integrity:laptop-state using the same deep PRAGMA integrity_check as
every other durable store, migrate proactively migrates laptop-state.sqlite3 schema version like
every other store, and DEPLOYMENT.md accurately describes both behaviors.

Links & Resources

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