feat(indexer): implement retention and pruning policy for operations and snapshots (#214) - #375
Conversation
|
@ntttttbl123-blip Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
✅ Deploy Preview for stellar-signet ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@ntttttbl123-blip is attempting to deploy a commit to the blockchainmaxis-8449's projects Team on Vercel. A member of the Team first needs to authorize it. |
blockchain-maxis
left a comment
There was a problem hiding this comment.
The retention worker itself reads well — retention expressed in days with 0 meaning disabled, the cutoff computed from an injected now so the tests don't depend on the clock, and operations and snapshots given independent windows. docs/RETENTION.md plus the .env.example / docs/ENVIRONMENT.md entries are the right supporting changes, and the docs guard is happy with them.
One thing blocks it: lint • typecheck • test • build fails on this branch, and main is green.
src/workers/prune.test.ts(52,16): error TS2532: Object is possibly 'undefined'.
src/workers/prune.test.ts(72,16): error TS2532: Object is possibly 'undefined'.
Both are the array index right after the length assertion:
assert.equal(operations.length, 1);
assert.equal(operations[0].id, 'op-recent'); // line 52
...
assert.equal(snapshots.length, 1);
assert.equal(snapshots[0].id, 's-recent'); // line 72noUncheckedIndexedAccess is on for this workspace, so operations[0] is T | undefined regardless of the assertion above it — assert.equal isn't a type guard. operations[0]!.id / snapshots[0]!.id is the fix, matching how the existing indexer tests handle it.
pnpm --filter @signet/indexer typecheck reproduces both locally. Push that and I'll merge — nothing else here needs changing.
…xedAccess tsc --noEmit failed with TS2532 on operations[0].id and snapshots[0].id because tsconfig.base.json sets noUncheckedIndexedAccess.
f74a1ad
into
blockchain-maxis:main
Closes #214
Summary of Changes
Implements a configurable retention and periodic background pruning policy for historical operations and contract snapshots in the indexer, and documents the operational bounds, storage trade-offs, and cost implications.
Key Changes
Verification Status
ode scripts/check-docs.mjs: Passed cleanly (23 markdown files, 30 env vars, no drift).
ode scripts/check-contract-errors.mjs: Passed.