Skip to content

fix(settings): Add new glean reasons for email-first auto submit#20591

Open
nshirley wants to merge 1 commit into
mainfrom
FXA-13703
Open

fix(settings): Add new glean reasons for email-first auto submit#20591
nshirley wants to merge 1 commit into
mainfrom
FXA-13703

Conversation

@nshirley
Copy link
Copy Markdown
Contributor

Becuase:

  • We have a bug where events are not emitted when there is an email query param

This Commit:

  • Adds a sufix to the emailFirstSuccess and emailFirstFailure event reasons to indicate if it was an auto-submittal

Closes: FXA-13703

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

  • Key files/areas to focus on:
  • Suggested review order:
  • Risky or complex parts:

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

Any other information that is important to this pull request.

Copilot AI review requested due to automatic review settings May 13, 2026 16:36
@nshirley nshirley requested a review from a team as a code owner May 13, 2026 16:36
queryParamModel: { email: 'test@example.com' },
validationError: null,
});
const gleanSubmitSuccessSpy = jest.spyOn(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The necessity to hoist this is up is because the event can now happen in a useEffect before any page interactions, so we need the spy first. Then, to be consistent all the tests are updated to a similar state

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates email-first Glean telemetry so that success/failure events are emitted for both manual submissions and automatic submissions (prefilled via query params or cached account), distinguishing auto-submits by appending a -auto suffix to the reason extra key.

Changes:

  • Emit emailFirst.submitSuccess for both manual and auto-submit flows, using login[-auto] / registration[-auto] reasons.
  • Emit emailFirst.submitFail for both manual and auto-submit flows, using the same reason suffixing.
  • Update Glean metric descriptions and expand unit tests to cover the new -auto reason behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/fxa-shared/metrics/glean/web/email.ts Updates generated metric docstrings to reflect auto-submission behavior.
packages/fxa-shared/metrics/glean/fxa-ui-metrics.yaml Documents new reason values (login-auto, registration-auto) for submit success/fail events.
packages/fxa-settings/src/pages/Index/container.tsx Emits success/fail Glean events for auto-submit with -auto suffix.
packages/fxa-settings/src/pages/Index/container.test.tsx Adds/updates tests asserting Glean emission for auto-submit success and failure cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/fxa-settings/src/pages/Index/container.tsx
GleanMetrics.emailFirst.submitSuccess({
event: {
reason: `${accountExists ? 'login' : 'registration'}${
isManualSubmission ? '' : '-auto'
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is the meat and potatoes, add a suffix to the event if it's not a manual submit so we can differentiate manual vs auto (from email query param)

});
});

it('emits submitFail with reason "login" when the user cancels account linking', async () => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We didn't have tests to cover the failure state and making sure we emit the correct events, just adding them here

Copy link
Copy Markdown
Contributor

@vbudhram vbudhram left a comment

Choose a reason for hiding this comment

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

👍🏽

Becuase:
 - We have a bug where events are not emitted when there is an email
   query param

This Commit:
 - Adds a sufix to the emailFirstSuccess and emailFirstFailure event
   reasons to indicate if it was an auto-submittal

Closes: FXA-13703
@nshirley
Copy link
Copy Markdown
Contributor Author

Latest force push was to address another, related bug. See here

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