Overview & Background
The database model IndexerDeadLetterEvent captures Soroban events that failed processing (e.g. unexpected payload format, transient database lock, RPC timeout during processing). This ensures a single malformed event does not freeze the indexer worker cursor. However, currently there are no administrative endpoints to query, inspect, retry, or dismiss these dead-letter events.
Detailed Problem Statement
- Zero Visibility for Operators:
- When events fail, they reside silently in the database without any alerting or administration UI.
- Manual Intervention Required:
- Resolving dropped events currently requires executing raw SQL queries and manually reconstructing state mutations.
- No Controlled Replay Mechanism:
- Once an indexer bug is patched and deployed, operators cannot trigger a clean replay of quarantined events.
Technical Specification & Architecture
1. Administrative Dead-Letter Endpoints
Implement in backend/src/routes/v1/admin.routes.ts:
GET /api/v1/admin/indexer/dead-letter:
- Query parameters:
page, limit, ledgerSequence, startDate, endDate.
- Returns paginated list of dead-letter records with error logs and raw payloads.
POST /api/v1/admin/indexer/dead-letter/:id/replay:
- Re-injects the dead-letter event payload into the indexer pipeline (
indexer.service.ts).
- If processing succeeds: deletes the dead-letter entry and creates corresponding
StreamEvent and Stream records.
- If processing fails: increments
attempts counter and updates lastAttemptAt and errorMessage.
POST /api/v1/admin/indexer/dead-letter/replay-all:
- Iterates and replays all pending dead-letter records sequentially.
DELETE /api/v1/admin/indexer/dead-letter/:id:
- Permanently discards an unrecoverable event with audit log notation.
2. Authorization
- Protected by
requireAdminAuth JWT middleware.
Target Files
backend/src/routes/v1/admin.routes.ts
backend/src/controllers/admin.controller.ts
backend/src/services/indexer.service.ts
backend/tests/indexer-service.test.ts
Acceptance Criteria
Overview & Background
The database model
IndexerDeadLetterEventcaptures Soroban events that failed processing (e.g. unexpected payload format, transient database lock, RPC timeout during processing). This ensures a single malformed event does not freeze the indexer worker cursor. However, currently there are no administrative endpoints to query, inspect, retry, or dismiss these dead-letter events.Detailed Problem Statement
Technical Specification & Architecture
1. Administrative Dead-Letter Endpoints
Implement in
backend/src/routes/v1/admin.routes.ts:GET /api/v1/admin/indexer/dead-letter:page,limit,ledgerSequence,startDate,endDate.POST /api/v1/admin/indexer/dead-letter/:id/replay:indexer.service.ts).StreamEventandStreamrecords.attemptscounter and updateslastAttemptAtanderrorMessage.POST /api/v1/admin/indexer/dead-letter/replay-all:DELETE /api/v1/admin/indexer/dead-letter/:id:2. Authorization
requireAdminAuthJWT middleware.Target Files
backend/src/routes/v1/admin.routes.tsbackend/src/controllers/admin.controller.tsbackend/src/services/indexer.service.tsbackend/tests/indexer-service.test.tsAcceptance Criteria