Skip to content

laptop-init's doctor check silently opens its store read-write due to a node:sqlite option-name typo #6765

Description

@JSONbored

Context

packages/loopover-miner/lib/laptop-init.js:66 opens new DatabaseSync(dbPath, { readonly: true }). node:sqlite's DatabaseSync only recognizes the camelCase readOnly option; the lowercase key is silently ignored, so the connection opens read-write. This exact footgun is already documented elsewhere in the same package (purge-cli.js:88-90, claim-ledger.js:267-269), and migrate-cli.js:37/store-maintenance.js:74 both correctly use the camelCase form — laptop-init.js:66 is the one remaining lowercase instance. It's wired into doctor (status.js:426), whose own header states the contract this violates: "no writes, no network."

Requirements

  • Change { readonly: true } to { readOnly: true } in checkLaptopStateSqlite (laptop-init.js:66).
  • Add a regression test asserting the connection is driver-enforced read-only (a write attempt through it throws), mirroring claim-ledger.js's equivalent tests.
  • Grep the rest of packages/loopover-miner/lib/** for any other lowercase readonly: DatabaseSync options.

Deliverables

  • Corrected readOnly casing in laptop-init.js:66
  • Regression test asserting driver-enforced read-only
  • Confirmation (in the PR description) that no other lowercase instance exists

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

doctor's laptop-state check genuinely never writes, matching its own documented contract.

Links & Resources

packages/loopover-miner/lib/laptop-init.js:56,66, packages/loopover-miner/lib/status.js:26,245,426, packages/loopover-miner/lib/claim-ledger.js:267-269, packages/loopover-miner/lib/purge-cli.js:88-90.

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