Skip to content

Compact inline thread cards - #895

Merged
max-sixty merged 9 commits into
mainfrom
codex/compact-thread-card
Sep 21, 2026
Merged

max-sixty merged 9 commits into
mainfrom
codex/compact-thread-card

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The compact composer previously expanded into a wider titled conversation card, changing the text wrap and adding an empty header region. This keeps the card at a 380px preferred width, removes the visible inline title, and places the existing Resolve and close actions beside the first message's author and time. The Threads panel uses the same message-header action slot while retaining its passage navigation and accordion summary.

The action slot is rendered by MessageView from a retained node owned by ThreadView, so state publications preserve control identity and focus. Multi-thread inline navigation gets a separate compact row to avoid collisions at narrow widths.

Validation:

  • uv run pytest tests/test_render_conversations.py tests/test_render_navigation.py -q -n0 --tb=short (239 passed after correcting the two reviewed stale expectations in a focused rerun)
  • focused corrected nodes: 2 passed
  • npm run test:runtime (28 passed)
  • direct Chrome gestures at 760px and reviewer gestures at 335px, including panel close, inline dismiss, Resolve, reduced motion, and console errors

This was written by Codex on behalf of max-sixty

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

Narrowing --thread-card and deleting the preview title both land on tests/test_render_margin.py, which the PR doesn't touch. That file is pytestmark = pytest.mark.nightly, so the PR's test gate never collects it and main's post-merge complete suite does — the failure surfaces after the merge, on main, where running-tend treats a red ci as live.

--thread-card: 380px breaks four width assertions. threadCardGeometry caps the card at Math.min(preferredWidth, boundary.width) and margin-projection.js passes --thread-card as preferredWidth, so 380 is now the ceiling. Four tests assert geometry["cardWidth"] >= 459: test_a_forced_inline_thread_keeps_its_control_inside_the_margin_budget, test_a_thread_uses_a_free_margin_and_tracks_its_source, test_an_inline_thread_keeps_one_readable_card_across_page_claims, and test_the_shipped_long_thread_keeps_the_margin_and_its_height. The two that read --thread-card live instead of hardcoding it still pass, so the fix is to re-derive those four numbers from the new preferred width rather than to keep 460.

Removing previewTitle breaks a fifth reading. test_the_shipped_long_thread_keeps_the_margin_and_its_height reads .lf-margin-preview-title three times, and one of them is document.querySelector('.lf-margin-preview-title').getBoundingClientRect() inside a page evaluate — a null dereference rather than a failed assertion. I ran that test against this branch and it fails.

Behind that assertion is a decision the PR description doesn't name. In the margin seat the thread renders no .lf-quote — the shipped ship-review preview's accessibility tree goes straight from Dismiss to the first message's author, time and Resolve — so the preview title was the only visible naming of what the conversation is attached to. After this change the subject survives in the popover's aria-label alone, which leaves it for assistive technology and takes it from sighted readers. The test states the contract it was holding in its own words: "The conversation scrolls; its subject and settlement remain usable. A tall focused root must not scroll the title away just to fit its entire transcript." Dropping the inline title is a defensible call for the inline card; the margin preview is a different seat and this makes it anonymous. Worth saying in the description which of the two you intend, since the tests are where that choice gets recorded.

Everything else reads clean, including the root-summary fold that 6a5ba897 closes.

One cleanup while you're in these files: the three .lf-margin-preview-title rules in chrome.css now dress an element nothing builds, --lf-thread-action-hit on .lf-conversation-thread in shadow.css lost its only consumer with the removed :has(> .lf-thread-head) rule, and the comment above .lf-margin-thread .lf-conversation-msg:first-of-type still says a thread "puts a .lf-thread-head in the first child slot".

Happy to push the margin-test updates if you'd like — say the word and tell me which way the preview subject should go.

column by only what the rail lacks. Its height is never cut to spare the cluster
(thread-card-geometry.js). */
--thread-card: 460px;
--thread-card: 380px;

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.

This is the preferredWidth margin-projection.js hands threadCardGeometry, and the geometry caps the card at Math.min(preferredWidth, boundary.width) — so 380 becomes the ceiling for the margin preview too. Four nightly tests in tests/test_render_margin.py assert geometry["cardWidth"] >= 459 against it.

@@ -2100,7 +2099,6 @@ export function createMarginProjection({
const title = trimmed(targetHeading || quoted || entry.title, 72);
keeps(preview, "data-lf-thread", "");
keeps(preview, "aria-label", `Conversation for ${title}`);

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.

title now reaches the reader only through this aria-label. The margin seat renders no .lf-quote, so nothing visible names the conversation's target once previewTitle is gone — and test_the_shipped_long_thread_keeps_the_margin_and_its_height still reads .lf-margin-preview-title, including one document.querySelector(...).getBoundingClientRect() that now throws on null.

@max-sixty
max-sixty merged commit 39d9cad into main Sep 21, 2026
3 checks passed
@max-sixty
max-sixty deleted the codex/compact-thread-card branch September 21, 2026 21:24
max-sixty added a commit that referenced this pull request Sep 21, 2026
The compact thread cards (#895) lift the first message's head out of the
message and into `.lf-thread-root-meta`, beside the thread's actions.
`test_a_written_comment_keeps_its_originating_agent` still looked for
the agent's name inside `.lf-msg.agent`, so it has failed on main's
nightly selection since. It now reads the name where the card draws it,
and keeps the count of agent messages the old selector implied.

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5.1 <[email protected]>
max-sixty pushed a commit that referenced this pull request Sep 22, 2026
… rows, and move six nightly tests onto #894 and #895 (#910)

`ci` on `main` went red at b7bd021 (#904): [`lint` and `test` passed,
and the complete suite in `nightly` failed on eleven
cases](https://github.com/max-sixty/leaf/actions/runs/35670525383). One
is fixed on today's `main` by e291a95, four are #903's and still open,
and this PR is the other six. None of them is #904's. They come from two
features that landed earlier the same day and were validated against the
everyday gate rather than the nightly selection, so the first run to
reach them was this one.

**#894 made the command reference dismiss the popover it is opened over.
Three cases still assert the restoration it removed.** Opening the
reference now follows the platform's modal transition: auto popovers
close and are not rebuilt.
`test_the_version_menu_is_worked_by_pointer_and_key`,
`test_the_versions_menu_suspends_the_pages_own_keys` and
`test_a_row_the_platform_activates_names_both_of_its_keys` each ran the
reference round trip mid-case and carried on working the menu behind it.
They now assert the dismissal where they asserted the return, and stand
the menu up again through `open_versions` where the rest of the case
needs it. The pair of boundary rows in the third case needed the runtime
instead, and is the second fault below.

**#895 hoisted a thread's first message head out of the message and onto
the card. Two cases still read it from the message.** `ThreadView`
renders `messages[0].header` into a `.lf-thread-root-meta` row that
carries the thread's Resolve beside the author, so `.lf-edited` and
`.lf-conversation-head` are no longer inside `.lf-conversation-msg`.
`test_an_agent_message_edit_updates_the_panel_and_its_inline_conversation`
read the edit disclosure from the message node on both surfaces and
found nothing; it now reads it from the card holding that message.
`test_the_margin_groups_meanings_at_one_destination_without_moving_the_page`
resolved the head to `null` and raised on its box. Its selector now
names the row, which is what has a box — the head itself is `display:
contents` there, so keeping the old selector shape would have left that
assertion reading zeros and passing vacuously.

**#895 moved `--thread-card` from 460px to 380px. One case's viewport
was tuned to 460.**
`test_a_thread_beside_its_cluster_takes_the_room_to_the_visible_edge` is
the narrowing case in a ladder of three: at 1440 the rail used to fall a
few pixels short of the card's measure. Against 380 it leaves 453px of
room, so the card takes its preferred width with room to spare and never
reaches the visible edge. The case runs at 1220 now, where the room is
343px, and asserts that arrangement against `--thread-card-min` and
`--thread-card` before it asserts the outcome — so the next move of
either token reddens the premise and names the width to re-pick rather
than reading as a layout regression.

**One fault in the layer: the card's Dismiss lost the row it shares.**
Before #895 the margin preview's thread head was absolutely positioned
at `inset-block-start: 12px`, the same inset as the card's own head, and
Resolve and Dismiss sat on one line. #895 replaced it with the sticky
`.lf-thread-root-meta`, which starts inside the thread's own 4px of
padding, while the card's head stayed at 12px — so the two icon actions
in that corner are 4px out. The stylesheet still states the arrangement
they are meant to keep (`The retained settlement action is positioned
against the card, alongside Dismiss`), and the nightly case is the
reading of it. The head now starts at the card inset plus that padding,
so Dismiss lands on the row Resolve rides; the comment beside it is
updated to say which of the two is positioned against which, since #895
reversed that.

**A second fault: the versions menu's two Tab rows can no longer be read
anywhere.** `version.leave-forward` and `version.leave-backward` declare
`when: () => atVersionBoundary(…)`, which compares
`document.activeElement` against the menu's stops. That is a dispatch
question — the press closes the menu only from the end it is held to —
and since #894 the reference asks it of a menu the modal has just
dismissed, so it answers no for both and the catalogue drops them. They
are the only rows in `In the versions menu` that vanish: the other seven
stay, each with `data-lf-available="false"`, which is the reading
`test_reference_accepts_native_popover_dismissal_across_modal_entry`
already asserts for `version.open-v*`. `?` is the only door into the
reference and it always dismisses the menu, so no scene is left in which
either row can be read, and the shortcut bar names only the one
direction the reader can take from where they stand. Both rows now carry
`commandReferenceWhen: () => true`, the hook `command-reference.js`
offers for this exact split and that its own rows and
`margin-projection.js` use, and the third case asserts both directions
again, each marked unreachable.

## Verification

The six cases pass on this branch and all six fail on `main` without it,
along with the neighbouring short-rail case the narrowing one shares its
fixture with. Run whole under `--run-nightly` on this head:
`tests/test_render_anchors.py` 93 passed;
`tests/test_render_navigation.py` and `tests/test_render_controls.py`
together 240 passed with one failure,
`test_every_shadow_the_layer_lifts_a_box_with_is_cast_in_the_scheme_s_own_ink`,
which is #903's; `tests/test_render_margin.py` 125 passed with one
failure,
`test_a_forced_inline_thread_keeps_its_control_inside_the_margin_budget`,
which is #903's too. `tests/test_render_widgets.py` was 179 passed
before the reference commit, which does not touch it. `npm run
test:runtime` is 33 passed, and pre-commit is clean on the changed
files.

The reference reading was measured directly in a browser both ways:
without the row change the version scope shows seven commands and
neither boundary row; with it, nine, both boundary rows reading
`data-lf-available="false"` beside `version.open-v1` and
`version.open-v2`. PR CI's `lint` and `test` do not reach any of these
cases, since the nightly selection is what holds them.

<details><summary>Attribution, and what this leaves</summary>

**Attribution.** Each failure was placed by running the case against the
runtime and tests at the commits between the two nightly runs. The three
versions-menu cases fail with #904's assets reverted to 517c4c2, so
#904 is not their cause; 1888c6e (#894) is, and its own diff moved
`tests/test_render_navigation.py` and `tests/test_render_controls.py`
onto the new contract while these three sat in a third file. `git show
39d9cad -- skills/leaf/assets/theme.css` is the `--thread-card` move,
and `git log -S externalHeader --
skills/leaf/assets/runtime/conversation/messages.js` returns 39d9cad
alone.

**The measured geometry.** The narrowing case needs the width left for
the card — the gap between the cluster and the visible edge, less the
8px either side — to fall between `--thread-card-min` and
`--thread-card`. Measured on the gallery, that width is half the
viewport less 267px while the viewport is at or above 1160, below which
the rail's own breakpoint moves it: 453px at 1440, 373px at 1280, 343px
at 1220, 313px at 1160, and 148px at 1120. The two tokens leave a window
from 1174 to 1294, and 1220 sits near its middle. On the alignment fix,
Dismiss and Resolve read `top: 523.3` and `527.3` before and `527.3` for
both after.

**Not in this PR.** Four of the run's eleven belong elsewhere.
`test_a_widgets_native_control_names_the_press_the_platform_makes` was
repaired on `main` by e291a95, which renamed it; the other four — the
elevation shadow, the printed-page word, the widget-root projection and
the forced inline thread's margin budget — are #903's, which is open and
based on 5854f06. That PR also rewrites the case e291a95 has since
replaced and drops the `NATIVE_CONTROL_PAGE` fixture `main` still uses,
so it needs a look at `main` before it lands; noted on that thread.

**What produced all six.** Both features changed a contract that the
everyday gate does not reach and the nightly selection does, and both
were validated against the gate that runs before merge. Nothing here
changes that; it is the same shape #903 names, one nightly run later.

</details>

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Sep 22, 2026
…htly tests around what #886, #889 and #892 moved (#903)

`ci` on `main` went red at 7925553 (#892): [`lint` and `test` passed
and the complete suite in `nightly` failed on eleven
cases](https://github.com/max-sixty/leaf/actions/runs/35650845868). Five
of them were #884's and #891's, both since merged, and the visual-review
one is green again on today's `main`. This PR is the other six, which
arrived together because three features landed between that run and the
one before it and none of them was validated against the nightly
selection.

One is a fault in the layer. The other five are tests still standing
where those features used to put things.

**The comparison handle's lift is cast in `--shade`.** #892 gave
`wa-comparison`'s handle `box-shadow: 0 1px 3px color-mix(in srgb,
var(--ink) 20%, transparent)`. The layer states one shadow ink per
scheme precisely because a hand-mixed colour can only be right about one
ground — a drop shadow written for the light paper lifts a dark one by a
fraction of what it promises — and
`test_every_shadow_the_layer_lifts_a_box_with_is_cast_in_the_scheme_s_own_ink`
is the reading that holds every elevation shadow to the token. The
handle now spends it.

**#889 made a finding say where it is; two assertions held the old
wording.** `render-checks/locate.js` reads an element without an id as
`<strong> in <lf-option id=c-bearer>` rather than as the host alone.
That is the change #889 made on purpose, so the two nightly assertions
that spelled the host move to the stated form.

**#892 made the screenshot's checkbox a fallback; a test still pressed
it.** `test_a_widgets_native_control_names_the_press_the_platform_makes`
scrolls `lf-shot`'s transparent checkbox into view and presses Space on
it. Since #892 the theme hides that checkbox the moment Web Awesome's
comparison lands, so on the live page there is no control there to
scroll to. The test now holds the bundle from outside the page through
`primed`, which is what `tests/CLAUDE.md` asks for when the ordering
matters — an arrangement rather than a race. It needed a page of its own
to do it: `lf-diff` imports the same bundle at the top of its module, so
holding it on the combined fixture left that widget unupgraded and the
page never presented. The staged-control half of the test now runs on
`DIFF_PAGE`, and `NATIVE_CONTROL_PAGE` goes with the split.

**#886 added a thread to the gallery; a walk was counting presses to a
different one.**
`test_a_forced_inline_thread_keeps_its_control_inside_the_margin_budget`
pressed `t` twice to walk from the gallery's first thread to the crowded
suggestion's. #886's summary example anchors at `bg-thread-checkpoint`,
which sits between them, so the second press landed there and the test
went on to measure a card three thousand pixels from the cluster it
names. The walk now goes to the thread it is for, gives up when it comes
back round to one it has already stood on, and waits for each press's
arrival before the next.

**#892's upgrade arrives after the page says it has presented; a
settled-page reading started before it.**
`test_a_settled_page_with_a_standing_reaction_stops_rendering_its_margin`
counts margin layouts across thirty frames on the gallery and allows
one. The gallery carries an `lf-shot`, and moving its two frames into
`wa-comparison` lays the margin out twice a few milliseconds apart, at
whatever moment the module happens to resolve. The stamps `open_page`
waits on do not cover an upgrade deliberately placed after them, so the
page was still arriving when the count began. The test waits for the
comparison first.

## Verification

The six cases pass on this branch and five of them still fail on `main`
without it; the sixth is the intermittent one, measured below.
`tests/test_render_controls.py`, `tests/test_render_anchors.py`,
`tests/test_render_projection.py`, `tests/test_render_margin.py` and
`tests/test_render_commands.py` were run whole under `--run-nightly`,
along with the everyday suite, `npm run test:runtime` and pre-commit on
the changed files.

<details><summary>Evidence, and what this leaves</summary>

**The settled-page case is intermittent, and the hold is what names its
cause.** Without the wait it went red on 2 of 12 local runs, with both
layouts landing 6–13ms apart somewhere in the first 700ms of the window
— 296/302, 191/197, 521/527. With the wait it is 8 of 8 green. Holding
`**/vendor/webawesome.esm.js` from outside the page instead, changing
nothing else, is 8 of 8 with no layouts counted at all, which is what
identifies the shot's upgrade rather than the two-second heartbeat the
test's docstring had assumed.

**Attribution.** Each failure was placed by running the case at the
commits between the two nightly runs: the margin walk passes at 10d61b2
and 2f8ee1b and fails at 965369b (#886), and `git show 965369b --
examples/developer/feature-gallery.html` is the added
`bg-thread-checkpoint` paragraph and its thread.

**Not in this PR.** One document change producing two margin layouts on
adjacent frames is a doubled render in the thing that test exists to
bound; this change waits for it rather than removing it, and whether the
upgrade should lay out once is #892's question to answer. The wait
itself is the third place a test names, by hand, a widget of its own
fixture that is still arriving after the page said it presented —
`test_margin_layout_batches_the_composed_page_without_refolding_controls`
and `test_unchanged_margin_refresh_cost_is_bounded_by_refresh_count`
each wait on `[data-interaction-frame]` carrying
`data-interaction-ready`, and this adds `lf-shot wa-comparison`. That is
one missing fact rather than three waits: a page-level stamp a deferring
widget raises when it lands, which `open_page` could wait through, would
settle every fixture at once. It is a change to make on its own terms
rather than inside a CI repair, and until it is made the next widget to
defer will redden some other test at a wait far from its cause.
Separately, four nightly cases are red on today's `main` and are not
from this run —
`test_a_thread_beside_its_cluster_takes_the_room_to_the_visible_edge`,
`test_the_margin_groups_meanings_at_one_destination_without_moving_the_page`
and `test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline` in
both schemes. All four pass at 7925553 and fail at 39d9cad, so they
are #895's, and the run that reaches them will be that commit's own.

**Environment note.** Six everyday cases and the four browser-launch
cases in `tests/test_render_commands.py` fail in this CI sandbox on a
clean tree as well — no `AF_UNIX`, no installed Chrome for the
subprocess gate — and all of them were green in the `test` job of the
run under diagnosis.

</details>

Co-authored-by: leaf-agent <[email protected]>
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