Skip to content

Keep a thread card's margin row clear only where that costs no width - #1781

Merged
max-sixty merged 6 commits into
mainfrom
thread-card-margin-avoidance
Oct 5, 2026
Merged

max-sixty merged 6 commits into
mainfrom
thread-card-margin-avoidance

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

A thread card beside its words stood past the margin row for its target whenever the room beyond that row still held the card's 320px minimum (--thread-card-min), so a row of one or two controls narrowed the card by their width. On an Ask at a 1600px window the card was 341px wide with 424px free beside the words, and at 1440 it covered the row and came out wider (344px) than at 1600.

comment-placement.js now keeps the row clear only where the room past it holds the card's whole measure (--thread-card, 592px). Anywhere narrower, the card stands over the row, beside the words: it carries its own close and step controls, and the row shows again once it closes. The comment box uses the same rule, so Send still leaves the card where the box stood. The row is one box to the rule, so nothing declares which margin items may be covered; this settles the TODO entry that asked for such a mechanism.

commentPlacement also reads both card widths itself. Its callers used to pass minimumWidth: cardMinimum() while the placement read cardMeasure() on its own, and #1526 began as the box and the card being placed from two different minimum widths.

Window Card before Card after
1440 344 (over the row) 344
1600 341 424
1728 405 488
2200 592 (past the row) 592 (past the row)

Behaviour that moved, with the tests that record it:

  • At 1600 in the feature gallery the card no longer keeps a gap past the pin on its words: it starts 8px from the words' edge, over whatever of the pin reaches that far, and takes the room from there (test_a_thread_beside_its_words_takes_the_room_to_the_visible_edge).
  • At 1920 the margin-answered thread covers its cluster; a 2400 case keeps the past-the-row branch covered (test_a_thread_can_be_answered_in_the_margin_without_opening_threads).
  • A Node test pins the rule at its owner: a row is kept clear with 592px past it and covered with 591px (comment-placement.test.mjs).

All three fail on the old minimum-width rule.

The rule reads the card's declared measure rather than its content, so a short thread that would fit past the row still covers it. Choosing by content width would let the card move on Send and jump sides as replies arrive.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 5 commits October 4, 2026 14:26
A thread card beside its words stood past the margin row for its target
whenever the room beyond the row still held the card's 320px minimum, so a
row of one or two controls narrowed the card by their width. On the
`ask-xfail` Ask at a 1600px window the card was 341px wide with 424px free
beside the words; at 1440 it covered the row and came out wider (344px) than
at 1600.

`comment-placement.js` now stands the card past the row only where the room
beyond holds the card's whole measure (`--thread-card`, 592px). Anywhere
narrower it stands over the row, beside the words; the card carries its own
close and step controls, and the row shows again once it closes. The comment
box uses the same rule, so Send still leaves the card where the box stood.
The rule treats the row as one box, so nothing marks which margin items may
be covered; that settles the TODO entry asking for such a mechanism.

Behaviour that moved, with the tests that record it:

- At 1600 in the feature gallery the card covers the pin on its words and
  takes the room from the words' edge
  (test_a_thread_beside_its_words_takes_the_room_to_the_visible_edge).
- At 1920 the margin-answered thread now covers its cluster; a 2400 case
  keeps the past-the-row branch covered
  (test_a_thread_can_be_answered_in_the_margin_without_opening_threads).

Both tests fail on main and pass here.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/packages/default/runtime/annotation-overlay/margin-projection.js
Both surfaces passed `minimumWidth: cardMinimum()` into `choose` and
`options`, while `options` read `cardMeasure()` for the margin-row rule
itself: the callers repeated a fact the placement owns, and #1526 began
as the box and the card being placed from two different minimum widths.
`commentPlacement` now reads both widths off the root, and its callers
pass neither. The "one writer" table names the margin-row decision
under `comment-placement.js`.

A Node test pins the margin-row rule at its owner: a row is kept clear
when 592px remains past it and covered when 591px does. It fails on the
old minimum-width rule.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@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 new gallery assertion fails on this head: at 1600px, the card starts at x=1132 and the pin ends at x≈1129. The card gained width by dropping the reserved gap after the pin, but it does not cover the pin in this arrangement. This is one of the PR's claimed browser checks, so the change needs a passing assertion that measures the gap it removes, and the PR description's pin-overlap claim needs to match the observed layout.

Comment thread tests/test_render_margin.py Resolved
The pin's reach past the words differs by platform fonts: on CI's Linux it
ends 3px short of where the card now starts, so the card does not cover it
there. What the rule changed is the 8px gap the card kept past the pin.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit e49fdfb into main Oct 5, 2026
6 checks passed
@max-sixty
max-sixty deleted the thread-card-margin-avoidance branch October 5, 2026 01:34
max-sixty added a commit that referenced this pull request Oct 5, 2026
test_render_margin.py conflicted where #1781 widened
test_a_thread_can_be_answered_in_the_margin_without_opening_threads to a
2400 case so the card's past-the-row branch stays covered, and moved its
geometry to the card's whole measure (592px). The answering journey keeps
this branch's one-width shape; #1781's geometry moves whole into
test_a_margin_card_clears_its_row_only_where_that_costs_no_width, which opens
the card at 1920 (over the row) and 2400 (clear of it) and asserts main's
placement and edge rules unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent pushed a commit that referenced this pull request Oct 5, 2026
Five long browser journeys also checked things other tests own, such as
colours, focus rings and panel filters, so deliberate UI changes kept
breaking them. The most-edited,
`test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline`, was
edited by 30 commits since Sep 14, each following an intended UI change;
none caught a regression. Each test now asserts only the behaviour it
owns.

## Changes

- **`test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline`:**
a thread the diff seats inline is the core thread. From the diff the
user reaches it with `t` or its comment note, shares one draft with the
panel, reacts, resolves and reopens it, and news updates both views in
place. Palette, Send faces and ring band are left to
`test_render_thread_snapshots`'s inline case; panel filter and
go-to-threads focus to the Threads tests. The dark/light parameter goes.
- **`test_real_page_passages_can_be_quoted`:** drags once per passage
shape and once per adjacent pair of shapes, instead of 2n−1 drags per
page (998 → 252). All four pages stay.
-
**`test_a_failed_thread_surface_returns_its_threads_to_core_fallback`:**
drops the `begin` and `end` cases, which reach the same `catch` in
`surfaces.js` as `outletFor`, along with the six-reaction count. Main's
keyboard-activation case from #1705 is kept.
- **`test_the_feature_gallery_exercises_the_injected_core_surfaces`:**
checks that each core surface shows the gallery's own content. Two
checks with no other owner move: pressing `w` behind the image viewer
goes to `test_a_pasted_image_survives_…`, and the Page Map's close cross
to `test_the_g_chord_opens_an_empty_page_map`.
-
**`test_a_thread_can_be_answered_in_the_margin_without_opening_threads`:**
drops the geometry, first-frame, font and border checks other tests own,
and the 1920 width.

- **Thread snapshots:** a new `inline-dark` case in
`dev/leaf_dev/thread_snapshots.py` takes over the dark appearance check
the lifecycle test dropped. It has reviewed images for both the Mac and
Linux profiles, and `leaf-assets.json` is moved to pin them.
`SnapshotRun.capture` now records a missing baseline image as a failure
and keeps going, as it already did for missing geometry, so a new case's
first run captures every stage.
-
**`test_a_margin_card_clears_its_row_only_where_that_costs_no_width`:**
new. It holds the placement checks main added to the margin-answer test
in #1781, at 1920 and 2400, while that test stays at one width.
- `test_render_startup.py`'s lease test calls `release_lease(lease)`,
which #1790 made unlock before closing.

## Validation

- A dark-only background planted on the diff's seated thread fails
`inline-dark` at all six stages, while the light `inline` case passes.

Each test fails on a planted fault in the code it protects:
- the inline seat rebuilding its view on every render (diff lifecycle)
- `lf-metric` words not counting as page words (quoting)
- a failed widget not pushing its empty plan (failed surface)
- the gallery log losing its resolve event (gallery surfaces)
- the marker opening its card while Threads is open (margin answer)

Local times under heavy load:
- diff lifecycle: 31 s → 12 s
- quoting: 154 s → 80 s
- failed surface: 174 s → 125 s
- gallery surfaces: unchanged at 64 s
- margin answer: 25 s → 6 s

> _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 7, 2026
The margin-placement repair in PR #1810 reversed PR #1781's intentional
behavior to satisfy older assertions. Require the originating PR's
rationale and current contract to inform whether tests or behavior change.

When the evidence remains uncertain, make and validate the best-supported
fix, then open an issue for the original contributor's judgment. Keep that
issue open until the contributor decides, including across later Tend runs.
Clarify validation for justified removal of tests protecting no behavior.

Validation: per-file pre-commit checks and instruction scenario smoke
checks passed; independent review found no remaining issues. The baseline
also passed the scenarios, so they establish conformance rather than a
measured reliability improvement.
max-sixty added a commit that referenced this pull request Oct 12, 2026
…a red test (#2607)

Bot CI repairs have reversed deliberate behavior twice. After #1781 let
thread cards cover the margin rail to keep message width, #1810 changed
the code back to satisfy an old test, and #1838 rewrote the remaining
test to match; #2330 restored it. Then #2102 landed after "Reading a red
suite" already asked Tend to preserve intended behavior. It let every
widget-offered control keep its pointer gestures in Draw mode, so
clicking a choice selected it, and it rewrote the capture test on the
bot reviewer's request; #2341 repaired it.

"Reading a red suite" now names what a repair weighs: the intent of the
change that turned the test red, and the interface users and callers
rely on. A repair keeps both where it can. Where no repair can,
reverting the change, or the part at fault, is allowed. A revert, any
intent given up, or an interface moved beyond the change needs an issue
addressed to the change's author, so the fix can return deliberately.
For a bot's change, that is the person who requested or merged it, or
the maintainer. The rule covers changes still in a pull request, and the
review threshold holds any fix for a red test to it.

Validation: a scratch A/B with each arm's running-tend pasted into the
prompt (Opus 5.5; 2–3 runs per scenario per arm). Both arms reverted an
unsafe change and filed an issue; the new text's issues carry the
intent, the conflict and what was given up. Both arms updated only the
test, with no issue, for a pure rename and for a test the change
deliberately made stale. Both refused to merge the #2102 shape. These
cases establish conformance, not a measured improvement: the failures
happened deep in long CI sessions, which a cold scenario does not
reproduce. Codex reviewed the text, and its two findings (scope to open
pull requests, an addressee when no person touched a bot change) are
applied.

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

Co-authored-by: Claude Opus 5.5 (1M context) <[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