Repository navigation
fix: idempotency validation and shared store, timeout abort, signed-tx price/owner (#71-#74) - #137
Merged
victorisiguzoruzoma874 merged 4 commits intoOct 19, 2026
Conversation
|
@Valreb001 is attempting to deploy a commit to the work Team on Vercel. A member of the Team first needs to authorize it. |
|
@Valreb001 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! 🚀 |
victorisiguzoruzoma874
merged commit Oct 19, 2026
655b67b
into
SynapsVault:main
0 of 2 checks passed
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 #71
Closes #72
Closes #73
Closes #74
Summary
6843db0: fix: validate Idempotency-Key header (#72)
Adds
parseIdempotencyKeyin the newsrc/lib/idempotencyKey.ts, which accepts only 1 to 255 characters from[A-Za-z0-9_-]and otherwise throws a 400VALIDATION_ERROR.POST /resourcesnow parses the header through it before using it as a store key. Unit tests cover valid, empty, over-length and invalid-character keys.0ec92b9: feat(idempotency): store records in Postgres so replicas share them (#71)
Adds
src/lib/idempotencyPgStore.ts, a store backed by a newidempotency_recordstable (unique key, jsonb record, expiry) with migration0011_idempotency_records.src/index.tsinstalls it at boot throughuseSharedIdempotencyStore, whilegetIdempotencyStore()still returns the in-memory cache when nothing is installed, so tests keep using memory. The publish route now awaits its store calls. A test shows two store instances sharing one database returning the original result on retry.a881f98: fix(timeout): abort signal on request timeout and record final idempotency outcome (#73)
The timeout middleware now creates an
AbortControllerper request (exposed via the newsrc/lib/requestAbort.ts) and aborts it on timeout.POST /resourceschecks the signal before starting storage or database work and releases the idempotency key if cancelled. Work already underway completes, records its final outcome under the key, and no longer writes to the already-answered response. The behavior is documented intimeout.ts, with a test covering the abort and final record state.071df0f: fix(resources): take price and new owner from the signed transaction (#74)
Adds
src/services/signedTxDecode.ts, which decodes the invoke arguments from the signed XDR.POST /resources/:id/priceandPOST /resources/:id/ownershipnow compare the body value with the decoded one and return 400 on mismatch before submitting. On a match, the database row is updated from the decoded values. Tests cover matching and mismatched price and owner.