feat(webhooks): add the account deletion reason into webhooks - #21163
Open
chenba wants to merge 1 commit into
Open
feat(webhooks): add the account deletion reason into webhooks#21163chenba wants to merge 1 commit into
chenba wants to merge 1 commit into
Conversation
Because: - RPs might want to handle account deletions differently based on the reason This commit: - maps the deletion reasons to a set of public reasons - includes the reason in SQS events - adds the reason to the delete-user webhook event
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The public reason contract is duplicated across packages and can drift, causing valid future reasons to be silently discarded.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds public account-deletion reasons to SQS notifications and delete-user webhook events while preserving legacy events.
Changes:
- Maps internal deletion reasons to public values.
- Validates and propagates reasons through the event broker.
- Adds coverage for mapped, missing, and invalid reasons.
File summaries
| File | Description |
|---|---|
packages/fxa-event-broker/src/queueworker/sqs.dto.ts |
Adds the optional incoming reason. |
packages/fxa-event-broker/src/queueworker/queueworker.service.ts |
Validates and fans out reasons. |
packages/fxa-event-broker/src/queueworker/queueworker.service.spec.ts |
Tests reason fan-out and fallbacks. |
packages/fxa-event-broker/src/pubsub-proxy/pubsub-proxy.controller.ts |
Passes valid reasons to SET generation. |
packages/fxa-event-broker/src/pubsub-proxy/pubsub-proxy.controller.spec.ts |
Tests valid and invalid reasons. |
packages/fxa-event-broker/src/jwtset/set.interface.ts |
Extends delete-event input. |
packages/fxa-event-broker/src/jwtset/jwtset.service.ts |
Adds reasons to delete SETs. |
packages/fxa-event-broker/src/jwtset/jwtset.service.spec.ts |
Tests generated SET payloads. |
packages/fxa-event-broker/src/delete-reason/delete-reason.ts |
Defines and narrows public reasons. |
packages/fxa-event-broker/src/delete-reason/delete-reason.spec.ts |
Tests reason validation. |
packages/fxa-auth-server/lib/account-delete.ts |
Publishes mapped deletion reasons. |
packages/fxa-auth-server/lib/account-delete.spec.ts |
Tests deletion notifications. |
packages/fxa-auth-server/lib/account-delete-reason.ts |
Maps internal to public reasons. |
packages/fxa-auth-server/lib/account-delete-reason.spec.ts |
Tests reason mappings. |
libs/payments/webhooks/src/lib/fxa-webhooks.service.spec.ts |
Tests reason-bearing and legacy events. |
libs/payments/webhooks/src/lib/fxa-webhooks.schemas.ts |
Accepts an optional deletion reason. |
apps/payments/api/src/scripts/test-fxa-webhook.ts |
Adds a reason to test payloads. |
Review details
- Files reviewed: 17/17 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
||
| export const DELETE_USER_EVENT_REASONS = [ |
| } | ||
|
|
||
| /** | ||
| * Returns the reason when it is one of the known values, otherwise a fallback |
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.
Because:
This commit: