fix: enforce concurrency and race safety for transfer quote composition - #1690
Merged
Conversation
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.
Overview
This PR adds a concurrency-safe Transfer Composition and Quote Binding layer that serializes concurrent webhook requests, binds displayed transfer details to the authorized quote at final submission, and provides a deterministic, reviewable guarantee under invalid, repeated, concurrent, and failure conditions — with exact validation, explicit client retry semantics, and no partial state.
Related Issue
Closes #QE-2026-08
Changes
🔒 Transfer Composition & Quote Binding
[MODIFY]
lib/webhooks/processor.ts409 Conflict+Retry-Aftersemantics.[MODIFY]
meridian-api/src/events/webhook.controller.ts,meridian-api/src/events/events.service.ts,meridian-api/src/events/webhook.entity.ts[MODIFY]
lib/webhooks/retry.ts[ADD]
docs/WEBHOOK_CONCURRENCY.md[ADD]
meridian-api/src/auth/providers/idempotency.provider.ts+meridian-api/src/common/providers/database-transaction.provider.ts[ADD]
meridian-api/src/events/__tests__/webhook.concurrency.test.tsVerification Results
409+Retry-After; retry contract documented indocs/WEBHOOK_CONCURRENCY.mdIdempotency-Keyis additive and optionalwebhook.concurrency.test.tsat HTTP → controller → service → DB boundary covers parallel, contention, retry, and failure pathsCloses #1656