Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor broken site report message handlers #2939

Merged
merged 11 commits into from
Feb 17, 2025

Conversation

sammacbeth
Copy link
Collaborator

@sammacbeth sammacbeth commented Feb 5, 2025

Reviewer:

Description:

Some breakage reports were coming through with config version undefined on Firefox (https://app.asana.com/0/0/1209244730607066/f). This is likely caused by a race condition in the breakage report flow if the background is not fully loaded yet.

To fix this, this PR:

  • Moves the sendBreakageReport function to a component.
  • Removes static access to page context information, using components instead.
  • Allows us to wait for the correct config lifecycle event before getting config version.
  • Updates the toggle reports component to use this new entrypoint for sending reports.

Steps to test this PR:

Automated tests:

  • Unit tests
  • Integration tests
Reviewer Checklist:
  • Ensure the PR solves the problem
  • Review every line of code
  • Ensure the PR does no harm by testing the changes thoroughly
  • Get help if you're uncomfortable with any of the above!
  • Determine if there are any quick wins that improve the implementation
PR Author Checklist:
  • Get advice or leverage existing code
  • Agree on technical approach with reviewer (if the changes are nuanced)
  • Ensure that there is a testing strategy (and documented non-automated tests)
  • Ensure there is a documented monitoring strategy (if necessary)
  • Consider systems implications

Config processing can how take one tick after the config ready promise
resolves. Waiting for allLoadingFinished should ensure that everything is ready.
@sammacbeth sammacbeth requested a review from kzar February 5, 2025 10:56
@sammacbeth sammacbeth force-pushed the sam/breakage-config-version branch from a8bc2fe to 7f4d812 Compare February 6, 2025 12:39
Copy link
Collaborator

@kzar kzar left a comment

Choose a reason for hiding this comment

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

Overall I like the changes, but can we split the race condition fix out from the refactor? Also, I'd like to avoid weakening the ToggleReports unit tests.

@sammacbeth sammacbeth changed the title Fix breakage report race condition. Refactor broken site report message handlers Feb 17, 2025
@sammacbeth sammacbeth requested a review from kzar February 17, 2025 09:15
@sammacbeth sammacbeth force-pushed the sam/breakage-config-version branch from effbe1b to a7ef3f7 Compare February 17, 2025 13:10
@sammacbeth sammacbeth merged commit 2e0fe7c into main Feb 17, 2025
22 checks passed
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