Repository navigation
Description
Bug Description
When the dashboard sends two or more survey trigger requests at the same time, only some of the "already sent" records are saved. A trigger with no saved record is sent again on the next page load. Each trigger should be sent once for a user, and its record should be saved every time.
The server keeps all survey timeouts for a user in one list. Each trigger request reads the list, adds its own entry, and saves the whole list. When two requests overlap, the request that finishes last saves a list without the other request's entry (Survey_Timeouts::add(), called from REST_User_Surveys_Controller at line 129).
The bug needs two triggers to be sent at the same time. It does not happen every time, because it depends on timing. A trigger that was sent again is saved on a later reload, so the repeats stop. With three or more overlapping triggers, it can take more than two reloads.
This was found while testing #14144. On the main dashboard, view_dashboard and fdh_not_opened overlap. QA saw fdh_not_opened sent on every reload. The fdh_opened_no_interaction and view_pdf_export_downloaded triggers from #14145 overlap in the same way.
A repeated trigger is harmless today. The survey service shows a survey only once, however many times it is triggered.
Steps to reproduce
- Connect Site Kit with Google, and enable the
featureDiscoveryHubfeature flag. - Use a user who has never opened the Add features screen.
- Open the browser DevTools Network tab, filter by
survey-trigger, and turn on Preserve log. - Open the main Site Kit dashboard. Two requests are sent:
view_dashboardandfdh_not_opened. - Reload the dashboard. One of the two requests is sent again, although it was already sent in step 4.
- Reload the dashboard a third time. No request is sent.
If both requests are sent again in step 5, or none is, repeat from step 4 with a user whose survey timeouts are empty. The result depends on timing.
Screenshots
Screen.Recording.2026-11-24.at.15.26.59.mov
Additional Context
- PHP Version:
- OS: [e.g. iOS]
- Browser: [e.g. chrome, safari]
- Plugin Version: [e.g. 22]
- Device: [e.g. iPhone6]
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- When two or more survey trigger requests with a
ttlgreater than0are sent at the same time for the same user, every one of their trigger IDs is saved in that user's survey timeouts. AGETtogoogle-site-kit/v1/core/user/data/survey-timeoutslists all of them, whatever order the requests finish in. - On the main dashboard, for a user who has never opened the Add features screen, has at least one unread feature, and has at least two features not set up, with the
featureDiscoveryHubfeature flag enabled:- The first load sends
survey-triggerrequests forview_dashboardandfdh_not_opened, together with any other trigger the dashboard sends on that load (for exampleview_pdf_export_not_used,view_kmw, andview_ads_setup_cta). - After that load, the survey timeouts list every trigger that was sent, including
view_dashboardandfdh_not_opened. - The next reload sends no
survey-triggerrequest for any trigger that the first load sent.
- The first load sends
- The same holds for three overlapping triggers. For example, after
fdh_not_opened,fdh_opened_no_interaction, andfdh_opened_with_interactionare sent at the same time, the survey timeouts list all three. No trigger is sent again on the next reload. - When a
survey-eventrequest with asurvey_shownevent overlaps with asurvey-triggerrequest, the 12-hour global timeout (__global) and the trigger's timeout are both saved. - The following behavior stays unchanged:
- A trigger sent with
ttlset to0, or without attl, saves no timeout and can be sent again on the next load. - A trigger request that the survey service answers with an error saves no timeout.
- Timeouts that were saved before the overlapping requests and have not expired stay in the list. Expired timeouts are not returned.
- A trigger that is already in the survey timeouts is not sent again.
- One user's survey timeouts do not change when another user's triggers are sent.
- A trigger sent with
Activity