fix(miner): open doctor's laptop-state check read-only (camelCase readOnly) - #6866
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6866 +/- ##
=======================================
Coverage 93.64% 93.64%
=======================================
Files 685 685
Lines 68243 68243
Branches 18707 18707
=======================================
Hits 63908 63908
Misses 3350 3350
Partials 985 985
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-17 09:31:50 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Closes #6765
Problem
checkLaptopStateSqlite(packages/loopover-miner/lib/laptop-init.js:66) opened its connection with{ readonly: true }.node:sqlite'sDatabaseSynconly recognizes the camelCasereadOnlyoption — the lowercase key is silently ignored as unrecognized, so the connection opened read-write. This check is wired intodoctor(status.js), whose own header states the contract it violates: "no writes, no network."The same footgun is already documented in this package by
claim-ledger.js'sopenClaimLedgerReadOnly("node:sqlite silently IGNORESreadonly(lowercase) … and opens read-write anyway") andpurge-cli.js.Fix
Use the camelCase
{ readOnly: true }, with a comment pointing at the sibling precedent.Deliverable — grep confirmation:
laptop-init.js:66was the only remaining lowercase instance inpackages/loopover-miner/lib/**. Every otherDatabaseSyncread-only open already uses the camelCase form:claim-ledger.js:270{ readOnly: true }✅migrate-cli.js:37{ readOnly: true }✅purge-cli.js:94{ readOnly: true }✅store-maintenance.js:74{ readOnly: true }✅laptop-init.js:66{ readonly: true }❌ → fixed hereTests
test/unit/miner-laptop-init.test.tsadds a regression test that:checkLaptopStateSqliteactually opens with (the function never exposes its own handle) and asserts they are{ readOnly: true }— this fails before the fix withexpected [ { readonly: true } ] to deeply equal [ { readOnly: true } ];claim-ledger.js's read-only tests: a write through a{ readOnly: true }connection throws, while the silently-ignored lowercase spelling happily writes.The recording subclass forwards constructor rest-args (an explicit
undefinedoptions arg is not the same as omitting it), so every existing test's behavior is unchanged.Validation
npx vitest run test/unit/miner-laptop-init.test.ts→ 10 passed, 12 total; the 2 failures are pre-existing on Windows only and identical to the baseline before this change (POSIX path-separator +chmodpermission semantics) — zero net-new failures.npm run typecheck→ clean (0 errors)