Skip to content

feat(backend): DLQ recovery, validator Redis caching, merchant concurrency control - #1913

Merged
emdevelopa merged 1 commit into
emdevelopa:mainfrom
Yormee-103:feature/be-dlq-recovery-redis-key-validator-merchant-concurrency
Nov 23, 2026
Merged

emdevelopa merged 1 commit into
emdevelopa:mainfrom
Yormee-103:feature/be-dlq-recovery-redis-key-validator-merchant-concurrency

Conversation

@Yormee-103

Copy link
Copy Markdown
Contributor

Closes #1776
Closes #1765
Closes #1772
Closes #1771

Full design notes, config and metrics: backend/docs/RESILIENCE_DLQ_CACHE_CONCURRENCY.md.

What changed

Behaviour changes to be aware of

  • POST /webhook-settings/verify can now return 202 (was 500) when persistence keeps failing transiently.
  • Concurrent credential operations for one merchant now return 409 (MERCHANT_LIFECYCLE_BUSY / MERCHANT_CREDENTIAL_CONFLICT); clients should retry.
  • The existing rotate-webhook-secret unit test's mock was updated for the compare-and-swap query chain.

Tests

New suites, all passing under Node 22: recovery-queue (16), payment-details-recovery (16), validators-cache (27), merchant-key-lifecycle (17), merchant-recovery (14). Existing validators.test.js (31) and validators.integration.test.js (9) still pass.

Not verified / pre-existing failures (unchanged by this PR):

  • src/routes/merchants.test.js fails on main too (checked on a clean checkout): importing the route chain hits SyntaxError: Invalid regular expression: missing / in src/lib/stellar/horizon-client/error-handler.js. I updated that file's mocks and added route-level concurrency tests to it, but they cannot run until that file is fixed; the same logic is covered directly by the merchant-key-lifecycle tests.
  • src/routes/prometheus-concurrency.test.js failed one timing-based assertion in my run; it injects its own registries, so this PR's registry additions do not affect it. I did not investigate further.
  • I did not run the full backend suite, lint, or any integration tests.

Security notes

  • No secret (API key, webhook secret, password) enters a queue entry, lock key, metric label, log line or error message; the CAS conflict error carries no credential. Credential rotations are deliberately not retried or queued (not idempotent; would hold a secret in memory).
  • Cache and lock keys are hashed and namespaced; cached data is untrusted on read; poisoned entries are deleted.
  • Bounded memory everywhere (queue capacity, cache size, tracked operations); no import-time timers; background recovery is throttled and non-overlapping.

…rency control

- emdevelopa#1776: retry + dead-letter recovery for the Horizon lookup in paymentDetails
- emdevelopa#1765: Redis-backed cache, request coalescing and throughput telemetry for
  federated address resolution in the Stellar validators
- emdevelopa#1772: per-merchant locking and compare-and-swap credential writes
- emdevelopa#1771: retry + dead-letter recovery for webhook domain verification
  persistence in the merchants route
- shared bounded RecoveryQueue, new Prometheus registries, docs and tests

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 22, 2026

Copy link
Copy Markdown

@Yormee-103 is attempting to deploy a commit to the Emmanuel's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Nov 22, 2026

Copy link
Copy Markdown

@Yormee-103 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! 🚀

Learn more about application limits

@emdevelopa
emdevelopa merged commit 70a6685 into emdevelopa:main Nov 23, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment