fix(miner): route orb-export, deny-hook-synthesis, and laptop-init through openLocalStoreDb (#8319)#8500
Conversation
…rough openLocalStoreDb (JSONbored#8319) Three of the package's local SQLite stores hand-rolled the same open boilerplate directly against node:sqlite's DatabaseSync instead of routing through local-store.ts's openLocalStoreDb, bypassing its crash-safety registration entirely -- a SIGINT/SIGTERM/uncaught-exception mid-write was not guaranteed to close the handle cleanly the way every openLocalStoreDb-routed store already is (JSONbored#4826, closed issue JSONbored#6595 previously fixed this exact bypass for governor-ledger/prediction-ledger/ plan-store). - orb-export.ts's openOrbExportStore and deny-hook-synthesis.ts's initDenyHookSynthesisStore: replace the manual mkdirSync/new DatabaseSync/chmodSync/PRAGMA busy_timeout sequence with openLocalStoreDb(resolvedPath), dropping the now-redundant steps. - laptop-init.ts's initLaptopState: same substitution -- this was the one store with no busy-timeout and no crash-safety registration at all. No on-disk contract changes (table names, permissions, busy-timeout value). Adds a crash-safe-cleanup-registration test to each file's test suite, mirroring local-store.ts's own openLocalStoreDb registration test (cleanupResourceCount()/resetProcessLifecycleForTesting()). checkLaptopStateSqlite's separate read-only DatabaseSync open and laptop-init.ts's local resolveMinerStateDir duplication are untouched, per the issue's explicit scope.
|
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 #8500 +/- ##
==========================================
- Coverage 92.50% 88.24% -4.27%
==========================================
Files 791 100 -691
Lines 79335 23051 -56284
Branches 23964 3990 -19974
==========================================
- Hits 73388 20341 -53047
+ Misses 4807 2532 -2275
+ Partials 1140 178 -962
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 16:39:22 UTC
Review summary Nits — 3 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. |
Summary
packages/loopover-minerhand-rolled the same open boilerplate directly againstnode:sqlite'sDatabaseSyncinstead of routing throughlocal-store.ts'sopenLocalStoreDb, bypassing its crash-safety registration entirely — a SIGINT/SIGTERM/uncaught-exception mid-write was not guaranteed to close the handle cleanly the way everyopenLocalStoreDb-routed store already is (Add signal/crash handling to the miner CLI #4826). Closed issue governor-ledger.js, prediction-ledger.js, and plan-store.js bypass local-store.js's crash-safe openLocalStoreDb #6595 previously fixed this exact bypass class forgovernor-ledger.js/prediction-ledger.js/plan-store.js.orb-export.ts'sopenOrbExportStoreanddeny-hook-synthesis.ts'sinitDenyHookSynthesisStore: replaced the manualmkdirSync/new DatabaseSync/chmodSync/PRAGMA busy_timeoutsequence withopenLocalStoreDb(resolvedPath), dropping the now-redundant steps, mirroringplan-store.ts'sopenPlanStoreexactly.laptop-init.ts'sinitLaptopState: same substitution — this was the one store with no busy-timeout and no crash-safety registration at all.checkLaptopStateSqlite's separate read-onlyDatabaseSyncopen andlaptop-init.ts's localresolveMinerStateDirduplication are untouched, per the issue's explicit scope.local-store.ts's ownopenLocalStoreDbregistration test (cleanupResourceCount()/resetProcessLifecycleForTesting()).Closes #8319
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patchrequires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
packages/loopover-miner/**is not Codecov-gated per the issue's own note, and this change touches no UI/MCP/workers/OpenAPI surface. Bothnpm run typecheck(root) andnpm --workspace @loopover/miner run build:tsc(the package's own, separate tsconfig) pass clean. Verified vianpx vitest run test/unit/miner-orb-export.test.ts test/unit/miner-deny-hook-synthesis.test.ts test/unit/miner-laptop-init.test.ts: 60/64 tests pass, including all 3 new crash-safety-registration tests. The 4 pre-existing failures (Windows path-separator assertions expecting forward slashes, and a Windows file-lockEBUSYon temp-dir cleanup) are confirmed unrelated — reproduced identically on a clean stash of this branch's base commit before any of this PR's changes existed; none of the 4 touch the functions this PR changes.Safety
UI Evidencesection below with JPG/JPEG or PNG screenshots. (N/A — no visible UI changes.)Notes
laptop-init.tsimportingopenLocalStoreDbfrom./local-store.js, per the issue's own guidance:local-store.tsimports only fromprocess-lifecycle.jsandstore-db-adapter.js, neither of which importslaptop-init.ts.