Repository navigation
feat(backend): DLQ recovery, validator Redis caching, merchant concurrency control - #1913
Merged
emdevelopa merged 1 commit intoNov 23, 2026
Conversation
…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>
|
@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. |
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1776
Closes #1765
Closes #1772
Closes #1771
Full design notes, config and metrics:
backend/docs/RESILIENCE_DLQ_CACHE_CONCURRENCY.md.What changed
routes/paymentDetails.js): the Horizon lookup now retries transient failures with backoff, dead-letters lookups that keep failing (by tx id only), recovers them in the background and caches recovered metadata so the next request is served without Horizon. 404 / 4xx are never retried.tx_idmust be a 64-hex hash. Response shape unchanged.lib/stellar/validators*.js):resolveFederatedAddressgets a Redis cache with an in-memory LRU fallback and request coalescing, plus throughput telemetry (stellar_validator_throughput_per_second,stellar_validator_cache_operations_total). Opt-in viaVALIDATOR_CACHE_ENABLED=true, so default behaviour is unchanged. Only successes are cached; cached values are re-validated on read.routes/merchants.js): registration is serialized per email, key/secret operations per merchant (Redis lock with in-process fallback), and credential writes are compare-and-swap, so a stale rotation returns 409 instead of overwriting a newer credential. A23505insert violation maps to the existing 409.lib/merchant-recovery.js): webhook domain verification persistence is retried, then dead-lettered and recovered in the background (read-merge-write of only the verification key). The route returns 202{ persisted: false, recovery: "queued" }instead of a 500 that discards the verification result.RecoveryQueue, two new Prometheus registries wired into/metrics, docs, and tests.Behaviour changes to be aware of
POST /webhook-settings/verifycan now return 202 (was 500) when persistence keeps failing transiently.MERCHANT_LIFECYCLE_BUSY/MERCHANT_CREDENTIAL_CONFLICT); clients should retry.rotate-webhook-secretunit 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). Existingvalidators.test.js(31) andvalidators.integration.test.js(9) still pass.Not verified / pre-existing failures (unchanged by this PR):
src/routes/merchants.test.jsfails onmaintoo (checked on a clean checkout): importing the route chain hitsSyntaxError: Invalid regular expression: missing /insrc/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 themerchant-key-lifecycletests.src/routes/prometheus-concurrency.test.jsfailed 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.Security notes