Skip to content

fix: idempotent voucher replay + 204-safe receipt wrapping#221

Merged
tmm merged 6 commits intomainfrom
fix/session-voucher-replay-and-204-receipts
Mar 24, 2026
Merged

fix: idempotent voucher replay + 204-safe receipt wrapping#221
tmm merged 6 commits intomainfrom
fix/session-voucher-replay-and-204-receipts

Conversation

@Slokh
Copy link
Copy Markdown
Contributor

@Slokh Slokh commented Mar 24, 2026

Summary

Fixes two session/SSE production issues: idempotent voucher replay handling and 204-safe SSE receipt wrapping.

Problems & Solutions

  1. Duplicate voucher submissions with the same cumulativeAmount were rejected with 402 verification-failed in legitimate retry/race paths.
    Solution: reject < highestVoucherAmount, accept == highestVoucherAmount as idempotent replay success after signature verification, and keep normal advancement rules for > highestVoucherAmount.
  2. Successful management responses (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 build
  • Added/updated targeted tests for voucher replay behavior and 204 receipt wrapping path

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 24, 2026

Open in StackBlitz

npm i https://pkg.pr.new/mppx@221

commit: 001c256

@Slokh Slokh changed the title fix(tempo/session): idempotent voucher replay + 204-safe receipt wrapping fix: idempotent voucher replay + 204-safe receipt wrapping Mar 24, 2026
Comment thread src/tempo/server/Session.ts
Comment thread src/tempo/server/internal/transport.ts Outdated
@tmm tmm merged commit 70f6595 into main Mar 24, 2026
8 checks passed
@tmm tmm deleted the fix/session-voucher-replay-and-204-receipts branch March 24, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants