Skip to content

fix: start the file editor as editable as its recovered draft, and stop forging a selection through a pick - #6973

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-6964
Nov 24, 2026
Merged

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

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Two browser tests have ended with an unchanged write finding since #6936. That PR made a LeafElement draw inside Leaf's set of its state, so two draws that used to land in separate tasks now land in one script. The write watch then sees the attribute end where it started. The two findings have separate causes.

  • lf-file-editor, tabindex on CodeMirror's content. The editor was created read-only, and a draft kept across a reload was recovered only after that. On reload the first paint in the same setup task found the file writable, so tabindex="0" was set and removed in one script. Drafts are now recovered before the editor is created, and the editor starts with the read-only state the paint would give it. Creation and the paint share one readOnly(of) rule.
  • lf-options, selected on #job-mounts. This one was made by the test. test_one_shared_added_option_has_one_action_payload_across_tabs forges selected in the DOM so that the draft generation records it, but the tab's state never held it. The click's add draw put the DOM back to the state, and the pick in the same click restored it. The test now removes the forged attribute once the generation has recorded it. Both tabs then send with their state's selection, and the test's picks == {("job-mounts", <added>)} assertion still requires the pick to come from the generation's recorded choice. The widget is unchanged. On a real page the DOM follows the state, so this double write can't happen there.

Both tests failed on 7da7a6a71 (current main when this run started) and pass with the change. Other checks that pass on this branch: the file editor's reload, retry, export, first-read-wait, phone and navigation tests in tests/browser/test_render_files.py, the other option test in test_shared_drafts.py, pnpm run check and pre-commit.

Closes #6964 — automated triage

…op forging a selection through a pick

Two browser tests ended with an unchanged-write finding after #6936 made a
LeafElement draw inside Leaf's set of its state.

lf-file-editor created its CodeMirror view read-only and recovered a kept
draft only afterwards, so on a reload with a draft the first paint in the
same setup task made the file writable: tabindex was set on the content and
removed again in one script. Drafts now come back before the editor exists,
and it starts with the read-only state the paint would give it, from one
rule both use.

test_one_shared_added_option_has_one_action_payload_across_tabs forged
`selected` on an option the state never held. The `add` draw put the DOM
back to the state and the pick in the same click restored it. The test now
drops the forged selection once the draft generation has recorded it, so
both tabs send with their state's selection and the picks still have to
carry the option only the generation recorded.

Closes #6964
@leaf-agent
leaf-agent merged commit 78480c2 into main Nov 24, 2026
7 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-6964 branch November 24, 2026 07:18
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.

Unchanged selected and tabindex writes in lf-options and lf-file-editor since #6936

1 participant