Conversation
19991bf to
3c9122c
Compare
Let our app hang out the partially-reloaded routes state while the frontend is just innocently making logging API calls.
(Frontend will not make /api/logger calls if analyticsEndpoint is not set)
Analytics calls can cause failures related to the user of `Rails.application.reload_routes!`
3c9122c to
79afeef
Compare
|
See 58eb833 for how I attempted to reliably simulate the error condition locally. |
app/views/layouts/base.html.erb
Outdated
| { | ||
| 'appName' => APP_NAME, | ||
| 'analyticsEndpoint' => api_logger_path, | ||
| 'analyticsEndpoint' => (api_logger_path if IdentityConfig.store.frontend_analytics_enabled), |
There was a problem hiding this comment.
If analyticsEndpoint is not set, trackEvent won't make any requests.
|
(I'm going to run CI for this branch several times to see if I can get another failure) |
|
Rather than disabling frontend analytics outright, I wonder if there might be some option to either...
|
|
I'm also still curious if there's an option which avoids the need to reload the Rails route table, like if what we're defining in |
config/application.yml.default
Outdated
| event_disavowal_expiration_hours: 240 | ||
| feature_idv_force_gpo_verification_enabled: false | ||
| feature_idv_hybrid_flow_enabled: true | ||
| frontend_analytics_enabled: true |
There was a problem hiding this comment.
- Is there a way to make the analytics disabled config only apply in the test environment to avoid affecting prod,
or - Is this something that could happen in prod and we want to protect against it there too
Yeah, my main concern with this approach is it means new controllers in the IdV space need to remember to check to see if IdV is disabled before they do anything. We have a lot of controllers, and are adding more and more as we migrate away from the flow state machine. I guess it's not the end of the world, since a lot of these controllers have to remember to do a lot of other checks as well. |
Rather than completely disabling analytics, just wait for any pending requests to complete before proceeding.
|
Thanks all, we've had 8 successive green runs of this branch in CI, so I'm going to merge. |
* Unskip my spec * Make it more likely for the flakiness to occur Let our app hang out the partially-reloaded routes state while the frontend is just innocently making logging API calls. * Add config to enable/disable frontend analytics (Frontend will not make /api/logger calls if analyticsEndpoint is not set) * Selectively disable analytics for idv outage spec Analytics calls can cause failures related to the user of `Rails.application.reload_routes!` * [skip changelog] * Remove temp code used to reliably trigger failure * Wait for pending requests to complete before dismantling routing table Rather than completely disabling analytics, just wait for any pending requests to complete before proceeding.
🛠 Summary of changes
Background
A while back, we added a frontend analytics call that fires when the IdV "Welcome" screen is loaded. It turns out these frontend logging API calls can clash with
Rails.application.reload_routes!, which is used heavily in the IdV outage feature spec. This clash would result in errors during test runs:(See full example.)
Here's the order of events:
afterhandler, we callRails.application.reload_routes!to clean up.POSTto/api/loggerTo resolve the flakiness, we're adding a line to wait for any pending requests in the test browser to complete before reloading the Rails routes.