Repository navigation
Reserve one-line rewrite height in margin messages - #2959
Merged
Merged
Conversation
leaf-agent
marked this pull request as draft
October 15, 2026 03:57
leaf-agent
added a commit
that referenced
this pull request
Oct 15, 2026
A margin card now stays at the end of its latest turn when that turn exceeds the transcript by less than its visible header. Previously any excess aligned the turn at its top, hiding a sent drawing reference below the text viewport and moving a nearly fitting message away from the transcript end. A genuinely long turn still lands on its head. The focused drawing variants pass, and the rebuilt browser runtime passes all 493 tests. With the rewrite-height reservation in #2959, the 250 px margin-ring case also passes locally. --------- Co-authored-by: leaf-agent <[email protected]>
leaf-agent
marked this pull request as ready for review
October 15, 2026 04:16
leaf-agent
force-pushed
the
fix/ci-38662520639-rewrite-card
branch
from
October 15, 2026 04:16
fd634cc to
7028a93
Compare
max-sixty
added a commit
that referenced
this pull request
Oct 15, 2026
…ivery #2959 reserved a short editable margin message's one-line rewrite height only once the message carried Edit, which arrives with delivery. With Send no longer carrying the comment box's frame into the card, every one-line comment card then grew 10px when "Sent" arrived, and a card holding its foot while sending moved its words up 10px. Reserving the room for any turn of the user's from its first paint keeps both the delivery and the rewrite still. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 15, 2026
) Pressing Send turns the comment box into the new thread's margin card without moving a word, and the card still grows out of the box. The box and card now share a text column and placement rule, replacing the earlier carry that pinned the first message to measured width, writing measure, height, inner scroll, and Send room. Send still carries the box's placement and its distance from the editor's scroll end, so a draft scrolled back from its end opens at the same lines. ## What users see - **Words stay put on Send** in every case measured: short, multi-line and long scrolled comments, at 1280 and 390 wide, zoom 1.1, and touch. - **The grow-out stays.** A CSS animation on the card (`data-lf-grows`) opens a clip from the field's edges to the card's over 240 ms. The field's edges are the frame's existing size tokens (`--lf-comment-frame-top/inline/bottom`), so nothing is measured. The card is whole and pressable under the clip. - **An empty comment box is wider at rest: 242 → 320 px.** Its minimum width is now the card's (`--thread-card-min`), so the clip starts exactly on the field's right edge. - **Reduced motion** swaps box for card with no animation. - **On desktop, margin-card text ends 30 px from the edge instead of 13.** The box and the card share one text column (`--lf-comment-text-end`, which is Send's hit box plus its inset). The box keeps Send's room on every line, not only after the last one, and card messages end at the same inset. Touch is unchanged, since it already reserved Send's room on every line. - **A long comment's card opens at the lines the box showed** (`showArrival`). The box and the card share their text column and their bottom edge, so the box's distance from its end, carried with the frame the card already adopts, places the card's words where the box showed them. That holds whether the draft rests at its end or the user scrolled back through it. The field's caret reveal now includes the caret line's leading and its `scroll-padding`, so a draft typed to its end rests at its true end. - **A one-line comment's card is 10 px taller than its box.** A turn of the user's now reserves its one-line rewrite room from first paint rather than from delivery. Without the carry, #2959's reservation made every one-line card grow 10 px when "Sent" arrived, and a card holding its foot moved its words up. ## Why not View Transitions I tried a view transition first: the box and the card shared a `view-transition-name`, and the morph held the words still (0 px in every captured frame). I dropped it for three reasons: - It holds the page's paint from Send until the card stands: the first frame came 37–51 ms after the key, against 5–21 ms today. - Presses at the card's position reach the page underneath for the 240 ms. - Its paint hold let the server's reading land before the gesture's first frame, which needed changes to the test harness's input and shift watches and still failed the long-draft case in 6 of 8 runs. ## Size Against main (`git diff --numstat`): | | added | removed | |---|---|---| | Code (runtime JS, CSS, stills) | 95 | 215 | | Tests | 22 | 101 | | Generated kernel/CSS | 54 | 137 | ## Word displacement on Send Settled positions are measured from layout with `leaf-dev probe --base`. Mid-animation positions compare the pixels of each frozen frame (0/60/120/180 ms and settled) against the draft. | Case | Before this change | Deleting the carry alone | This change (settled) | This change (mid-animation) | |---|---|---|---|---| | short, 1280 / 390 | 0 | 0 | 0 | 0 | | multi-line, 1280 | 0 | 0 (no rewrap by luck) | 0 | 0 | | multi-line, 390 | 0 | 299 px | 0 | 0 | | long scrolled, 1280 | 0 | 399 px | 0 | 0 | | long, scrolled back to its start, 900 | — | — | ≤0.75 px (test) | — | | long scrolled, 390 | 0.02 | 586 px | 0.02 | 1 px (rounding; also before) | | multi-line, zoom 1.1, 1280 / 390 | 0.07 / 0.06 | 363 / 282 px | 0.04 / 0.04 | 0 | | touch, multi-line / long | 0 / 0.02 | — | 0 / 0.02 | 0 | Markdown drafts still reflow on Send, since the message renders what the draft shows as markup. A rendered table can also make the card narrower than the box, so the clip then starts left of the field's right edge. ## Tests - `test_send_grows_thread_around_the_words` again asserts every word's position through Send, and now also that the card grew. It fails with the shared end inset removed (7 of 8 cases) and with the growth disabled. - Tests that asserted the carried frame, the `endRoom` mode, or the measured clip were trimmed to what they still protect. - The diff-controls journey dresses the one new token. - The smoke test for reading keys in a submitted comment (`test_reading_keys_follow_a_submitted_comment_s_viewport`) now reads the card's transcript. Since the first message no longer scrolls on its own, the transcript is that comment's viewport. Ran on the merged tree: - `tests/smoke` - `tests/browser/test_render_send_placement.py` - the send, rewrite, zoom and scaled-draft tests in `test_render_threads.py` and `test_render_projection.py` - `test_render_aim.py::test_a_compact_comment_carries_its_box_into_the_inline_thread` - `test_render_margin.py::test_a_sent_comment_keeps_its_text_viewport` - `test_chrome_contracts.py::test_send_room_moves_to_every_line_only_while_the_field_scrolls` - `test_render_outbox.py::test_a_comment_field_scrolled_away_and_back_is_still_there` - the diff-controls journey That is 82 tests, all passing. `pnpm run test:runtime` passes 493/493 and `pnpm run check:browser` is clean. On main before the last commit here, `test_send_grows_thread_around_the_words` (three cases) errors on the same 10 px delivery move. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 18, 2026
…ving room (#3064) A one-line comment's sent margin card is now as tall as the comment box it came from (148 px, against 158 on main), and nothing in it moves when "Sent" arrives or when its rewrite opens. ## Why the card was taller Every user message in a margin card kept room from its first paint for the reply box's taller rewrite field (#2959, moved to first paint in #2985), whether or not the user ever opened the rewrite. Delivery itself needs no room, since "Sent" and the Edit control already stand in the message's head. ## What changes - **The card's rewrite is the comment box the card grew from.** Its frame and padding fit the 5.5 px each card line already keeps, and its words end at the card's text column, so opening it on plain words moves none of them and changes no height. On main, a two-line comment rewrapped to one line in the wider editor and the card shrank 11 px. Markdown still opens as its source, which can be longer than the drawn message, as on main. Outside the margin card the rewrite still matches the reply box, as #2813 decided. - **The card's rewrite field is 10 px shorter than the reply field below it.** The user chose this over matching the reply box, which would make the card grow 10 px when a rewrite opens. - **`skills/leaf/assets/AGENTS.md` states the principle.** Hold room before first paint only for what will be drawn. Hold no empty room for a state that may never come, however likely; show it in a slot already on screen and let the user's gesture make the room it needs. ## Tests The card cases of `test_a_rewrite_is_the_reply_box_where_the_words_stood` and `test_a_rewrite_of_a_comment_just_sent_is_the_reply_box` now assert that the message keeps its height and its words their line, in place of the field matching the reply box's height and padding. Ran, after updating from main (which moved these tests to `tests/browser/threads/test_rewrites.py`): that file, `tests/browser/margin/test_card_reply.py`, `tests/browser/margin/test_card_placement.py`, `tests/browser/test_render_send_placement.py`, `tests/browser/test_render_aim.py`, `tests/browser/threads/test_composing.py`, and `pnpm run check:browser`. All pass. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 25, 2026
…pair (#4149) Since `merge: yolo`, Tend's self-review is the only gate on the 626 pull requests it has authored and merged, and at least 17 of them were later reverted, replaced or broke main. Most cost every user or later change something to fix one case: room reserved in every margin message for a rewrite that may never open (#2959), a third wrapping mode (#3678), a guard refusing writes whenever a code hash changed (#2416), a public knob nobody needed (#3830), every sent message narrowed 86px to pass a test (#3679). The review threshold ended the review once the claimed path worked and omitted "minor simplification", and the review logs show reviewers stopping there; the upstream "Does the change carry its weight?" never produced a finding. ## Changes - **`/developing-leaf` gains "Weigh what a change adds"**, the forward version of the Regular maintenance bar, for whoever writes or reviews a change: what it adds, what that buys, who pays and who gains, and the cheaper change. - **The running-tend review threshold** points to it, counts an addition that costs more than it buys as a finding rather than polish, widens "regressions on the claimed path" to anywhere the change reaches, and has the reviewer state the weighing in the session before searching for defects, since on Tend's own pull request a defect found in an addition gets fixed and the addition lands. Findings that ask a change to cover more (compatibility, bounded edge cases, work outside the diff) stay omitted. - **A CI repair that changes what a page draws** names the states it changes, and its review captures each with `leaf-dev stills` on base and head and looks at the crops before the verdict. The review makes the captures because a bot's description can't carry images. ## Validation An offline replay of Tend's Codex reviewer (`gpt-6.1-sol`, the tend review skill, history cut at each merge, no network or tests), with only these two files differing between arms, over five bad merges and three good ones: | Arm | Bad PRs held for the cost the later fix removed | Good PRs held for complexity | |---|---|---| | main | 0 of 10 | 0 of 6 | | criterion as a pointer only | 0 of 5 | 0 of 3 | | weighing stated before the verdict (four wordings, pooled) | 7 of 40 | 0 of 24 | A hold for an edge-case bug didn't count. The counts are small (p ≈ 0.3), though the direction held in every round. #3679 was never caught by any arm, which is what the stills rule is for; that rule has no replay, since the replay ran without a browser. Closes #4130 > _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.
A short editable message in the margin card now reserves the height of its one-line rewrite field. Opening the rewrite previously grew the message by 10 px and moved its top while the reply below stayed fixed. The focused rewrite test passes on all four surfaces, and the rebuilt browser runtime passes all 493 tests.
The reserved height depends on #2957's latest-turn landing rule to fit a message in the 250 px margin card. That change has landed, and the combined case passes.