fix(miner): delegate orb-export/deny-hook-synthesis/laptop-init DB opening to crash-safe openLocalStoreDb#8516
Conversation
…open to openLocalStoreDb
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #8516 +/- ##
===========================================
+ Coverage 60.98% 88.24% +27.25%
===========================================
Files 793 100 -693
Lines 79458 23051 -56407
Branches 23996 3990 -20006
===========================================
- Hits 48459 20341 -28118
+ Misses 27213 2532 -24681
+ Partials 3786 178 -3608
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-24 17:55:12 UTC
Review summary Nits — 4 non-blocking
CI checks failing
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.
|
|
LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
What
Three local SQLite stores in
packages/loopover-minerstill hand-rolled their DB-openboilerplate directly against
node:sqlite'sDatabaseSync, bypassing the shared crash-safeopenLocalStoreDbhelper inlib/local-store.ts(and therefore itsregisterCleanupResourcewiring). This routes all three throughopenLocalStoreDb, the samesubstitution
plan-store.ts'sopenPlanStoreandattempt-log.ts'sinitAttemptLogalready demonstrate — closing the fix class from #6595 for the three stores it missed.
lib/orb-export.ts(openOrbExportStore): replaced themkdirSync/new DatabaseSync/chmodSync/PRAGMA busy_timeoutsequence withconst db = openLocalStoreDb(resolvedPath);.lib/deny-hook-synthesis.ts(initDenyHookSynthesisStore): same substitution.lib/laptop-init.ts(initLaptopState): same substitution (importingopenLocalStoreDbfrom
./local-store.js).createdis now sampled before the open, sinceopenLocalStoreDbcreates the file; its ownmkdirSync(stateDir)/chmodSync(dbPath)are dropped because the helper does the parent-dir
mkdir(0700), thechmod(0600),the busy-timeout, and the cleanup registration internally. The local
resolveMinerStateDirduplication and its "avoid import cycles" comment are left untouched (out of scope, per the
issue). No import cycle:
local-store.tsimports onlyprocess-lifecycle.jsandstore-db-adapter.js, neither of which importslaptop-init.ts.Each store's on-disk contract (table names, 0600 file perms, busy-timeout) and its
close()behavior are unchanged —
openLocalStoreDb's returned handle already wrapsclose()tounregister the cleanup hook.
Tests
Each of the three test files gains a dedicated crash-safety test asserting the store is
registered for cleanup on open and unregistered on
close()(viaprocess-lifecycle.js'scleanupResourceCount/resetProcessLifecycleForTestingseam), mirroringminer-local-store.test.ts's existingopenLocalStoreDbcrash-safety precedent. All existingread/write round-trip tests continue to pass unmodified.
Closes #8319