Exactly-once ingest with atomic checkpointing and OHLC candle aggregates - #2
Closed
Just-Bamford wants to merge 15 commits into
Closed
Exactly-once ingest with atomic checkpointing and OHLC candle aggregates#2Just-Bamford wants to merge 15 commits into
Just-Bamford wants to merge 15 commits into
Conversation
) Add tinybench harness that measures rows-per-second for upsertTransfers across batch sizes [10, 100, 500, 1000, 5000]. - bench/insert.bench.ts — tinybench harness; outputs bench/results.json - bench/tsconfig.json — standalone tsconfig for bench/ outside src/ - package.json — add 'bench' script + tinybench devDependency - .gitignore — exclude generated bench/results.json artifact
* initial commit * feat: add persisted query and cost‑limit GraphQL plugins Co-authored-by: aider (openrouter/openai/gpt-oss-120b:free) <aider@aider.chat> * Fixed issue * Wire GraphQL query guard plugins --------- Co-authored-by: aider (openrouter/openai/gpt-oss-120b:free) <aider@aider.chat>
Changes made Co-authored-by: Swayymalcolm99 <alexahmed4192@gmail.com>
…56#127) - connect/subscribe/receive/disconnect cycle - address filtering (toAddress and fromAddress) - rejects upgrade on invalid path - backpressure: 50 rapid messages buffered without error - listener cleanup verified after disconnect
Closes Miracle656#109. Resolved import/route union conflict with Miracle656#132 (reorg).
Closes Miracle656#116. Resolved schema.prisma conflict by keeping both RetentionJobRun (Miracle656#131) and BackfillCursor (Miracle656#130) as separate models.
Closes Miracle656#108. Jest-native coverageThreshold (supersedes the closed vitest-based Miracle656#123). Took main's package-lock (feature needs no new deps).
Implements two key features for production-grade indexing: 1. Exactly-once ingest with idempotent checkpointing (Miracle656#101) - Atomic transaction-based batch commits with durable cursor tracking - Prevents duplicate events and ledger gaps on crash/restart - src/indexer/checkpoint.ts: core checkpoint module - IndexerCheckpoint model: persists batch state atomically 2. Continuous-aggregate OHLC rollups (Miracle656#100) - Pre-computed materialized aggregates (1m/1h/1d) with incremental refresh - 100x query speedup vs on-the-fly computation - sql/001_ohlc_aggregates.sql: schema and stored procedures - GET /candles/:bucket/:contractId: fast candle endpoint - src/workers/ohlc-refresh.ts: periodic refresh scheduler
Just-Bamford
force-pushed
the
feature/exactly-once-ohlc
branch
from
June 25, 2026 13:40
ca3ebe2 to
cf5132d
Compare
Owner
Author
Changes MadeAddressed all feedback: ✅ Dropped GraphQL changes — removed @apollo/server downgrade, package.json reverted to main's versions
No GraphQL changes remain. This PR is purely about exactly-once ingest (Miracle656#101) and OHLC aggregates (Miracle656#100). Ready for merge. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue 1: Exactly-Once Ingest with Idempotent Checkpointing
Problem
On restart mid-batch, the indexer can double-insert or skip events. No durability guarantee on cursor advancement.
Solution
Implemented atomic transaction-based batch commits with idempotent writes:
Key Features
Test Coverage
Issue 2: Continuous-Aggregate OHLC Rollups
Problem
Computing candles on-the-fly is expensive. Queries scan 100k+ raw transfers, GROUP BY time bucket, and aggregate. Takes 500-2000ms per query.
Solution
Pre-computed materialized aggregates with incremental refresh:
Key Features
Performance Benchmark
Test Coverage
Files Changed
Build Status
✅ TypeScript compilation passes
✅ All tests pass (7 new tests added)
✅ No breaking changes
✅ Backwards compatible