Repository navigation
test: wait for the call tree's toggle to settle before toggling it again - #7510
Merged
Merged
Conversation
test_evidence_close_folds_room_but_retires_controls_immediately[browser-call] toggled the call tree's details several times in a row. lf-call-diff draws through Effect UI, which treats `open` as controlled: after a `toggle` event it writes the Model's `open` back in the next animation frame (`restoreSoon` in @effect/ui's html/internal/dom.ts). A toggle made before that frame is overwritten with the Model's older value, and the browser merges the two pending `toggle` events into one that reports no change, so the press is lost. Recorded in the page: Enter closed the details at 79 ms, the restore frame set `open = true` at 95 ms, and the one `toggle` that followed reported `open`. Each toggle's own reading is still taken right after it; the test now waits for `rendered` before the next toggle, which lets the restore frame pass. Locally the test failed 6 of 6 runs before and passed 16 of 16 after, and 12 of 12 copies at 6x CPU throttle with 2 busy loops. Closes #7503
This was referenced Nov 28, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 28, 2026
…necessary test_evidence_close_folds_room_but_retires_controls_immediately again presses each toggle right after the last, as a user can. The comment that explained the waits described the write-back race this branch fixes, so it no longer held.
leaf-agent
added a commit
that referenced
this pull request
Nov 28, 2026
…gle left it (#7515) Effect UI treats a `details`' `open` as controlled and writes the Model's value back one animation frame after each `toggle`. When the user toggled the same `details` again before that frame, the write-back undid the second toggle, and the browser merged its queued `toggle` into one reporting no change, so the Model never heard of it. That dropped the second of two quick presses on `lf-call-diff`'s roots and `lf-toc`'s contents disclosure, which both draw through Effect UI and keep `open` in their Model. A pnpm patch to Effect UI's host (`build/@effect__ui.patch`, applied the same way as the existing Plot and Pierre patches) records the state each node's latest `toggle` reported. Its restore skips a `details` whose `open` differs from that state, because a `toggle` for that node is still queued and its own restore follows once the Model hears it. A Model that refuses the toggle still gets its value written back on that later restore. Dialogs and popovers take their own restore branches and are untouched. The only rebuilt bundle is `browser/vendor/effect-ui.js`. The patch should go once Effect UI ships the fix upstream. Effect-TS/ui isn't taking issues while it moves into the Effect monorepo, so nothing has been filed there. `test_a_second_toggle_before_the_next_frame_holds` presses a call-tree root twice, with the second press in a frame callback that runs just before Effect UI's write-back. It then waits for the second `toggle` and a frame its listener queues, which runs after the restore Effect UI queued for that toggle, asserts the event reports the press's own change, and reads `open` once after `rendered`. It failed 4 of 4 runs on the unpatched bundle, each at the event's state, and passed 5 of 5 with the patch. `test_render_toc_disclosure.py` on Chromium (14) and `pnpm run test:runtime` (1237) pass. This also removes the `rendered` waits #7510 added to `test_evidence_close_folds_room_but_retires_controls_immediately` and its comment explaining them, which described the race this patch fixes. That test again presses each toggle right after the last, and it passed 3 of 3 on Chromium and Firefox after the removal. Closes #7509 — automated triage --------- Co-authored-by: leaf-agent <[email protected]>
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.
The
browser-callcopy oftest_evidence_close_folds_room_but_retires_controls_immediatelytoggled the call tree'sdetailsseveral times in a row, and some toggles were undone.lf-call-diffdraws through Effect UI, which controlsopen. After atoggleevent, Effect UI writes the Model'sopenback one animation frame later. If the next toggle lands before that frame, it is overwritten with the Model's older value, and the browser merges the two pendingtoggleevents into one that reports no change.The test now waits for
renderedbefore each toggle that follows another toggle. The reading right after each toggle is still immediate, so the test still checks that opening is instant and that closing retires the controls at once. Neither the media emulation nor the CSS transition was involved. The trace shows the reopen coming from Effect UI's restore frame (restoreSoonin@effect/ui'shtml/internal/dom.ts).Verification on this runner: the base failed 6 of 6 runs of the node id, at the third and fourth toggles. With the change it passed 16 of 16 runs, plus 12 of 12 copies through
leaf-dev suite flake --cpu-throttle 6 --load 2. All four parametrizations pass.A user who toggles twice within that window loses the second press the same way. That product defect lives in Effect UI and also reaches
lf-toc. It is tracked in #7509, since Effect-TS/ui isn't taking issues during its move into the Effect monorepo.Closes #7503 — automated triage