docs(miner): AMS storage-abstraction research — datastore backend comparison - #5760
Conversation
…parison Research spike (JSONbored#5216): compares managed Postgres, Cloudflare D1, and a KV/document store as replacements for the miner local-store's node:sqlite DatabaseSync, evaluated against AMS's ACTUAL access patterns (interactive batchClaim transactions, single-statement atomic claims, append-only ledgers, PRAGMA user_version migrations, the api_base_url composite-key tenant seam, lease liveness). Recommends reusing ORB's existing SqliteDriver adapter (src/selfhost/d1-adapter.ts + pg-adapter.ts) with a Postgres lead and D1 alternative; KV excluded as a relational-atomicity mismatch. Research/writeup only, non-binding on the maintainer-owned storage-design issue. Closes JSONbored#5216
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-14 12:38:37 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory 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://gittensory.aethereal.dev/docs/gittensory-commands 🟩 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 #5216.
What
A research-spike comparison document (
packages/loopover-miner/docs/ams-storage-abstraction-research.md) evaluating realistic replacement backends for AMS'snode:sqliteDatabaseSynclocal-store, against AMS's actual read/write patterns — not a green-field design.Method
Enumerated the datastore requirements straight from the stores (
local-store.js,portfolio-queue.js,claim-ledger.js,event-ledger.js,run-state.js,governor-state.js), each with afile:linereference — notably the interactiveBEGIN IMMEDIATEbatchClaimtransaction (portfolio-queue.js:334-351), single-statement atomic claims (INSERT … ON CONFLICT/UPDATE … RETURNING), append-only ledgers,PRAGMA user_versionmigrations, and the existingapi_base_urlcomposite-key seam (#5563) as the naturaltenant_idinsertion point.Comparison (≥3 options, vs those patterns)
pg-adapter.tsrunOn(client)), handlesbatchClaimcorrectly; SQL differences already covered bypg-dialect.Includes a fit matrix, the sync→async migration cost, tenant-scoping fit, and a non-binding recommendation to reuse ORB's existing
SqliteDriverseam (src/selfhost/d1-adapter.ts+pg-adapter.ts) rather than invent a new abstraction.Scope
Docs-only, per the issue boundaries — no schema, storage code, or
local-store.jschanges; recommendation is non-binding on the maintainer-owned storage-design issue and does not contradict the AMS Cloud Readiness architecture spec.