fix(miner): route the governor/prediction/plan local stores through openLocalStoreDb#6667
Conversation
…penLocalStoreDb governor-ledger.js, prediction-ledger.js, and plan-store.js each hand-rolled their own mkdir(0o700)/DatabaseSync/chmod(0o600)/busy_timeout open, bypassing local-store.js's openLocalStoreDb — so unlike the package's other local stores their handles were never registered with registerCleanupResource, and a SIGINT/SIGTERM/uncaught-exception mid-run left them half-written instead of closed cleanly (JSONbored#4826). Route all three through openLocalStoreDb, which centralizes that boilerplate (including the ':memory:' no-file case) and the crash-safe cleanup registration. Closes JSONbored#6595.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-16 18:18:22 UTC
Review summary Nits — 5 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionPartially addressed 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.
|
Summary
packages/loopover-miner/lib/local-store.js'sopenLocalStoreDb(#4272) is the package's shared crash-safe SQLite open: it does themkdirSync(0o700)+DatabaseSync+chmodSync(0o600)+PRAGMA busy_timeout, and — critically — registers the handle viaregisterCleanupResource(#4826) so a SIGINT/SIGTERM/uncaught-exception closes it cleanly mid-run.governor-ledger.js,prediction-ledger.js, andplan-store.jseach hand-rolled that same open inline, bypassing the helper — so their handles were never registered for cleanup, and a crash/signal mid-run left them half-written instead of closed. This routes all three throughopenLocalStoreDb(which also handles the':memory:'no-file case plan-store relied on), so they get the identical open behavior plus the crash-safe cleanup registration the package's other stores already have.Pure boilerplate consolidation — no schema, path-resolution, or query behavior changes; the now-unused
node:fs/node:sqlite/dirnameimports are dropped.Tests
All existing store + CLI tests pass unchanged (
miner-governor-ledger,miner-prediction-ledger,miner-plan-store+ their-clivariants — 43 tests), confirming identical open/read/write behavior through the shared helper.Closes #6595.