Repository navigation
test: wait for the rename page before typing so the locations example stops flaking - #421
Merged
Merged
Conversation
… stops flaking The example clicked "Rename Blue binder" and at once filled in "Name". The Locations page it is leaving has a field labelled "Name" too (the add form), so when the visit to the rename page hadn't rendered yet, the text went into the add form; the rename page then arrived holding "Blue binder" and Save renamed the location to its own name. Cause, confirmed from an event timeline (Turbo's visit/render/load events and the fetch, logged in the window, with the rename page's fetch held back 400 ms): fill_in ran at 75-107 ms while location.pathname was /locations and the h1 was "Locations"; the rename page rendered at 433 ms. With no delay the page renders 31 ms after the click and fill_in starts 30 ms later, so the margin on a quick machine is one Selenium round trip and a slow response loses it. A person can't click and type within that time, and no app code is involved (the field is the same on both pages by design). Proof, a temporary spec of the example's rename steps with the fetch of the rename page held back (not committed; its code is in the issue): delay 40 ms: before 8 of 30 runs failed; after 0 of 30 delay 400 ms: before 10 of 10 failed; after 0 of 10 The example alone, no delay, on this machine: 0 of 60 before the change and 0 of 200 after it. That doesn't show the natural rate is gone: 0 of 60 already says it is under about 5%, and 0 of 200 says under about 1.5%, both at 95% confidence, no more. The other system specs were scanned for a click followed at once (or after one statement that isn't an expectation) by a fill or a click of a label the page being left also has; none shares the race: the second control only exists on the new page (bulk_move, select_touch_floor "Select all"; collection_import_preview "Export file"; deck_proxies "Card name", "Finish"; scanner_sitting "End sitting"; admin_jobs "Discard MTG::Art::BuildJob"; collection_location_filter "Remove 3 items"; deck_proxy_replacements' scripted example, whose field label has the lot's place and count), the page 1 of the bulk pager has no "Previous" (bulk_mode), the click opens an in-page menu or dialog (narrow_bulk_pages, collection_export, scanner_page, scanner_art), or the example runs on rack_test, where a click is synchronous (deck_proxy_replacements' second example, deck_additions). Reviewed by Opus 5.5, read-only: SPEC-ALIGNED. Closes #417 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #417
A test-only fix for the flaky example "adds with the keyboard, renames and removes through the pages" (
spec/system/locations_spec.rb:7). No app code changes, and no spec (routed as a direct fix with the coordinator).Cause
The example clicked "Rename Blue binder" and at once filled in "Name". The Locations page it is leaving has a field labelled "Name" too (the add form), so when the visit to the rename page hadn't rendered yet, the text went into the add form; the rename page then arrived holding "Blue binder" and Save renamed the location to its own name. With the rename page's fetch held back 400 ms,
fill_inran at 75 ms on/locations(h1 "Locations") and the rename page rendered at 433 ms; with no delay the page renders 31 ms after the click andfill_instarts 30 ms later, so a slow response loses. Not a product bug: a person can't click and type in that time, and no app code is in the path. The event log and the reproducer are in the issue comment.Change
spec/system/locations_spec.rb:expect(page).to have_css("h1", text: "Rename location")between the click and thefill_in, something only the rename page has. Nosleep..claude/memory/turbo-back-navigation-quirks.mdrecords the race; a lesson records how to measure a rare race.Evidence
Provoked with a temporary spec of the rename steps (kept out of the suite) that holds back the rename page's fetch:
The example alone, no delay, on this machine:
What the counts show: with the delay, the failure is the issue's exact text and the wait removes it. What they don't show: that the natural rate is zero. The unfixed example also passed 60 of 60, so the clean loop of the real example can't tell the two apart; 0 of 60 bounds the natural rate under about 5% and 0 of 200 under about 1.5%, both at 95% confidence, no more. The whole
locations_spec.rb: 5 examples, 0 failures.bin/ci checksgreen. The pre-push hook ran the fullbin/ciat22d411da(5047 examples) and passed.Implementation review
Opus 5.5, read-only: SPEC-ALIGNED, no code change. It confirmed the heading can only come from the rename page (the Locations page's one h1 is "Locations"; the layouts have none), found no other step of the example with the race, and corrected three details of the commit body (fixed before the push): "Done" is a link to a new page (still safe, "End sitting" only exists there), only one of the two
deck_proxy_replacementsexamples is rack_test, and the list of safe specs wasn't exhaustive. The statistics were checked and not overclaimed.🤖 Generated with Claude Code