Skip to content

fix: size code Copy buttons to their blocks - #3830

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-3829
Oct 24, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-3829

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Code Copy controls stood in chrome, so they inherited the root's 32px face instead of the source block's compact line height. The control now reads the block's line height before placement, and a block or container can set --lf-code-copy-size explicitly. The visible face shrinks with compact code while its press target retains the --aim-floor minimum.

The browser regression reproduced a 32px face on a 19px line before this change; it now verifies the 19px face, a 27px container override, and the minimum press target. Three focused browser tests and pnpm run test:runtime pass. A base/candidate preview loaded 50 requests in each arm; its code control changed from 32px to the source's 17px line height.

Closes #3829 — automated triage

Read each code block's line height or local size token before standing its control in chrome. The visible face now fits compact source while the existing reach rule keeps the pointer target at --aim-floor. Document the per-block override and cover both sizes in a browser regression test.

Closes #3829
@leaf-agent
leaf-agent merged commit 31101a7 into main Oct 24, 2026
4 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-3829 branch October 24, 2026 21:43
max-sixty added a commit that referenced this pull request Oct 25, 2026
A code block's Copy stood inside the block's top-right corner as a bordered square on
the code's ground, covering the end of the first line while shown, while a draft's
controls are marks on a small toolbar riding its border. The lone Copy is now that
toolbar with one mark: its middle lies on the block's top border, 8px in from the
right, on the card ground with a ring and a lift, the copy icon a quiet mark. Its face
still follows the block's line (#3830), and it still shows only on hover, keyboard
focus or a tap that stands the user on the block, and takes no room.

The toolbar's face has one home, `.lf-mark-bar` in integration.css, which the draft's
toolbar now wears too; draft.css keeps only where its toolbar stands and when it shows,
and a Copy inside a toolbar of more marks is one of them. Every Copy is now quiet, so
the draft no longer adds that class to its own.

The widened-table test now holds Copy's middle to the block's top border; it asserted
Copy stood within 8px below it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
…ar (#3916)

A code block's Copy used to sit inside the block's top-right corner as a
bordered square, covering the end of the first line while it showed. A
draft's controls, meanwhile, are marks on a small toolbar riding its
border (#3225). The lone Copy is now that toolbar with one mark: its
middle lies on the block's top border, 8px in from the right edge, on
the card ground with a ring and a lift, with the copy icon drawn as a
quiet mark. It still shows only on hover, keyboard focus or a tap that
stands the user on the block, its face still follows the block's line
height (#3830), and it takes no room. The user picked this design over
two others: keeping Copy in the corner and giving it the toolbar's look,
or giving the draft's marks Copy's bordered square.

The toolbar's look now lives in one place, `.lf-mark-bar` in
`browser/styles/components/integration.css`, and the draft's toolbar
uses it too. `draft.css` keeps only where the draft's toolbar stands and
when it shows, and a Copy inside a toolbar with other marks becomes one
of them. Every Copy is now quiet, so the draft no longer adds that class
itself.

The playground's instruction Copy, which its pane places itself, now
takes the same seat on the pane's top border; it read the corner inset
token this change retires.

The widened-table scroller test now holds Copy's middle to the block's
top border; before, it asserted Copy stood within 8px below that border.

Clipping check: the toolbar's top half stands above the block, so a
block flush against the top of a pane that clips its content would cut
it. I surveyed every code block and `lf-code` listing in the examples,
fixtures and docs pages that have them (13 pages, at 1280px and at 390px
under a finger, with every tab clicked and every disclosure opened). No
block sits within the toolbar's half height (at most 11.5px) of a
clipping ancestor's top; the closest is 102.9px. A document block's Copy
stands in chrome anyway, so a page's pane can't clip it.

Checked in Firefox and Chromium: on a document code block, an `lf-code`
listing and a draft, the toolbar's middle sits on the top border and its
right edge is 8px in. Under a finger the lone Copy shows on tap, and
taps 9px above and below its centre reach it. 23 focused copy, draft and
pins tests pass, and so does `pnpm run test:runtime`.

> _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
test_code_copy_keeps_source_and_stays_beside_scrolling_and_revised_blocks
still read three things later changes replaced:

- #3830 sized Copy's face to the block's line (19px here) and met the touch
  floor with a reach on the button's ::after, but the journey still asserted
  the face itself was 44px. It now taps inside the floor beside the face and
  expects the copy, which fails when the reach is removed.
- #3916 stood Copy's toolbar on the block's top border, but the journey still
  held it within 8px below that border. It now holds the toolbar's middle to
  the border, as #3916 did in the widened-table scroller test.
- #3670 made the code block's scrollbar clearance part of every layout, so
  the journey's wait for the old scroll-state ::after to read `none` could
  only time out. The wait is gone.

No product behavior changed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
#3939)

Adds a nightly macOS run of every test tier, and fixes every test that
failed in its first run or in the Linux nightly beside it: 89 tests in
[run
40156291557](https://github.com/max-sixty/leaf/actions/runs/40156291557),
60 of them only on macOS.

## The macOS nightly

`ci.yaml` gains a `test-macos` job: every tier on `macos-15`, `-n 2` on
its three cores, in the daily schedule and a dispatch. It belongs to
`ci`, so a failure turns that run red and reaches tend through the
existing `workflow_run` trigger, with no tend configuration change.
GitHub doesn't bill hosted runners for public repositories; the job
holds one of the account's macOS slots for about three hours. The test
step names `shell: bash`, without which a step runs without `pipefail`
and piping pytest through `tee` reported the first run's failures as a
green job. The setup action's Ubuntu mirror step now runs only on Linux.

`tests/AGENTS.md` counts `test-macos` among what tend repairs and leaves
only failures no CI run shows to local sessions. It drops the
instruction to confirm a macOS-only failure at normal priority because
`taskpolicy -b` slows headless Chrome: a test that fails on a slower
host depends on timing, and the fix is to the test. `running-tend` tells
the session fixing a red run, which has only a Linux runner, to verify a
macOS-only fix by dispatching `ci` on its branch.

## The fixes, by cause

Product fixes:

- A drafted margin card rose against the window's foot and never came
back as the draft shrank (#3524). It now holds the top it opened at and
drops back.
- A tapped pin reseated 11px lower as it unfolded, because the
hold-to-read toggle was pressed before the browser focused it (#3341).
- A page's first thread card could cover its passage, because the
placement that makes room was dropped while Floating UI loaded (since
#1526).
- A heading's "Copy link to section" stayed at the heading's far end
after the window narrowed and widened, since every engine keeps its last
`position-try` fallback (#3836). It now picks its place from the current
width.
- Putting the response bar away moved focus off the button the press had
just focused, so the next `e` found nothing (#3756).
- A trace's image-tools status shared a class with the image's loading
notice, whose rules hid it (#3707).
- WebKit scrolled the outer page 1,386px when a sample editor took focus
(#3634).
- In draw mode a press left the previous press's release timer pending,
so a fast second click reached the page.
- Hint refreshes read the geometry of every target inside a closed
disclosure, forcing layout of skipped content.
- A sidebar page's sticky track clipped focus rings (#3918). A stuck
track body now keeps the ring's room inside its edges, so its blocks
stand 5px in from each side.
- Tab revealed a block's Copy flush with its scroller, cutting its ring
(#3916).
- The hidden "my change" word inside a choose group took a cell's
padding and read as clipped content (exposed by #3837's check).
- Visual review case buttons kept their wide padding after the first
breakpoint crossing, a Chromium restyle bug avoided by making the case
list a plain container.
- A held shot's scrolling stage didn't declare that it holds its height
(#3703/#3704).
- When the log refused a reply, the floating panel's head moved down
69px and the restored draft pushed its controls up 21px (#3400). Through
a refusal the panel now holds its head and the field its height, on the
holds a press already takes; the refused turn's room goes at the user's
next turn.
- A reply box's ↑ (edit your last message) appeared only after an
unrelated repaint once its last message became editable (#3855). Every
message draw, by any thread reader, now recomputes that row's keys.
- A trace's images took the page's scroll anchor, so a lane change in
the timeline scrolled the page 62px under an arrow key; they no longer
anchor scroll. The trace overview wrote its window's new start before
reading its size, so for one layout the window ran past its strip and
Chromium scrolled the page up to 838px; it now reads before it writes.
The image tools' status keeps its line when its text clears.
- Web Awesome's radio group moves focus on an arrow with a bare
`focus()`, which Leaf's ring scroll margin turned into a page scroll.
The vendored bundle is patched (`build/vendor.mjs`) so both calls pass
`preventScroll`.
- A Leaf page inside an iframe took focus from the page around it when
it finished arriving. Its arrival recovery now runs only at top level or
in a frame that holds focus.
- The margin rail's one Tab stop stayed on whichever row last held it,
so a resize could leave it below a row the user sees first. It is now
the highest row in view; a focused row keeps it.
- A resize that moved a sidebar page's track into the page, with neither
place made by the reader, took the track's place over the page's:
live-progress jumped 1861px (#3918). On a tie the page's own place wins.
- The whole-page rule read a shut disclosure whose children are all
generated as showing what it holds (#3908); it now skips only `.lf-ui`
apparatus.
- The gallery revealed its stamped frame at the centre, carrying the
pressed button 45px; it now scrolls only as far as needed.

Test fixes:

- The Codex fixture copies the running interpreter as `codex`; on a
framework Python, as on the runner, the copy fails its code signature
and macOS kills it at launch. That broke 39 tests. The copy is now
re-signed ad hoc, and the fixture no longer leaks `PYTHONHOME` into the
command it runs.
- The plain-HTTP copy test missed Chromium's lower-cased host; the
event-door refusal test read its answer after the server's reset; the
stale-keys sweep raced the browser entering fullscreen; the words watch
didn't credit a blur from a press elsewhere.
- Several tests read state before it settled (a shown gesture's arm, a
side list's smooth scroll, a sample's focus returning, a held reply's
menu), and now wait for it. Assertions predating #3830, #3916, #3670,
#3673 and #3217 now read the current behavior.
- Three waits fixed their own deadline instead of the suite's, among
them the async-probe test's 500ms.
- The command hub's record now sticks in view, so the Atlas journey
opens its news before reading each row; the region-capture journey drags
over the unreadable image it means to fail on (#3861 draws only the
element that alone paints the crop).
- The touch-capture removal test, which fails intermittently on main,
now reads the shelf right after the tap and names the elements the tap
reached, so its next failure says whether the tap missed or the image
came back.
- The feature-gallery scroll pass allows a third of its steps to write
the contents' `aria-current`, as gestures already do, since the count
depends on where sections fall under the platform's fonts.

The branch also merges the four open `grind/f-main-tests-*` pull
requests, whose fixes cover five more of the run's tests: #3871, #3882,
#3887 and #3906. This pull request lands them.

Each fix was reproduced failing and then passing by node id, on this Mac
or, for a Linux- or runner-only failure, against a run's log, except
where its commit says otherwise. Dispatched full runs on this branch
([40156291557](https://github.com/max-sixty/leaf/actions/runs/40156291557),
[40186545420](https://github.com/max-sixty/leaf/actions/runs/40186545420),
[40196342887](https://github.com/max-sixty/leaf/actions/runs/40196342887))
check both platforms; the second took the macOS job from 86 failures to
38, most of the rest fixed since. A few macOS-only failures pass on
every local attempt (two reading-place tests, a scroll repaint, Back
from a thread, opening a line under the last, the Android composer's
Return, margin-entry order, a card paging on, a turn arriving out of
view) and have no fix here; once this lands, the macOS nightly reports
them to tend.

> _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
Leaf had two styles for one kind of small icon press. Corner marks (the
floating panel's fold, an attachment's ×, a drawing's Undo last stroke
and Remove drawing) were 20px with 12px icons in the dim ink, which the
user chose on 22 October (#3606). Toolbar marks were different: a
draft's Edit, Save and Discard, and every Copy on a code block, an
`lf-code` listing and the playground's instruction. They were 26px, or
the block's line height for a lone Copy, with 16px icons, the muted ink
and a chip wash under the pointer. The user chose one style for both.

`.lf-mark` in `browser/styles/components/controls.css` is now the one
home for a mark's size (`--mark-size`, 20px), icon (12px), ink, hover
(full ink), focus ring and reach. Each seat keeps only its place and its
ground:

- `.lf-corner-mark` adds the absolute seat, a patch of the ground with
its ring and lift, and the forced-colours edge.
- `.lf-mark-bar` (`integration.css`) is the pill on a border.

Copy, a Web Awesome control, wears the face on its button part.

**Size.** The shared size is 20px, the corner marks' size from the 22
October decision. A toolbar mark works at that size: the pill is 24px
tall instead of 30px, and its icons are the corner marks' 12px.

**Behaviour changes**

- A code block's Copy no longer follows the block's line height, and
`--lf-code-copy-size` is gone (both came from #3830). Every Copy is
20px. That also covers what #3830 fixed, a 32px Copy on a 19px line.
`page-authoring.md` drops its line about the property, and the
compact-line test now checks that Copy is the mark's size on a compact
block and on a tall one.
- A toolbar spaces its marks so their reaches meet without overlapping
(`gap: max(2px, aim floor − mark)`). That gap is 4px with a mouse and
24px under a finger. A finger's draft marks used to be 44px-wide faces.
They are now 20px faces, each with a 44px reach.
- Every mark's focus ring now lies on the mark's own edge. It used to
stand 2px out on a corner mark, inside a draft's marks, and 3px out on a
lone Copy.
- A toolbar mark under the pointer no longer gets a chip wash. Its icon
goes to full ink, as a corner mark's does.
- Every copy control now draws Leaf's icons. `copyControl` slots
icons.js's copy, check and cross icons, and icons.js gains a copy icon.
Web Awesome's glyphs fill their box, so at the shared size Copy had
stood larger than the pencil beside it. This also reaches the heading
link, which passes `icon: "link"` instead of slotting its own, and the
panel's copy presses and About rows, which now draw the 16px Leaf copy
icon like the panel's other icons.

**Deleted:** `--corner-mark`, `--lf-draft-mark`, `--lf-code-copy-size`,
the draft's own mark size and ring rules, the Copy part's size and
padding arithmetic, and `copySize`/`setCopySize` in `code-copy.js`. The
draft's marks drop `lf-btn lf-quiet-action lf-draft-action`. `leaf-dev
stills` gains `release-draft-hover` and `native-code-copy-hover`.

**Checked**

- Chromium stills against main. The fold, an attachment's × and a
drawing's marks on hover are pixel-identical in light and dark. The
draft toolbar, code Copy, keyboard focus and the phone draft toolbar
changed as described.
- Firefox: the draft's marks compute the same 20px faces, 12px icons,
ink and radius. Keyboard focus on a draft mark (dark) and on the
drawing's Undo draws the ring on the mark's edge.
- Under a finger, a draft's marks have 44px reaches that meet without
overlapping.
- 46 focused browser tests on drafts, copy, the attachment shelf, the
drawing, the panel fold and heading links pass. `pnpm run test:runtime`,
`pnpm run check:browser` and `tests/model/test_interact_layer.py` 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]>
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.

A code block's Copy button stays 32px on a compact code block

1 participant