Skip to content

fix: keep a details where the user's press left it when Effect UI redraws before its toggle - #7522

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-7521
Nov 28, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-7521

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Effect UI writes a details' controlled open from two paths: the restore one frame after a toggle, and the render each message brings. #7515's patch (build/@effect__ui.patch) taught only the restore to wait while a press's toggle is still queued. A render in that gap still writes the Model's older open back. That undoes the press, and the browser merges the queued event into one reporting no change, so the Model never hears of the press. In test_call_diff_projects_stable_commentable_rows, the test folds the call tree's root and presses Enter on the root's location. When the Enter lands before the fold's toggle, the location's message redraws the tree and reopens the root. That is #7521's failure.

The patch now sends both paths through one guard, writeOpen. It skips a details whose open differs from the state the host last knew for it. It also records each value the host writes or finds, so a node's first press is covered too. A Model that refuses a press still gets its value written back by the restore that the press's toggle brings. Dialogs and popovers take their own branches and are untouched. The only rebuilt bundle is browser/vendor/effect-ui.js.

Verification. The new test test_a_fold_redrawn_before_its_toggle_holds folds a root and presses its location in one task, which forces the redraw ahead of the toggle. It failed 2 of 2 on main's bundle, where the toggle reported open, and it passes with the patch. The bundle from before #7515 fails the same forced ordering, so the race predates #7515, and #7515 left the render path unguarded.

Other checks run
  • test_call_diff_projects_stable_commentable_rows: 24 of 24 under leaf-dev suite flake --workers 4 --load 2. Before the fix it failed about 1 in 25 locally, on Chromium, and the failure matched CI's capture: the patch line was focused and the root was open.
  • test_render_toc_disclosure.py together with the call-diff, toc, toggle and fold tests in test_render_diff_controls.py: 24 passed.
  • pnpm run test:runtime: 1237 passed.
  • pnpm run check:browser reproduces the committed bundle from the updated lock.

Closes #7521 — automated triage

…raws before its toggle

Effect UI writes a `details`' controlled `open` from two paths: the
restore a frame after a `toggle`, and the render each message brings.
#7515's patch (`build/@effect__ui.patch`) taught only the restore to wait
while a press's `toggle` is still queued. A render landing in that gap
still wrote the Model's older `open` back, undid the press, and the
browser merged the queued event into one reporting no change, so the
Model never heard of it. In
`test_call_diff_projects_stable_commentable_rows` that is a fold of the
call tree's root followed by Enter on the root's location before the
fold's `toggle` arrives: the location's message redraws the tree and
reopens the root.

The patch now sends both paths through one guard, `writeOpen`, which
skips a `details` whose `open` differs from the state the host last knew
for it, and records each value the host writes or finds, so a node's
first press is covered too.

`test_a_fold_redrawn_before_its_toggle_holds` folds a root and presses
its location in one task, so the redraw comes before the `toggle`. It
failed 2 of 2 on main's bundle (the `toggle` reported `open`) and passes
with the patch. The bundle from before #7515 fails the same forced
ordering, so the race predates #7515; #7515 only left the render path
unguarded. `test_call_diff_projects_stable_commentable_rows` passed 24 of
24 under `leaf-dev suite flake --load 2`, the call-diff, toc and toggle
tests in `test_render_diff_controls.py`, `test_render_toc_disclosure.py`
pass (24), `pnpm run test:runtime` passes (1237) and
`pnpm run check:browser` reproduces the committed bundle.

Closes #7521
@leaf-agent
leaf-agent merged commit 6313a6f into main Nov 28, 2026
9 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-7521 branch November 28, 2026 12:21
max-sixty added a commit that referenced this pull request Nov 28, 2026
…7545)

Leaf stops patching Effect UI. `build/@effect__ui.patch` (#7515, #7522)
held one guard: the host skipped writing a `details`' controlled `open`
while the user's `toggle` for it was still queued. Since #7542 no view
controls `open`. `lf-call-diff` and `lf-toc` seed it with an attribute
the view never changes, and `lf-worktree` writes an attribute only when
its host's authored `open` changes. Effect UI writes an attribute only
when the drawn value changes and never restores one, so the guard ran
for no node. The rebuilt `browser/vendor/effect-ui.js` is byte-identical
to the bundle before #7515.

The race lives in the controlled idiom itself. The browser reports a
fold with `toggle` a task after making it, and a draw or restore in that
gap undoes the fold, even where the Model follows `toggle`. So a widget
leaves a fold to the browser, and `effect-widget.ts`'s list of Effect
UI's limits now says why.

Max asked to avoid the patch ("it's much more likely we misunderstood
something rather than the upstream needs patching"). The two race tests
from #7515 and #7522 keep their assertions and pass on the unpatched
bundle, 12 of 12 copies each under load; with the views from before
#7542 put back, they fail. The `lf-call-diff`, `lf-toc` and
`lf-worktree` browser tests, `pnpm run test:runtime` (1240) and `pnpm
run check:browser` pass.

> _This was written by Claude Code on behalf of max-sixty_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_call_diff_projects_stable_commentable_rows: the call tree's root reopens after Enter on its location, since #7515

1 participant