fix: idempotent voucher replay + 204-safe receipt wrapping#221
Merged
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-019d1c8d-b530-701a-a4b6-c10b04b4c361 Co-authored-by: Amp <amp@ampcode.com>
commit: |
Amp-Thread-ID: https://ampcode.com/threads/T-019d1c8d-b530-701a-a4b6-c10b04b4c361 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d1c8d-b530-701a-a4b6-c10b04b4c361 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d1c8d-b530-701a-a4b6-c10b04b4c361 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d1c8d-b530-701a-a4b6-c10b04b4c361 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d1d92-ec4d-71cc-8994-d891f50c959c Co-authored-by: Amp <amp@ampcode.com>
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.
Summary
Fixes two session/SSE production issues: idempotent voucher replay handling and
204-safe SSE receipt wrapping.Problems & Solutions
cumulativeAmountwere rejected with402 verification-failedin legitimate retry/race paths.Solution: reject
< highestVoucherAmount, accept== highestVoucherAmountas idempotent replay success after signature verification, and keep normal advancement rules for> highestVoucherAmount.204) could crash in SSE transport due to body-wrapping on null-body statuses.Solution: return null-body status responses (
101/204/205/304) directly and only stream-wrap responses where a body is valid.Validation
pnpm build204receipt wrapping path