Repository navigation
Fix two flaky browser specs at their cause (iPad touch highlight, audio moment) - #3954
Draft
backnotprop wants to merge 3 commits into
Draft
backnotprop wants to merge 3 commits into
backnotprop wants to merge 3 commits into
Conversation
inbox-touch-highlight-webkit.spec.ts:139 (iPad): the spec waited for the highlight's marks and then read the toolbar at once. The marks go into the text synchronously in highlighter.fromRange; the toolbar is React state set in the CREATE handler, and AnnotationToolbar draws nothing until its effect has placed it, so it comes a render later. Both CI failures (runs 45190576260 and 45245882767) were exactly that read: highlighted text right, toolbar not up yet. The spec now waits for one highlight and the toolbar together. inbox-memory-soak.spec.ts:129: the long-task limit compared wall time, which counts the time a loaded runner keeps the renderer's main thread off the CPU. In 12 green full runs on main the longest task was 1,321 to 1,812 ms; it failed at 2,174 and 2,721 ms with the slowest response at about 9.4 s (4.8 to 7.6 s when green): the whole runner was slow. Each long task now counts the main thread's CPU time during it (ThreadTime from Performance.getMetrics, sampled every 100 ms, bracketing the task, never more than its duration). The 2,000 ms limit is unchanged and the check is never stricter than before; the summary prints wall and CPU time for the slowest tasks.
inbox-audio.spec.ts:254 failed three times (runs 45100384479, 45268491267, 45267877621), each time with "At 0:01 (1.3 s of 0:02)" against an expected 1.2 s. The recording is playing when the test seeks it to 1.2 s; when the two screenshots before were quick it is still playing, so it plays on from 1.2 s until the first key pauses it and pins that moment (pin() reads currentTime after pause), and from 1.25 s it reads 1.3. The product carries the real moment. The spec now reads where typing paused the recording, and checks that the dot and the time pill seek back to it and that the agent's text carries it to the tenth.
…lowdown The first CI sample of the CPU-time check showed the soak's slowest tasks use as much main-thread CPU as wall time (1,803 of 1,803 ms; 124 s of CPU over the run): the window really does that work, the runner was not holding it off the CPU. The spec's history on main says why. Through 2026-11-17 the longest task while messages arrived was 217 to 315 ms on CI, as the header's budget assumed; every run since #3616 (the held "N new" bar) is 1.1 to 1.9 s with the slowest response 4 to 8 s, and every PR run without it stayed fast. The 2,000 ms limit is right, so the spec goes back to main's.
This branch has not been deployed
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.
Two browser specs that failed now and then on CI, fixed where they go wrong. No retries, no skips, no raised limits. A third, the memory soak, is not a flaky test: it is catching a real slowdown in the window, and it is left as main has it (see the end).
iPad: a long press dragged on in steps is highlighted once (
inbox-touch-highlight-webkit.spec.ts:139)Fault: the test. Both failures (main 76cbbec, run 45190576260; PR #3886 head c31a96d, run 45245882767) were the same line:
Line 161 passed in both runs, so the right words were highlighted. The spec waited for the highlight's marks, then read the toolbar at once. The marks go into the text synchronously (
highlighter.fromRange). The toolbar comes later: it is React state set in the CREATE handler (setToolbarStateinuseAnnotationHighlighter.ts), andAnnotationToolbarreturnsnulluntil its passive effect has placed it (setPosition, thenif (!position) return null). That is at least one more render and a paint after the marks. On an iPad the toolbar shows a frame later. Nothing in that flow closes it: it is dismissed only by a mousedown outside it, Escape, or the selection scrolled out of sight. Every green run reads it still up 1.5 s later.The spec now waits until there is one highlight and the toolbar is up, then checks everything as before. A toolbar that never comes still fails it. It failed 2 times in about 150 runs (1 of 13 full runs on main), only in the iPad case, which is the first test in the file.
Audio: Send carries the moment (
inbox-audio.spec.ts:254)Fault: the test. It failed 3 times (runs 45100384479, 45268491267 on #3948, 45267877621 on #3949), and once more on this PR's first head before the fix (run 45271746661). Each time it showed
At 0:01 (1.3 s of 0:02)against an expected1.2 s. It did not fail in any of the 13 full main runs I read.The 2 s recording is playing when the test seeks it to 1.2 s. If the two screenshots just before were quick, it is still playing, so it plays on from 1.2 s until the first key pauses it.
pin()inVideoAttachmentView.tsxreadscurrentTimeafter the pause, so from 1.25 s the comment reads 1.3 s. That is the real moment: the product is right. The spec now reads where typing paused the recording (between 1.19 and 2 s, so the0:01chip checks still hold). It checks that the dot and the time pill seek back to that moment, and that the agent's text carries it to the tenth. The old< 1.3check on the dot had the same race.Memory soak long task (
inbox-memory-soak.spec.ts:129): a real regression, not fixed hereThe spec's own summary line on main, by date (CI, longest task while messages arrive / slowest response):
So #3616 ("Inbox list: the N new bar sticks; the New pill shows only after Show") made the window do 5 to 6 times more main-thread work per agent message on a large store. The first head of this PR measured the main thread's CPU time around each long task and found it equal to the wall time: 1,803 of 1,803 ms, 124 s of CPU over the run. It is real work, not a loaded runner. The 2,000 ms limit is right (the header assumed CI about 3 times slower than the Mac, and before #3616 it was), so the spec is unchanged. I could not profile the window here, so the cause inside #3616's change is not found:
heldLinesinuseListShown(more passes over the whole list on every render), and the sticky notice bar's layout and measuring inHeldNoticeLine.tsx, are where I would start.Tests