📌 Description
In src/indexer/service.ts, the replay progress reporting computes an estimated completion using a throughput rate. On the first progress tick (or when no rows have yet been replayed) the divisor can be zero, producing Infinity/NaN for estimatedCompletion, which then propagates into logs/metrics and any progress endpoint.
💡 Why it matters: NaN/Infinity ETAs corrupt dashboards and can break JSON serialization of progress; the estimate must degrade gracefully.
🧩 Requirements and context
- Guard the
estimatedCompletion computation against zero/negative rate and zero elapsed time.
- Return
null/omit the estimate when it cannot be computed instead of NaN/Infinity.
- Ensure any progress metric/log handles the null case cleanly.
- Add unit tests for the first-tick and zero-rate scenarios.
Non-functional requirements
- Must be secure, tested, and documented.
- Should be efficient and easy to review.
🛠️ Suggested execution
1. Fork the repo and create a branch
git checkout -b fix/indexer-eta-divzero
2. Implement changes
- Write/modify the relevant source:
src/indexer/service.ts
- Write comprehensive tests:
tests/indexer-replay.test.ts
- Add documentation: inline TSDoc on the estimate semantics
- Include TSDoc doc comments
- Validate security assumptions: no invalid numbers in serialized output
3. Test and commit
- Cover edge cases: zero rows replayed, zero elapsed, normal progress
- Include test output and security notes in the PR description.
Example commit message
fix(indexer): guard replay ETA against division by zero
✅ Acceptance criteria
🔒 Security notes
Ensure invalid numeric values cannot break JSON responses consumed by clients.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
In
src/indexer/service.ts, the replay progress reporting computes an estimated completion using a throughputrate. On the first progress tick (or when no rows have yet been replayed) the divisor can be zero, producingInfinity/NaNforestimatedCompletion, which then propagates into logs/metrics and any progress endpoint.🧩 Requirements and context
estimatedCompletioncomputation against zero/negative rate and zero elapsed time.null/omit the estimate when it cannot be computed instead ofNaN/Infinity.Non-functional requirements
🛠️ Suggested execution
1. Fork the repo and create a branch
2. Implement changes
src/indexer/service.tstests/indexer-replay.test.ts3. Test and commit
npm testExample commit message
✅ Acceptance criteria
NaN/InfinityinestimatedCompletionnull/omitted when uncomputable🔒 Security notes
Ensure invalid numeric values cannot break JSON responses consumed by clients.
📋 Guidelines