feat: add GET /api/sync-progress endpoint (COW-985)#74
Open
lgahdl wants to merge 2 commits into
Open
Conversation
Returns per-chain historical sync progress as clean JSON: totalBlocks, processedBlocks, progressPct (0-100), isRealtime, isComplete. Reads from Ponder's Prometheus /metrics endpoint using the request origin so it works on any port. Registered in OpenAPI/Swagger. 6 integration tests covering: status code, chain entries, processedBlocks calculation, progressPct rounding, realtime/complete flags, and graceful degradation when /metrics is unreachable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…W-985) Add non-null assertions for Record<string, T> index access under noUncheckedIndexedAccess. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jeffersonBastos
approved these changes
May 29, 2026
Contributor
jeffersonBastos
left a comment
There was a problem hiding this comment.
Did you add this new route to the documentation?
/sync-progress
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.
Summary
Adds a
GET /api/sync-progressendpoint that returns per-chain historical sync progress in clean JSON. Addresses the client ask: "nice to get a sense of how far we are from being ready".Example response while backfilling:
{ "mainnet": { "totalBlocks": 7313715, "processedBlocks": 2906029, "progressPct": 39.7, "isRealtime": false, "isComplete": false }, "gnosis": { "totalBlocks": 17024177, "processedBlocks": 2399220, "progressPct": 14.1, "isRealtime": false, "isComplete": false } }Example response once fully synced:
{ "mainnet": { "progressPct": 100.0, "isRealtime": true, "isComplete": true, ... }, "gnosis": { "progressPct": 100.0, "isRealtime": true, "isComplete": true, ... } }Implementation
Reads from Ponder's built-in
GET /metricsPrometheus endpoint using the incoming request's origin (no hardcoded port). Parsesponder_historical_total_blocks,ponder_historical_completed_blocks,ponder_historical_cached_blocks,ponder_sync_is_realtime, andponder_sync_is_complete. Degrades gracefully if/metricsis unreachable (returns{}).Registered in the OpenAPI spec — visible in Swagger UI at
/docs.Test plan
pnpm typecheck && pnpm lintpassesRelated Issues
COW-985
🤖 Generated with Claude Code