Skip to content

dev does not compile: a duplicated retry loop was merged into the notification retry queue #488

Description

@Omoboi-dev

Category: Bug
Difficulty: High

Description

npm run typecheck fails on dev with a single error:

src/notifications/notification-retry-queue.service.ts(204,5): error TS1472: 'catch' or 'finally' expected.

PR #483 replaced the catch block of processInProcess with a second, complete copy of the surrounding for retry loop, pasted inside the try block at a different indentation level. The outer try is now left with no catch and no finally, so the file is not valid TypeScript.

The consequences beyond the syntax error: attempts and lastError are shadowed by inner redeclarations, the inner loop returns on first success so the outer loop is unreachable, and the if (attempt >= attempts) break; that follows the inner loop references an attempt that is out of scope.

This blocks the whole repository. Two unit suites abort with Test suite failed to run citing this file, and nothing that imports the notifications module can be built or tested.

Location

  • src/notifications/notification-retry-queue.service.ts
  • test/unit/notification-retry-queue.service.spec.ts

Example commits

fix(notifications): restore the catch block lost in the retry loop merge
test(notifications): cover per-attempt retry and dead-letter behaviour

Acceptance Criteria

  • npm run typecheck exits 0.
  • processInProcess contains exactly one retry loop.
  • The catch branch is restored: it captures lastError, breaks when attempts are exhausted, computes the backoff delay and sleeps.
  • test/unit/notification-retry-queue.service.spec.ts runs rather than aborting, and passes.
  • Tests are required. Add a case asserting the dispatcher is called exactly attempts times when every attempt throws, and exactly once when the first attempt succeeds.

Technical Notes

git show 55b94b9 -- src/notifications/notification-retry-queue.service.ts shows exactly what was removed; the pre-merge version of the catch block is in that diff and is the shape to restore.

Do not simply delete the inner loop. The deleted catch also wrote the per-attempt failure record, which is tracked separately in #490 and can be done in the same PR.

Out of scope: the BullMQ path, the dead-letter recording, and the backoff formula itself.


Before you start

  • Set up with the steps in CONTRIBUTING.md. Node 22 is required (.nvmrc), use npm ci rather than npm install, and copy .env.example to .env before running npx prisma generate — the Prisma config reads DATABASE_URL at load.
  • Branch from dev and open your pull request against dev. main is the released baseline.
  • Tests that need an authenticated caller should use the bearer() helper in test/auth-helper.ts, which mints a genuinely signed SEP-10 token. Do not send a raw Stellar address as a bearer token; that path was removed deliberately.
  • You may cover more than one issue in a single pull request.

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't workingcomplexity: high200 pts. New module, worker, external integration

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions