Make revoke_seat idempotent to prevent duplicate seat-revoked webhooks#13237
Open
pieterbeulque with Copilot wants to merge 2 commits into
Open
Make revoke_seat idempotent to prevent duplicate seat-revoked webhooks#13237pieterbeulque with Copilot wants to merge 2 commits into
revoke_seat idempotent to prevent duplicate seat-revoked webhooks#13237pieterbeulque with Copilot wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: pieterbeulque <144075+pieterbeulque@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix duplicate webhooks and timestamp overwrite in revoke_seat
Make Jul 17, 2026
revoke_seat idempotent to prevent duplicate seat-revoked webhooks
pieterbeulque
approved these changes
Jul 17, 2026
pieterbeulque
marked this pull request as ready for review
July 17, 2026 08:02
Contributor
OpenAPI ChangesNo changes detected in the OpenAPI schema. |
pieterbeulque
enabled auto-merge
July 17, 2026 08:22
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
SeatService.revoke_seatwas not idempotent: re-revoking an already revoked seat emitted duplicatecustomer_seat_revokedwebhooks and overwroterevoked_at. This change makes repeated revocation calls a no-op for already revoked seats and adds regression coverage for that contract.What
revoke_seatwhenseat.is_revoked()is true.revoke_seattwice on the same seat and asserts:revoked_atremains the original valueWhy
Single-seat revoke can be called repeatedly (including via endpoint retries), so revocation must be idempotent. Without this guard, downstream webhook consumers receive duplicate events and seat audit timing becomes incorrect.
How
Use a guard before any side effects in
revoke_seat:This prevents duplicate webhook emission and preserves the original revocation timestamp on subsequent calls.
Checklist
uv run task lint && uv run task lint_types)