Repository navigation
fix(indexer): mark reads stale and surface per-network status when indexer is unconfigured (#238) - #252
Conversation
…dexer is unconfigured (Miracle656#238)
|
@Stanley471 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! 🚀 |
…fields
`the committed openapi.json matches the generator output` was the only red:
this PR adds fields to the status schema in src/openapi/schemas.ts without
re-running the generator, so the committed document described the previous
shape.
npm run docs:openapi
The generator is deterministic, so this is mechanical — but the test
exists because a spec that silently lags the code is worse than no spec:
callers build against the document, not the handler.
openapiCoverage.test.ts: 7 passed.
Claude-Session: https://claude.ai/code/session_01USgemLt4Rnz4SGB1Srf3GB
Miracle656
left a comment
There was a problem hiding this comment.
The behaviour is right and this closes a real gap: a network whose indexer never started served database rows with no indication they were frozen. "Stale" and "there is genuinely nothing new" are indistinguishable to a caller unless we say which, and an indexer that is not running is the case where the distinction matters most — the data does not get older-looking, it just stops moving.
Marking those reads stale and reporting per-network state with a reason is the right shape. A /status that says a network is not running without saying why sends someone to the logs; getIndexerUnstartedReason answers it in the response.
Switching the status listing from runningNetworks() to enabledNetworks() is the subtle fix inside the obvious one. Listing only running networks means a network that failed to start is absent from /status rather than reported as down — and absent reads as "not configured", which is exactly the wrong conclusion.
I pushed one commit to your branch. The only red was:
● OpenAPI route coverage (W085) › the committed openapi.json matches the generator output
You added fields to the status schema without re-running npm run docs:openapi, so the committed document described the previous shape. Regenerated — deterministic, so it is mechanical. openapiCoverage.test.ts: 7 passed, full suite 704.
One nit for next time, not worth another round. These guards are dead:
typeof isIndexerStopped === "function" ? isIndexerStopped(net) : falseAll three functions are static exports from ./indexer on this same branch — isIndexerRunning at line 217, isIndexerStopped at 221, getIndexerUnstartedReason at 225 — so the typeof can never be false and the fallbacks are unreachable. Two reasons to drop them: the : false default means "not stopped", which is the wrong way for a staleness check to fail; and the isIndexerRunning fallback is a second implementation of the same question, which can drift from the real one without any test noticing.
Integration tests fails identically on main and is not yours.
Merging.
Closes #238
Summary of Changes
Explicit Staleness Marking on Unconfigured/Stopped Networks:
**Per-Network Indexer State in /status**:
unningNetworks, \isIndexerRunning, \isIndexerStopped, \getIndexerUnstartedReason).
etworks\ map with
unning: boolean, \lastIndexedLedger, \latestLedger, \lagLedgers, and
eason\ (when stopped/unstarted due to missing configuration).
Validation & Unconfigured-RPC Path Tests:
Documentation: