Skip to content

Grow threads around submitted comments without moving the text - #1587

Merged
max-sixty merged 16 commits into
mainfrom
codex/comment-thread-growth
Oct 2, 2026
Merged

max-sixty merged 16 commits into
mainfrom
codex/comment-thread-growth

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Submitting a floating comment now grows the thread controls around the words at their existing position. The composer is placed using the thread's footprint before typing, and the submitted thread adopts that frame and message viewport. This keeps the text stable above, below, or beside its target, including when the response options are expanded.

Composer and thread geometry share CSS measurements and one placement owner; all messages use the same reading gutter. Composer sizing measures occupied controls instead of counting unused frame space; the field and image strip stay in separate bounds on a phone. Typing and reopening a thread make scroll room using the content's height at its final width, so changed wrapping cannot carry the editor or waste page travel. Animation completion belongs to the live surface and survives repaint or cancellation. A changed thread is fitted before its next paint, so a sent reply grows once around its stationary reply field. The interaction gallery demonstrates the actual handoff, and playground labels remain selectable while their controls still work.

Validation covers word position, wrapping, scroll position, target reflow, expanded options, reduced motion, nested reading regions, reply placement, painted reply growth, and animation replay. All 16 send-placement browser cases, six reply-placement cases, and 191 runtime tests pass, along with browser and Worker checks and repository lint. Typing explicitly keeps an editor edge stationary for short comments, and four-image drafts verify the editor and response button stay disjoint at desktop and phone widths. Word ranges cross the editor's text-node boundaries so a ligature split does not masquerade as movement; phone placement verifies both clear and window-constrained geometry across fonts. The full Python gate also runs in CI.

This was written by Codex on behalf of max-sixty

Let readable labels accept native selection instead of treating the whole control row as an activation gesture. Toggle label text no longer flips the switch when clicked or double-clicked; the switch face and keyboard remain its activation routes. Preserve preview focus and caret while allowing the ordinary collapse of selections outside it, so an earlier label selection cannot deaden a later control click.
A deeply nested list can reach either the JSON parse boundary or the event-object boundary. Keep the final-refusal guarantee without requiring recursion exhaustion on interpreters that read the list successfully. Malformed bytes and malformed JSON still require the precise parse error.
Fit a transparent frame for the initial message, metadata and reply controls while placing the compact composer. Hand off that placement, text measure and scrollport to the real thread, then reveal its chrome with a clip animation instead of moving a copied-text shell.

The message keeps its reading viewport until the card closes; resizing releases its page-position hold. Room-making now requires the subject and actual frame to fit, avoiding a phone scroll that hid the selected passage and switched the draft into an unanchored posture.

Verify actual glyph positions through optimistic Send, acknowledgement and animation across desktop, touch, long drafts, paragraphs, existing threads and reduced motion. Rich Markdown can still reflow between source preview and sent rendering. Update the placement snapshot to compare the complete frames.

Validation: 1536 everyday Python tests, 189 runtime tests, 16 focused placement/corpus/resource checks, 9 glyph/viewport-fit cases, light/dark render checks and independent desktop/phone review.
Share editor and carried-message metrics in CSS. Placement adopts the composer attachment and owns its invalidation, while the message keeps its reading viewport. Reveal and focus share one placement completion and one cancellable animation. Cover attachment retention through scrolling and release on reflow.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The narrow-viewport send path still moves the composer while the user types. On this head, test_send_grows_thread_around_the_words[size2-0.12-False-False-False-no-preference-False] fails the typing guard: the 390 × 844 case moves .lf-fab-bar from y=96 to y=117 (21 px), carrying More and Send with it. Keep the frame’s anchored edge stationary as the field grows; this breaks the “Typing may grow its field ... but never carries the field” rule in Layout and motion.

The long-comment send case also fails its glyph-geometry assertion on this head: one measured glyph width changes from 8.828 px in the editor to 4.422 px in the first message (size3-0.4-True-False-False-no-preference-False). The positions and scroll readings match, so this may be a range measurement affected by text shaping; the claimed glyph-preserving transition needs either matching rendering or an assertion over the visible invariant that survives shaping.

Place the materialized thread after restoring its reader in the same rendering turn. A deferred pass painted the previous height cap before fitting the new reply, producing a second growth step. The browser regression checks painted geometry and fails with the deferred placement.
Preserve the landed watcher and runtime corrections, including deletion of known_faults and the stronger parser-stack refusal case. Thread glyph and shared conversation geometry tests pass with the strict watcher.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The phone touch placement snapshot now disagrees with the geometry produced by this head, so test_where_a_comment_stands_before_and_after_send fails. The measured comment box and thread card both stand clear of the block; update the two recorded values below if that placement is intended.

Measure intrinsic content after Floating UI fits the response width, so wrapping cannot spend excess scroll travel and carry the field. The existing phone case now uses a natural wrap contrast that fails on the prior ordering. Measure complete words across editor text nodes to avoid ligature range artifacts, assert both font-dependent phone placement outcomes, and regenerate the example corpus.
Use the fitted client height when a fresh thread card makes room. Starting the replacement placement cancels the pre-scroll answer. Extend the existing phone journey with a resize and reopen: it must meet both the window boundary and the exact target gap, rejecting excess scroll travel and omitted scrolling.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lint check fails on this head because ruff format rewrites the new assertion in tests/test_render_send_placement.py. The inline suggestion is the formatter's output from the failed CI job.

Comment thread tests/test_render_send_placement.py Resolved
leaf-agent
leaf-agent previously approved these changes Oct 2, 2026
@leaf-agent
leaf-agent dismissed their stale review October 2, 2026 13:25

CI reproduced the unresolved narrow-viewport typing shift already reported in the earlier review.

@max-sixty
max-sixty merged commit a3d7168 into main Oct 2, 2026
4 checks passed
@max-sixty
max-sixty deleted the codex/comment-thread-growth branch October 2, 2026 14:20
max-sixty added a commit that referenced this pull request Oct 2, 2026
The full Linux main run exposed four remaining failures after the
broader test repair. Update thread-row checks for status beside the
title, with non-overlap at a narrow panel width. Move the folded-pin
gesture, focus, label, and hit-test checks into the existing fixture
that reliably folds, while the runtime placement test retains the exact
left-edge bound.

Separate accepted-slot visibility from nested-choice Undo/reload so the
latter remains unmarked. Keep the strict retired-slot and native-caret
boundary assertions under reasoned expected-failure markers, backed by
the full Linux main run; the retired-slot failure also reproduces on
current main. The card-growth case still exercises its complete
send-and-answer journey before the saved caret assertion. Remove the
short-rail expected-failure marker after the landed #1587 placement
repair passes its unchanged assertions and teardown checks. No runtime
changes.

Ref #1592.

Validation: 1,638 normal Python tests and 192 runtime tests passed. Six
focused browser cases: 4 passed, 1 expected failure, and 1
expected-failure case passed locally after integrating #1587. Pinned
pre-commit checks passed.

> _This was written by Codex on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Oct 2, 2026
The [full Linux main
run](https://github.com/max-sixty/leaf/actions/runs/37029273867) found
nine browser checks that still expected the comment and thread geometry
from before #1587. The tests now read the carried frame, the shared
transcript inset, the writer's visible field, and clearance from nearby
controls. The compact send case checks its visible thread and
typography; `test_send_grows_thread_around_the_words` continues to check
word position through the handoff animation. No runtime code changes.

All nine affected cases failed on the run's head and pass locally on
this branch. A focused animated send-placement case and pinned
pre-commit checks also pass. The run's gallery accessibility and startup
failures were addressed separately by #1596 and #1597.

Refs #1592.

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 3, 2026
Long comments submitted beside a passage retain their editor viewport
inside the thread transcript. That inner scrollport was absent from
Leaf's reading-region registry, so native PageUp and wheel could read it
while Leaf's `u`/`d` commands targeted the surrounding transcript.

Register the carried message body with the existing reading owner and
release it when the body changes or the card closes. An everyday browser
case checks native Tab entry, reading in both directions, preservation
through a held POST's admission, and another comment after closing the
first. The reading-key check fails without registration; before/after
contrasts trace the regression to PR #1587.

CI also exposed a race in the detached Codex carrier fixture: correcting
its fake host PID minted a new session generation before updating the
page claim, so an owner scan could retire delivery during that gap. Keep
the explicitly copied current generation and publish its corrected
lifetime and turn fields under the session lock. The existing delivery
test now asserts that same-task generation continuity; new and restarted
sessions retain canonical acquisition.

Validation: all nine browser smoke cases, runtime tests, and lint;
independent placement, registration-lifecycle, and fixture review. The
fixture correction passes both carrier variants and 14 affected
lifecycle cases. A controlled gap reproduces carrier retirement with the
old fixture and successful delivery with the correction, and the old
fixture fails the new assertion deterministically. The broader
historical audit found no further regression in 31 existing-thread cases
across three versions and ten placement journeys across those versions.

> _This was written by Codex on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Oct 9, 2026
…e page (#1784)

Typing in a floating comment box scrolled the page whenever the box
stood
under or over its passage and grew past the room shown on that side. On
every content change, `floating-response.js` asked `makeRoom` to scroll
the reading region until the whole box fit clear of the passage. A
stack-logged probe at 900x700 measured it. With the box over its passage
at mid-window, the first keystroke scrolled the page 162px. With the box
under a passage near the top, the page scrolled 55px once the box
reached
the window's foot. The user's rule is that the box moves and the page
stays.

The comment box's height may now reach the whole boundary on every side,
as it already could beside its passage, and growth never spends scroll
travel. It grows from the edge that holds it (#1890 holds a landed box
by
that edge). Once the window stops that edge, shift
slides it over its passage, and once it fills the window it scrolls its
own words. This is what a box beside its passage already did at the
window's foot. Only a thread card opening under or over its target still
scrolls to make room. The margin card's reply never scrolled the page
while typing; the same probe confirmed that at both widths.

Letting the box fill the window exposed a 2px mismatch at Send. The box
reserved 2px less beneath its words than the card's reply row takes, so
a
card capped at the window's height shrank its transcript and shifted the
sent words up 2px (`test_send_grows_thread_around_the_words` at
900x600).
One token, `--lf-comment-reply-row`, now sizes both.

Behavior changes the tests now protect:

- `test_typing_moves_the_comment_box_and_leaves_the_page_still` (new)
  types line by line into a box under and over its passage and checks
that the page never scrolls and the box stays in the window. Both cases
  fail on main.
- `test_a_growing_text_comment_keeps_its_side_and_the_page_still` (was
  `..._keeps_its_passage_clear_without_changing_sides`) and
  `test_a_text_comment_chooses_above_when_the_page_has_more_room_there`
asserted that typing scrolled the page and kept the passage clear. They
now assert that the page stays put, and that a later scroll carries the
  grown box with its passage.
-
`test_a_wheel_return_attaches_the_comment_box_in_the_first_visible_frame`
types a shorter draft. In its pane cases, typing used to scroll the pane
  to make room under the passage, and the test expected the box there.
- `test_where_a_comment_stands_before_and_after_send`'s phone case
  required the box to overlap its block only when the two couldn't show
  together, which only held while typing scrolled the page. It now
  requires a box that overlaps to stand at the window's edge.

The assets AGENTS.md "Stability" section now says a floating box grows
inside the window and never scrolls the page for its growth. A field in
flow, which cannot move apart from the page, still keeps its controls in
view.


## Add-on F: one shared reading of where the user works

The design review proposed one reading of the user's working point,
shared
by the card's held edge (`holding`, fed by `drafting` in
`margin-projection.js`), the place keeper (`recentPlaceInput` in
`user-place.js`) and typing growth. This change doesn't add it. I sorted
the place- and landing-hold repairs since 2026-09-23 by the question
each
answered:

- Which edge of the card stays still: #1429, #1536, #1552, #1574, #1587,
  #1771. #1552 and #1574 fixed how the hold was keyed across a second
  placement pass and across Send's admission, not which point the user
  works at.
- Which item in a scroller stays still: #1045, #1464, #1480, #1549,
#1694,
  #1715, #1735.
- What waits behind a notice: #1473, #1493, #1725, #1738, #1742.
- What a landing reveals on entering, sending or typing: #1303, #1364,
  #1571, #1602, #1624, #1626, #1645.
- Whether the box or the page moves as the box grows: #1453 and this
one.

None of these commits names a case where `drafting` and
`recentPlaceInput` disagreed, so a shared reading wouldn't have
prevented
them. The two readings also differ by design. `drafting` counts words
left
in the reply and a send still in flight, both of which outlast focus and
the pointer. The place keeper deliberately follows whichever of pointer
and focus came last. Their outputs differ in kind too: one is an edge of
a
floating surface, the other a node in a scroller's list. The typing
scroll
was a question of which thing moves, so it needed no working-point
reading.

One rule does repeat: a focused control counts as the user's place only
while it is on screen. `holdBox` (`reply-landing.js`), the place
keeper's
"begins in the band" filter, and #1735's resize landing each state it.
It
is a candidate for a shared predicate, but not the primitive F
described.

## Overlap with work in other worktrees

`leaf.shift-a-thread-jitter` has uncommitted changes to
`comment-placement.js`, `floating.js` and `floating-response.js`, based
on
#1705. Its `floating-response.js` hunk is small. Its
`comment-placement.js`
header rewrite overlaps the paragraph this change rewrites, so expect a
textual conflict there. `leaf.thread-card-margin-avoidance` is mid-merge
in
`comment-placement.js` and `margin-projection.js`. Neither touches
`makeRoom`'s call from `floating-response.js` or the frame tokens.

> _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
…3139)

A comment box beside a passage near the window's foot rose as the user
typed, moving the words already written, while its field still had about
70px of room below. Now it grows down from its top until the field
itself reaches the window's edge.

## Why it rose

The box's frame (`.lf-fab-bar`) keeps the sent card's head row (45px)
and reply row (71px) as transparent padding, so Send can open the card
around the words without moving them (#1587). Placement held that whole
frame inside the boundary, so once the unpainted reply row met the
window's foot, each new line slid the frame up. Replayed in Firefox at
1728×999 on the user's page: on `main`, one wrapped line moves the
field's top from 725 to 704 with its foot fixed at 862; on this branch
the top stays at 725.5 and the foot moves from 862.5 to 883.5.

## What changes

One rule, stated in `comment-placement.js` (`overhang`): what a surface
paints is what the boundary holds, and the comment box's reserve at the
end it grows toward may stand past the boundary. Each consumer of the
boundary now follows it:

- placement's shift takes the overhang as negative padding;
- the frame may grow taller than the boundary by it, so the field can
reach the edge, then slides one line per line, then scrolls;
- withholding asks whether the box's controls fit what the frame keeps
inside the boundary;
- the drag grip holds the box in by the same bounds, so a press no
longer jumps it;
- a card adopting the frame on Send caps its `stood` floor at the
boundary, so a long draft becomes a card that fills the window and
scrolls its words, which stay put.

## Behavior changes

- Send from a box whose reserve stood past the edge moves the words by
that overhang (at most 71px at the foot, 45px at the top, more on
phones) to bring the card inside. Before, typing had already spent that
movement.
- A window too short for the frame but tall enough for the box's
controls shows the box rather than withholding it.
- Window-edge tests now measure the painted field rather than the frame.
The Send test allows exactly the overhang and holds the card inside the
boundary; the phone send-placement snapshot records the move. New
assertions cover the field holding its top, the one-line-per-line rise,
a grip press, and short windows with response choices open; each failed
on the earlier code.

> _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 19, 2026
The comment box now draws itself as the card it becomes while it is
being written, and Send swaps the box for the card in the same
rectangle, so nothing on screen moves.

## Why

The box's frame (`.lf-fab-bar`) reserves its card's name row (45px) and
Reply row (71px) around the editor so Send can open the card without
moving the words (#1587). Only the editor painted, so near the window's
foot the box rose while the room below it looked free. #3139 let the
unpainted Reply row hang past the window's edge instead, which kept the
box still while typing but moved the words up by that row at Send. The
user chose to draw the box at its card's size instead: the edge it rises
against is then one they can see.

## What changes

- The box paints its frame (the card's ground, border and shadow) while
its field has focus or holds words. Offered on a selection, it is still
only the field.
- Placement holds the whole frame inside the window again: this reverts
#3139's overhang in placement, sizing, withholding and the grip, with
the tests it changed.
- The painted rows are the box's grip, stacked beneath its controls, so
a press there carries the box and keeps the caret, and controls that
borrow the reserved rows in a short window still take their presses.
- Send no longer animates the card opening out of the field (`growOut`),
since the box is already the card's size.

## Behavior changes

- Typing near the window's foot: the box grows down until its painted
edge meets the window's, then rises a line at a time.
- Send: no movement; `test_send_grows_thread_around_the_words` now
requires the painted box and the card to share one rectangle (less the
response-choices row, which only the box carries).
- A window too short for the whole card hides the box again, as before
#3139.
- Sending with an attached image or drawing still changes the frame,
since the card lays attachments out differently from the box; that
predates this change.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 28, 2026
)

The reply-placement test required Chrome to attribute a layout shift to the card itself. On current main, the card grows upward by 80px with its foot fixed, but the recorded source is its shadow-bearing ground, whose visual-overflow rectangle stays unchanged. That leaves the filtered growth list empty despite the card growing.

Measure the card's border box across animation frames instead. Require one upward step and a stationary bottom edge, preserving #1587's intent that a sent reply grows once around its field. This checks layout at frame boundaries rather than relying on layout-shift source selection; runtime behavior is unchanged.

The reported case fails before this change and passes afterward. All nine Chromium cases of `test_send_grows_thread_around_the_words` pass, and the reported case also passes at sixfold CPU throttling. The earlier successful main run 40136868334 contains a passing result for this case; run 40466044032 contains the empty-list failure.

The hook receipt-lock test also uses a controlled clock that advances only during lock waits. Page preparation could otherwise consume its two-second budget and correctly return a delivery pointer before the test reached the contention it meant to exercise. The original test reproduced the CI JSON-decoding failure with a 2.1-second planning delay; the corrected test passes with that delay and retains the partial inline delivery, pending sibling and expired-deadline assertions. Both focused hook deadline tests pass. Local hook checks used Playwright 1.64.0 to match the browser available on this runner; the branch-pinned browser was unavailable. Runtime behavior is unchanged.

Closes #4402 — automated triage
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