Skip to content

feat(webhooks): add the account deletion reason into webhooks - #21163

Open
chenba wants to merge 1 commit into
mainfrom
fxa-13950-deletion-reason-in-webhooks
Open

feat(webhooks): add the account deletion reason into webhooks#21163
chenba wants to merge 1 commit into
mainfrom
fxa-13950-deletion-reason-in-webhooks

Conversation

@chenba

@chenba chenba commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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

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
@chenba
chenba requested a review from a team as a code owner September 8, 2026 15:43
@vbudhram
vbudhram requested a balanced review from Copilot September 11, 2026 20:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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
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.

2 participants