Repository navigation
Set Tend's review threshold for Leaf's stage - #86
Merged
Merged
Conversation
leaf-agent
approved these changes
Aug 28, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 12, 2026
…rgin card to its outlet (#2614) Item #86 of the Lit follow-up review. The review numbers its own items, so #86 is not a GitHub issue. This follows #2604, which carries a reply being written from a widget's outlet into the margin card. ## #86 (a): a reply being written goes back with its thread to the outlet **What changed.** A thread can go back from the margin card into a widget's outlet while the user is typing its reply in the card. A diff thread does this when the patch it was written on returns. The user now goes on in the same editor on the diff line, at the same caret, with its undo history. Before, the card closing under them landed them on the banner's More button, so the next letters ran page commands. This also happened before #2604. **Cause.** The thread pass closes the card in `renderAnnotations`, before its reply hand-off (`holdReply`) runs. `closePreview` defaults to `letGo`, and that placement voided the hand-off's hold. Once focus was handled, a second gap showed: `carry` refused a row any view still held, so the hidden card kept the user's editor and the user landed in the outlet's own editor without its history. **How.** - `thread/focus.js`: `holdReply` records the box its pass is carrying until its step has run. `carryingReply(node)` answers for it while the thread still stands with a reply and the user has done nothing since. The reply admission both use is one helper (`mayReplyTo`). - `margin-projection.js`: `closePreview` places no one when the user stands in a carried reply, so the hand-off decides where they go. - `thread/replies.js`: `carry` takes the row from a view that holds it out of sight, as the closed card does. That view gives it up (`binding.give`): it detaches, wires a fresh row, and draws it once the taker has moved the row out. **Lines.** Hand-written source: +73 / −26 (replies.js +37/−13, focus.js +31/−12, margin-projection.js +5/−1). Tests: +52 / −2. **Test.** `test_a_reply_box_whose_thread_returns_to_the_diff_takes_the_user_back` writes on the diff line, follows the thread to the card, types more there, and brings the patch back. It then expects focus, words and caret on the diff line, typing to continue, and two undos to walk back through the card's typing. On `main`, focus lands on `lf-banner-more`. With only the `closePreview` change, the user lands in the outlet's own editor and the undo fails. ## #86 (b): the remaining blur, not done The editor still blurs once on each move. Going to the card, the outlet is removed before the card exists, so a blur-free move needs a connected, rendered place to park the row. Coming back, the blur comes from ordering: the card hides before the carry, and `open` focuses the outlet's own editor first. Removing it means opening the destination without focus (`continueThread` already does this), carrying the row in with `move()`, which keeps focus through `moveBefore`, and only then closing the card. That changes the order in `presentation.js`'s commit and in `openPageThread`'s surface path, which closes the preview first. So this PR asserts no blur count. ## Test watch `tests/words_watch.js` now hears a `leaf-text`'s host `input` on the field itself. That event is not composed, so typing inside a widget's shadow tree, such as an `lf-diff` outlet, never reached the watch, and the words it held went stale. With the watch fixed, `test_replaced_reply_compositions_keep_their_carets_and_leave_commands` reports the words of the thread the margin card does not show. The test's own comment calls that state intended: that thread's session keeps its words and caret until the user selects its route. The test now consumes the report rather than asserting none. I read this as the rule's "no usable room" case in `skills/leaf/assets/AGENTS.md`, "Words stay where they were typed": the card shows one thread at a time. ## Checks These pass: - the seat, reply, diff, margin, draft, carried and resolved selections of `test_render_threads.py` and `test_render_drafts.py`; - the diff, outlet, composer, comment, editor and visual selections of the widget, anchor, read-state, file and diff-control browser tests; - `test_render_words_watch.py`, `test_thread_response_continuity.py` and `test_response_pointer.py`; - `pnpm run test:runtime`; - eslint, prettier and ruff format on the changed files. `test_the_reading_page_keys_follow_the_user_into_the_panel` failed once under load and passes alone. #2604 recorded it failing on the base too. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Teach Tend to finish once a change advances Leaf's architecture and its claimed path works, while reserving findings for architectural, invariant, public-surface, regression, or false-evidence problems.