Repository navigation
Show unread boundaries inside Threads - #971
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
The new .lf-read-boundary doesn't take the thread card's inset, so the divider overhangs everything it separates. Measured in the panel on a seeded page: the boundary box is x=790 width=401 while the root metadata row and each .lf-msg are x=798 width=385 — 8px past them on both sides. Inside an expanded summary the boundary is width=361 against the messages' 353, which runs its right-hand rule flush into the refold rail at x=1159 that every message stops 8px short of.
That inset is a stated contract for this card, not a detail: the comment above .lf-thread-compact > .lf-thread-head in chrome.css reads "One inset serves the quote, messages and composer", and test_chrome_contracts.py pins it for the composer, the metadata row and the message body — assert short["metadata"]["x"] == pytest.approx(short["messageStart"], abs=1). The boundary is the only child of the card that doesn't hold it, and the geometry probe there doesn't select it, so nothing catches this.
The inline suggestion restores it. With it applied the same measurements give x=798 width=385 at top level and width=353 inside the summary, matching the siblings on both surfaces.
How the measurements were taken
A scratch Playwright case on PANEL_PAGE with an unread agent root plus one unread reply (and, for the summary case, a two-message summary expanded via .lf-summary-expand), reading bounding_box() on .lf-read-boundary, .lf-msg[data-mid=…], .lf-thread-root-meta and .lf-summary-refold. The candidate patch was the two rules in the suggestion below; every other number was unchanged by it.
tests/test_render_read_state.py (16 passed) and tests/test_render_conversations.py tests/test_chrome_contracts.py tests/test_read_state.py are green at this head.
…the gesture (#982) "Keep the reader's place" had been fixed one surface at a time (#919, #922, #937, #946, #954, #955, #956, #971). The thread list had a good hold that no other surface could use. The Page Map restored its raw `scrollTop`, so a group arriving above the view pushed the rows the reader was on down by that group's height. The margin card relied on native anchoring. The panel's visible band was measured three different ways. Separately, `reveal()` took its reader intent when it was called, so an async caller that forgot to pass one got a late capture, and `lf-diff` moved focus and scroll after a network wait no matter what the reader had done since. ## What changed - **`runtime/reader-place.js`**: `placeKeeper(scroller, {items, identity})` holds one reference node's content offset through a mutation. It picks the reference from the pointer, then focus, then the visible band. It suspends `overflow-anchor` while the hold lasts, hands the place to whatever node a render put under the same identity, and follows a running fold. The thread list (keyed by thread id), the Page Map's `renderSheet` (keyed by `data-lf-map-key`), and the margin card's re-render of the same thread (keyed by event id) all use it. A node with an empty identity hands the place to the next candidate and is never matched to another node that also lacks one. - **`geometry.js`**: `visibleBand` (the shown band minus stuck `.lf-pinned` covers) and `landingBand` (minus the declared `scroll-padding`). Read acknowledgement, the thread card's being-read check, conversation landing, and anchor travel now read these instead of measuring for themselves. - **Reader intent**: `reveal(el, intent)` now requires the intent retained at the gesture and throws without one. `lf-diff`'s `stepHunk` and `nextUnreviewed` capture intent before they load a file, and land only if that intent still stands. `references/packages.md` states the contract. `scroll` is still not a cancelling input: the runtime's own landings fire it. `reader-intent.js` now lists the input that begins each way a reader can scroll. A probe confirmed that pressing a scrollbar fires `pointerdown` on the scroller. - **The #954 ordering rule is now the interface**: `chrome-layout.js` exports `takeShell(key)` in place of a frame that took a callback. A surface owner therefore has no way to render inside the frame that native anchoring depends on. ## Behavior that moved - With no pointer or focus to lead, the thread list's hold now uses the topmost visible card, which is what its header said. Before, it used the second. - A card entirely under a stuck heading no longer counts as visible. - The Page Map keeps the rows the reader was looking at, not a scroll offset. ## Tests - `tests/runtime/reader-place.test.mjs` covers candidate order, the clamp-aware correction, band insets, the identity hand-across, and an empty identity that must not hand the place across. Each hand-across case was checked by disabling the hand-across and watching the case fail. - `test_chrome_contracts.py` (everyday) gets a new Page Map continuity test. It fails against the base `page-map-dialog.js` (row moved 36px). The file also takes `test_taking_the_panels_strip_leaves_the_reader_on_the_same_words` from the nightly controls file. - `test_render_anchors.py` gets a nightly test: a hunk step still waiting on a file leaves a reader who has pressed elsewhere. It fails against the base `lf-diff.js`. - Local: `npm run test:runtime` 60 passed. A focused browser selection across margin, controls, widgets, projection, anchors, and chrome contracts: 142 passed. `test_render_navigation.py::test_pressing_a_page_mark_stands_in_the_thread_it_opens[long]` fails the same way on the unchanged base. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Returning to a Thread now shows where each visible run of current unread messages starts. A quiet closing separator distinguishes later turns, and a collapsed summary shows how many unread originals it covers. The markers derive from the existing exact-version unread reading, so edits and Mark thread read update them without another state store. The separator sits above the complete turn, including an agent-authored root whose header the card hoists beside its actions.
The gallery and public Thread reference describe the behavior. Browser tests cover mixed read/unread versions, edited content, collapsed and expanded summaries, resolved-thread First unread navigation, the hoisted agent root, and keyboard marking with draft and focus retention. Focused browser, corpus-generation, runtime, and pre-commit checks pass. A matched startup comparison kept the request count at 209; the boundary uses the existing Thread renderer and styles before first presentation so it appears as soon as Threads opens.
This replaces #970 with a clean branch from main; the earlier PR also inherited an unrelated local layout proposal.