Skip to content

fix: let the words watch count typed words a draft join keeps in their field - #6587

Merged
leaf-agent merged 2 commits into
mainfrom
fix/issue-6418-words-join
Nov 20, 2026
Merged

leaf-agent merged 2 commits into
mainfrom
fix/issue-6418-words-join

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

The words watch reported a false loss when a draft join kept the user's words in their own field. Since #6454, a tab whose draft write never reached the server joins its unsent words to another tab's later ones, so the field goes straight from mine to theirs\n\nmine (bothWords in browser/runtime/drafts.js). The watch decided whether a field still held its words by exact equality, so it read the join as the words leaving the screen. Its other-tab credit only sometimes rescued the test, depending on whether the joined write went out before the field repainted. That made test_unsaved_words_join_another_tab_s_later_words_in_every_tab fail at teardown in run 44666096308 with typed words left the screen without a key or press.

The watch now counts a drawn field whose text still contains the held words as holding them, and remembers that longer text, so a field a re-render puts in its place showing the same text inherits the words, as one showing the bare words already did. A text that drops them is still reported, on either field. Nothing in the product changes.

Verification:

  • leaf-dev suite flake <that test> --cpu-throttle 8: 0 of 18 copies passed before, 18 of 18 after. It fails the same way on Keep a tab's unsent words beside another tab's, rather than dropping them #6454 itself, on the run's commit and on current main.
  • A probe that sampled the field every frame recorded the same three values in all 18 copies: empty, the typed words, then the join. No frame shows the words gone.
  • The new cases in tests/runtime/words-watch.test.mjs fail before the change and pass after it. They check that a join keeps the words, in the same field and in a replacement showing the joined text, and that a later text without them is still reported.
  • tests/browser/test_render_words_watch.py and tests/browser/drafts/test_shared_drafts.py pass: 139 tests.

A field whose new text happens to contain short typed words now counts as still showing them. A loss that removes the words from the text is still caught.

Refs #6418 — automated triage

…r field

#6454 made a tab whose draft write never reached the server join its unsent
words to another tab's later words: the field goes straight from the typed
words to `theirs\n\nmine` (`bothWords` in runtime/drafts.js). The words watch
asked whether a field still held its words by exact equality, so it reported
that join as typed words leaving the screen unless its other-tab credit
happened to apply, which depends on whether the joined write went out before
the field repainted. `test_unsaved_words_join_another_tab_s_later_words_in_every_tab`
failed that way at teardown in ci run 44666096308, and fails 18 of 18 copies at
`--cpu-throttle 8` back to #6454 itself.

The watch now treats a drawn field whose text still contains the held words as
holding them. A text that drops the words is still reported, which the new
runtime case checks alongside the join.

Refs #6418
@max-sixty

Copy link
Copy Markdown
Owner

@leaf-agent The new focused test covers a joined draft while its original textarea remains mounted, but the watch still reports a loss when a re-render replaces that field with a visible textarea containing the identical joined value. Once the original node disconnects, both look() and judge() call shownIn(held.words), which requires exact field identity and misses the replacement. Please preserve the watch across that handoff, and verify that removing the words from the replacement still reports their loss.

This was written by Codex on behalf of max-sixty

…place

The words watch now remembers the longer text a field last showed the held
words within, and a laid-out field showing that exact text inherits them, as a
field showing the bare words already did. Before, once the joined field
disconnected, the watch looked only for a field holding the bare words and
reported a loss. A text that drops the words is still reported, on the
original field or its replacement.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Fixed in a82fe09. The watch now remembers the joined text a field last showed the words within (held.shown), and shownIn hands the words to any laid-out field showing either the bare words or that exact text. So a re-render that replaces the joined field keeps the watch on the replacement. I didn't widen the hand-off to any field that merely contains the words, because that would let an unrelated field holding a short phrase hide a real loss.

The runtime test now runs for both the in-place field and a replacement textarea that has the joined value. In each case, setting the field to Theirs reports the loss. The replacement case fails without the change. Locally, tests/runtime/words-watch.test.mjs (5), tests/browser/test_render_words_watch.py (106) and the join test in test_shared_drafts.py pass.

@leaf-agent
leaf-agent merged commit 53e073b into main Nov 20, 2026
7 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-6418-words-join branch November 20, 2026 07:43
max-sixty added a commit that referenced this pull request Nov 20, 2026
)

The floating panel's row drops its On Me mark (the inbox icon). The row
is now the field, then the leaf, which takes both roles: it wears the
folded leaf's badges, its count of what waits on the user on a pill over
its corner and its news and error dots beside it, and a press opens the
On view on the tab those marks point at: the menu while an error waits
unseen in Errors, else On Me while anything waits, else Threads while a
thread has news or a draft waits, else the menu. A second press closes
the On view from any tab. A search's or mode's ✕ stands at the field's
end, before the leaf. Tab walks the row as it stands: the field, its
corner control, then the leaf. The leaf draws no ground, neither the
hover fill nor the chip while its view stands open, since its badges
stand over its top edge and a tile's edge met them; the user asked for
the tile to go, and other symbols keep their chip. Folded, the leaf
looks as before, and the fold now gathers into the side the leaf stands
on.

| | Before | After |
|---|---|---|
| At rest | <img
src="https://gist.githubusercontent.com/max-sixty/96b80ba99167f1fcc508eead8cfa0e1f/raw/fe68068fce0f803381db419ecd82297d992d4526/rest-before-ff.png"
width="420"> | <img
src="https://gist.githubusercontent.com/max-sixty/96b80ba99167f1fcc508eead8cfa0e1f/raw/fe68068fce0f803381db419ecd82297d992d4526/rest-badge.png"
width="420"> |
| Draw mode | <img
src="https://gist.githubusercontent.com/max-sixty/96b80ba99167f1fcc508eead8cfa0e1f/raw/fe68068fce0f803381db419ecd82297d992d4526/draw-before-ff.png"
width="420"> | <img
src="https://gist.githubusercontent.com/max-sixty/96b80ba99167f1fcc508eead8cfa0e1f/raw/fe68068fce0f803381db419ecd82297d992d4526/draw-badge.png"
width="420"> |

The badges hang past the leaf's top-left corner, so the leaf stands the
row's padding (6px) further off what precedes it: at the row's 2px gap
alone, the dots sat on the field's focus ring while the user wrote. That
gutter is the one call here the user didn't make; the badge in the row
and the press rule are theirs. Now that the field stands first, its slot
reaches out to the panel's start edge only while it wears the ring, so
the attachment shelf takes its start from the panel's edge and its
measure from the editors, which stay put: hung from the slot, a press on
a picture moved it from under the pointer. The test changes mostly
retarget selectors; `leaf_dev.browser.open_menu`, `on_tab` and
`open_on_me` reach the menu and the On view's tabs by pointer whatever
the leaf opens on.

Asked for by the user, who picked both the badge and the press rule on
the decision page. Tests: the browser tests whose code or helpers this
touches and the journeys that press the leaf or call those helpers,
locally; `pnpm run check:browser`; `pnpm run test:runtime`. A
[full-suite
run](https://github.com/max-sixty/leaf/actions/runs/44667922425) on an
earlier commit found the tests the new order broke, each rerun since by
node id, and a [second full
run](https://github.com/max-sixty/leaf/actions/runs/44708464239) on the
head finds nothing this change causes. Of its failures,
`test_the_shipped_long_thread_keeps_the_margin_and_its_height`,
`test_an_old_document_state_request_cannot_update_the_new_revision` and
`test_page_fixture_opens_without_firefox_console_warnings[thread-panel-gallery]`
fail in [main's nightly
run](https://github.com/max-sixty/leaf/actions/runs/44722728605) too;
`test_trace_replaces_captures_without_blank_pixels_or_layout_displacement`,
where a margin pin lags a script's instant scroll by a frame, fails at
the merge base;
`test_unsaved_words_join_another_tab_s_later_words_in_every_tab` trips
the words watch #6587 has since fixed on main; and Firefox's
`test_a_wheel_as_the_thread_gives_up_room_moves_it_as_far_as_without`
and
`test_a_carry_draws_the_way_of_a_step_news_may_take[overshoot-False-True]`
pass 6 of 6 locally.
`test_presses_and_fills_leave_no_element_naming_stale_keys[file-tree]`
fails whenever its random sweep leaves the file tree at its list's end,
where the vendored tree writes a `scrollTop` that moves nothing: 2 of 5
local runs on main, and every run here, since the row's one fewer
control reshuffles the sweep. #6595, now merged, fixes that write.

Left for a follow-up: a pointer on the leaf brings the panel's corner
fold mark over the count, which now holds that corner. Where the mark
goes is the user's pick.

> _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.

2 participants