You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(miner): extract shared local SQLite store helper (#4523)
Extract the ~15 lines of path-resolution/permission/busy-timeout
boilerplate hand-duplicated across run-state.js, claim-ledger.js,
portfolio-queue.js, and event-ledger.js into a shared local-store.js
(resolveLocalStoreDbPath / normalizeLocalStoreDbPath / openLocalStoreDb).
Each store keeps its own file, table, and env var, and public APIs and
on-disk layout are unchanged — this is a DRY pass, not a merge.
As a side effect of routing through the shared open helper, run-state.js
now also sets PRAGMA busy_timeout (the one inconsistency among the four
stores), matching the other three's wait-don't-fail behavior under
concurrent access.
Add a "Local storage" README section documenting all four stores
together (file, table, module, env var), and record the decision that
the manage-status PR portfolio stays a read-time join for now rather
than a dedicated table.
Closes#4272
Every store resolves its file the same way: the store-specific env var above, else `GITTENSORY_MINER_CONFIG_DIR`,
71
+
else `XDG_CONFIG_HOME` (falling back to `~/.config`), joined with `gittensory-miner/<file>`. Every store also opens
72
+
its file with `0700`/`0600` permissions and a shared `PRAGMA busy_timeout` so two instances on the same file
73
+
serialize writes instead of racing.
74
+
75
+
The "PR portfolio" `manage status` renders is currently a **read-time join**, not a dedicated table:
76
+
`collectManageStatus` reads `portfolio-queue.js` rows (via the `pr:{number}` identifier convention) and joins them
77
+
against `event-ledger.js`'s free-form `manage_pr_update` JSON events at query time, on every read. Decision: keep
78
+
this as a read-time join for now; revisit a dedicated indexed table only if/when PR-portfolio reads become frequent
79
+
enough (e.g. a live-polling dashboard) that the per-read linear event-ledger scan becomes a measured bottleneck.
80
+
57
81
## Install
58
82
59
83
See [`docs/miner-goal-spec.md`](docs/miner-goal-spec.md) for the `.gittensory-miner.yml` field reference and [`.gittensory-miner.yml.example`](../../.gittensory-miner.yml.example) at the repo root.
0 commit comments