# session-store result Implemented the durable paid-session storage item. ## Delivered - Entry point: `backend/store/index.mjs`, exporting `SessionStore`, `StoreError`, `purchaseKey`, and `canonicalJSON` using Node 22.13+ `node:sqlite`; no external dependencies. - Migration: `backend/store/migrations/001.sql`, with STRICT tables, foreign keys, unique chain-1 transaction/log entry identifiers, one-session-per-entry constraints, ordered inputs, operation receipts, attestations, events and disputes. - API and operational documentation: `backend/store/README.md`. - Tests: `backend/store/test/store.test.mjs`, with independent claim and abrupt-exit fixtures in `claim-worker.mjs` and `crash-worker.mjs`. Purchases retain block/transaction/log identity, configured emitter, wallet, epoch, Royal snapshot and finalized-checkpoint evidence. Sessions retain seed commitment, rules version, complete authoritative checkpoint, acknowledged tick/input prefix, ordered inputs, terminal outcome, replay digest and independent attestation status. Mutations serialize through immediate transactions; WAL and FULL synchronization protect acknowledged commits. Persisted policy prevents workers opening the same database with inconsistent timing or contract settings. One bounded reconnect window preserves the same run and fences previous writers. Durable leases bound recovery after a crash. Exact operation retries return stored receipts; conflicting retries and input rewinds fail. Reorgs permanently quarantine entries and revoke eligibility while preserving original signed evidence. Practice has no admission/promotion path and must use a separate database. No evidence-deletion API exists; disputed outcomes remain retained and locally ineligible. ## Checks and measured results Command: `node --test backend/store/test/store.test.mjs` - Initial suite: exit 0; 12 tests passed, 0 failed; reported duration **16,306.720173 ms**. - Expanded final suite: exit 0; **15 tests passed, 0 failed**, 0 skipped/cancelled; reported duration **18,755.045175 ms**. - Concurrent independent-worker claims: exactly **one durable winner**, one `ENTRY_USED` rejection. - Clean restart retained the full evidence snapshot. Abrupt child-process exit without closing retained the committed input/checkpoint; an uncommitted transaction was rolled back. - Duplicate input deliveries retained one input row; conflicting duplicates and a noncontiguous batch failed atomically. - Reconnect preserved tick/state/input prefix, incremented the writer generation, rejected stale writers, and could not extend grace. Exact deadline expiry persisted across restart; a second disconnect terminated immediately. - Recomputed the SHA-256 replay digest from exported header and ordered inputs and matched the persisted digest. - Verified finality shape/chain/emitter gates, acknowledgement ordering, wrong-wallet rejection, policy mismatch, attestation conflicts, dispute persistence, and reorg revocation without deleting the original terminal digest/signature. Tests use disposable databases under `test/scratch/` and remove them. Synthetic identifiers/signatures exist only in test fixtures. No production identifiers were guessed. No test failures occurred in these runs. Scope inspection: `git status --short --untracked-files=all` showed the six new source/documentation/test files solely under `backend/store/`. The named result artifact is written separately and left untracked; no staging or commits were performed. No repository configuration or dependencies were changed. ## Verification requiring the merged tree The store is a trusted internal persistence API, not a chain oracle, physics engine or cryptographic verifier. Integration must supply and verify the deployed purchase contract/ABI, canonical finalized ancestry and reorg feed, wallet authentication, paid eligibility and epoch deadlines, authoritative physics/checkpoint/seed custody, independent signature verification, and weekly aggregation/tie/settlement logic. The attestation method persists already-verified evidence; a stored signature string alone proves nothing. `isEligible` is only a local storage predicate, not payout authorization. Still required: end-to-end indexer/service/verifier integration, deployed-contract checks, production-volume durability and backup/restore, sustained-load/capacity validation, and retention/legal review. These tests do not certify a 60 FPS service, production deployment, payout safety, or independent audit. API usage follows the published Node 22.13 SQLite API; a minimum-version runtime matrix remains an integration check.