Repository navigation
Hold the version menu's nightly case on an open composer reached by keyboard - #996
Conversation
…ed draft box `test_a_stamped_live_draft_and_its_unstamped_view_keep_distinct_menu_rows` kept the page on revision 2 by filling the Threads panel's general box and leaving the caret in it. That hold is `midComposition`'s focused-textarea reading, and it ends the moment focus leaves the box — which is what the very next line does, since every secondary banner control stands behind More and `banner_control` presses that door to reach the chooser. Whether the page was still on revision 2 when the menu opened then came down to whether the next state read landed inside that window, so the case read three rows instead of four whenever the read won. `skills/leaf/assets/CLAUDE.md` already settles which hold outlasts a press: a hold defers a revision for a gesture that is not a value — an open composer, a drag, an unresolved delivery, an open menu — and the draft store, not a hold, is what carries words across an install. So the case now holds the page with the selection composer, which stands on its own through any press, and waits on the news the third revision lights rather than on a title the page already carried before the write.
|
The case this PR repairs is nightly-only, so it does not run on a pull request. Its evidence is in the description: green under |
leaf-agent
left a comment
There was a problem hiding this comment.
The composer hold does not outlast the press that reaches the chooser, so the race this PR reports is still live. standDown in skills/leaf/assets/runtime/composing/surface.js runs on every document mousedown (document.addEventListener("mousedown", (ev) => { if (!drawModeActive()) standDown(ev.composedPath()[0]); })), and its guard exempts only the response bar's own layer — !target.closest?.(".lf-fab-bar, .lf-react-surface, .lf-composer") — before if (composerOpen) hideComposer(). The More door is none of those, so banner_control(page, ".lf-version").click() stands the composer down on its first press, exactly as it used to take focus out of the general box. Whether the page has followed by the time the menu opens still comes down to whether a state read lands between the two presses.
Measured on this runner by replaying the case's arrangement in the merged checkout: right after the More press .lf-composer[data-lf-open] is already gone, and holding a window open between the two presses reproduces the nightly's failure unchanged.
The composer is still the right hold — it is what survives focus moving to the door — but it needs a press that is not a mouse press. standDown is wired to mousedown only, so reaching the chooser by its keyboard route leaves the composer standing through both presses. I'm pushing that as a follow-up commit here.
The PR description's account of how the three nightly failures were separated stands; it is the repair that doesn't hold. Worth correcting there too, since the description is main's commit message for this change.
Probe output
The PR's arrangement, with a 1.5s window forced between the More press and the chooser press:
PROBE after told, composer open: True
PROBE after More press, composer open: False
PROBE title after More: Live second
PROBE title after 1.5s wait: Live third
PROBE rows: 3
PROBE title: Live third
The pre-PR arrangement under the same forced window, for comparison:
OLD: title after More: Live second
OLD: title after 1.5s: Live third
OLD: rows: 3
Three rows and Live third are what the nightly reported. With the keyboard route in place, the same forced window (1.2s at each press) leaves composer open: True, the title at Live second, and four rows.
The composer was the right hold and not enough on its own: standDown hides it on any document mousedown outside the response bar's own layer, and the More door is outside it, so pressing through to the chooser ended the hold on the same gesture the focused draft box used to lose it on. standDown is wired to mousedown only, so the case now presses Enter on the More door and on the version control, and the composer stands through both.
The nightly suite on 453e957e (run 35819929850) ended with three failures. Two of them were the banner's 320px row and are already fixed on
main; the third is a race intest_a_stamped_live_draft_and_its_unstamped_view_keep_distinct_menu_rowsthat still reproduces, and this PR repairs it.The case kept the page on revision 2 by filling the Threads panel's general box and leaving the caret in it. That is
midComposition's focused-textarea reading, and it ends the moment focus leaves the box — which is exactly what the next line did: every secondary banner control stands behind More, sobanner_control(page, ".lf-version")presses that door to reach the chooser. Whether the page still showed revision 2 when the menu opened then came down to whether the next state read landed inside that window. When the read won, the page followed to revision 3, and the menu — which deliberately freezes its rows while its popover stands — held three rows against the expected four.skills/leaf/assets/CLAUDE.mdalready settles which hold outlasts a press: a hold defers a revision for a gesture that is not a value — an open composer, a drag, an unresolved delivery, an open menu — and the draft store, not a hold, is what carries a reader's words across an install. Getting there takes both halves of this diff. The case now holds the page with the selection composer, which does not end when focus moves; and it opens More and the chooser from the keyboard, becausestandDownruns on every documentmousedownand stands the composer down for any target outside.lf-fab-bar, .lf-react-surface, .lf-composer— so a mouse press on More would have ended the hold on the very gesture that opens the menu. It also waits on the news the third revision lights (data-lf-newson.lf-version) rather than onto_have_title("Live second"), which the page already carried before the write and so stated no ordering at all.How the three failures were separated
All three were reproduced on this runner against the exact SHAs, with
-n0and explicit node ids.The two banner failures were real and are already fixed. On 453e957 they reproduce with CI's exact numbers:
Both pass on afb21331 (#974), which took the unread marker off the Threads button's label and gave the 320px row its 1px back. That landed at 06:14, after this nightly started at 05:57, so the run could not see it. Both also fail on the preceding nightly's commit 54fc744 and pass on every commit from afb2133 onward, including current
main.The third failure is this PR's. It is not deterministic on a quiet machine — 1 failure in 13 local runs of the unmodified case — which is why it appeared in this run and not the one before. Forcing the condition makes it deterministic: inserting
page.evaluate("() => document.activeElement.blur()")before theLIVE_V3write fails the unmodified case on every run, on the merge base 878780ea, reporting the same 3 rows CI reported. The rows it holds name the third revision (Current · Draft after v2atdata-lf-revision="3"), confirming the page had followed rather than held.The repaired case is green at this branch's head, and
uv run pytest tests/test_render_projection.py --run-nightlywas green (152 passed) on the first commit's arrangement.