Skip to content

fix(prisma): resolve the duplicated IndexerDeadLetterEvent model - #1612

Open
boluxx123 wants to merge 1 commit into
LabsCrypt:mainfrom
boluxx123:fix/duplicate-indexer-dead-letter-model
Open

boluxx123 wants to merge 1 commit into
LabsCrypt:mainfrom
boluxx123:fix/duplicate-indexer-dead-letter-model

Conversation

@boluxx123

Copy link
Copy Markdown

Problem

backend/prisma/schema.prisma declares model IndexerDeadLetterEvent twice (lines 71 and 164), so every Prisma command fails before anything else runs:

Error: Prisma schema validation - (get-dmmf wasm)
Error code: P1012
error: The model "IndexerDeadLetterEvent" cannot be defined because a model with that name already exists.
  -->  prisma/schema.prisma:164

This breaks prisma migrate/generate, the backend build and the Ephemeral full-stack preview job.

It is a botched merge: two branches added a dead-letter feature and both copies survived. The definitions are incompatible — one uses ledger / transactionHash / rawPayload, the other eventType / txHash / ledgerSequence / cursor / payload. The second is the one the code and ADR 0003 use (indexerService.quarantineEvent, the admin dead-letter API and its tests).

Fix — resolve on the ADR-aligned shape

  • drop the first, unreferenced IndexerDeadLetterEvent block from schema.prisma;
  • drop the superseded migration 20260830000000_add_indexer_dead_letter_event (its CREATE TABLE matches that first shape; the newer 20260926000000_... migration already creates the final table);
  • remove the worker's dead deadLetterEvent() method — the only remaining consumer of the first shape. It has not been called since the merge: the poll loop quarantines via quarantineEvent(event, err) (shape B). Its deadLetterMaxRetries field, DEAD_LETTER_MAX_RETRIES_DEFAULT constant and INDEXER_DEAD_LETTER_MAX_RETRIES read go with it, since the live path never consulted the cap.

No behaviour change — the executed quarantine path is untouched.

Verification (local)

npx prisma validate --schema backend/prisma/schema.prisma
  # before: P1012 "a model with that name already exists"
  # after:  "The schema at schema.prisma is valid"

TypeScript parses cleanly after the removal.

Note: backend/docs/SSE_ARCHITECTURE.md still documents INDEXER_DEAD_LETTER_MAX_RETRIES; that env var is not read by the live quarantine path. Left as a follow-up in case the retry cap should be reinstated.

@boluxx123
boluxx123 force-pushed the fix/duplicate-indexer-dead-letter-model branch from cee6e0d to f4a8698 Compare October 4, 2026 07:53
@boluxx123
boluxx123 force-pushed the fix/duplicate-indexer-dead-letter-model branch from f4a8698 to 1539caa Compare October 21, 2026 21:00

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants