Repository navigation
Description
Two browser tests end with an unchanged-write finding since #6936 (9aa6fdcd2, "Drive LeafElement through the property and events a plain element gets"). In each one, a script takes a value off a widget's node and puts it back in the same task:
tests/browser/drafts/test_shared_drafts.py::test_one_shared_added_option_has_one_action_payload_across_tabs:unchanged write: selected on lf-option#job-mountstests/browser/test_render_files.py::test_a_reload_that_loses_a_saves_answer_keeps_the_typing_after_it:unchanged write: tabindex on div.cm-content.cm-lineWrapping in #shadow-root in lf-file-editor#notes-file
Both errors are raised in teardown by the write watch (tests/write_watch.js). It reports a write when a script leaves an attribute holding the value it started with, so a restated value fails the test.
Runs: first seen in ci run 45327285035 on 4660b588e. Both still fail locally on 77da815d6, deterministically, at the same nodes.
Bisect (git bisect run over 8bbb4ee1c..4660b588e, each test on its own): both pass at e9c4cc6bb and fail from 9aa6fdcd2 (#6936) on.
Diagnosis so far. #6936 rewired lf-options (packages/default/widgets/lf-options.js) and lf-file-editor (packages/file-editor/widgets/lf-file-editor.js) onto this.state and record(). It also changed when a LeafElement draws: it draws inside Leaf's set of state, and each update becomes a pending-task. lf-options writes selected only in #syncChoice, through toggleAttribute(…, selected). A force-toggle that matches the current state makes no mutation, so the finding means selected was taken away and put back within one script. A likely cause is two syncs in one task that read different choices: an authored or empty one first, then the logged one. Nobody has traced it yet. The file editor's tabindex flip on CodeMirror's content is unexplained too. It may be a separate mechanism, such as the editor being reconfigured editable/read-only around a redraw. Each test needs its own trace, with window.lfWrites (see the write_watch.js header) recording the stack of each write.
#6963 fixes two other tests that #6936 broke in the same run (inline test widgets missing the new reactive value declaration). It doesn't touch these two.
Cause of a failure tracked in #6960.
Activity
leaf-agent commentedon Nov 24, 2026
#6973 fixes both findings. Its review, CI and landing are with the PR's own workflows. The two have separate causes.
tabindexinlf-file-editor: the CodeMirror view was created read-only, and a draft kept across the reload was recovered only afterwards. So the first paint in the same setup task made the file writable, andtabindex="0"was added and removed in one script. The PR recovers drafts before creating the editor and starts the editor with the read-only state the paint would give it.selectedinlf-options: this one comes from the test. It forgesselectedon#job-mounts, a selection the tab's state never held. The click'sadddraw put the DOM back to the state, and the pick in the same click restored it. Two syncs reading different choices is not the cause. The PR has the test drop the forged attribute once the draft generation has recorded it. The pick assertion still requires the generation's recorded choice. The widget is unchanged.Both tests failed on
7da7a6a71and pass on the branch.