Skip to content

Re-derive and repaint only the widgets a gesture changed - #6070

Merged
max-sixty merged 3 commits into
mainfrom
fix-mac-only-tests
Nov 15, 2026
Merged

max-sixty merged 3 commits into
mainfrom
fix-mac-only-tests

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A click on one option made every widget's records again on each publication, and painted the projection's marks by reading the whole page. Three changes make that work follow what the gesture changed:

  • The obligation records and the On Me, On and done rows are kept while what each reads holds still (kept.js), so the publisher no longer compares every one of them by contents.
  • A selection whose derivation answers the same reading it answered last time now counts as unchanged (snapshot.js, select). Every widget's selection kept its reading, but had its contents compared again with the shared copy on every publication.
  • The projection's chrome keeps the elements it marked with origin and restatement marks, instead of querying the whole page three times per paint, and says only those elements' quiet words (sayQuietFacts).

At 1,024 sections (leaf-dev bench asks --base, interleaved, lowest of 3), base → head:

Input CPU (ms) Server's reading shown (ms)
click 83.3 → 71.1 121.2 → 91.3
comment 154.7 → 155.5 178.9 → 158.6
resolve 140.5 → 131.4 133.8 → 128.8

At 64 sections each reading is within a few ms of base.

Where to look: the select change relies on a derivation never changing a value it has returned, which the module header already asks of derivations; a derivation that mutated a reading it kept would now go unseen rather than compared. The one derivation that keeps a reading between calls, each widget's (selectWidget), never changes it once returned.

The browser tests of origin marks (10), obligations and the On Me lists (26), sends and the obligation walk (17), and widget state and revisions (69 of 70) pass, as do pnpm run check:browser and pnpm run test:runtime. The other one, test_a_control_a_widget_built_is_told_from_a_label_it_wrote, fails the same way on main on this Mac. max-sixty asked for this as part of removing whole-page work from each gesture's path; they haven't read it yet.

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

… per fold

Admitting an event read the whole log three times: once in the sender's
vocabulary for the contract gates, and once on each side of the append in the
active vocabulary to decide whether the event needs the agent's attention.
An event made against the newest revision has the same vocabulary for both,
so the log before it was read twice. Admission now reuses the first reading
there.

Each reading's fold (`state_projection`) also rebuilt and deep-copied a
widget verb's current state definition for every event, though the definition
depends only on the widget and the verb. It is now built once per widget verb
per fold.

`leaf-dev bench --read server --sizes 128,512,1024 --rounds 3`, base then
head, least CPU of 3, ms at 1,024 events:

| Page | append | state |
| --- | --- | --- |
| events | 74.6 → 38.3 | 41.5 → 32.7 |
| widgets | 132.7 → 98.3 | 65.5 → 66.3 |
| cards | 187.9 → 159.6 | 133.1 → 121.1 |

A click's server paths (append, then state) at 512 events: events 58.7 →
33.6, widgets 97.6 → 87.9, cards 129.4 → 110.3.

The model tier (`uv run pytest tests/model`, 3,161) passes.

> _This was written by Claude Code on behalf of max-sixty_
A click on one option made every widget's records again on each publication,
and painted the projection's marks by reading the whole page:

- The obligations step rebuilt every widget obligation's record whenever any
  widget's state moved, and the On Me, On <agent> and done lists rebuilt every
  row, so the publisher compared each one with the last by its contents. Each
  record and row is now kept while what it reads holds still (kept.js).
- A selection whose derivation answered the same reading it kept had its
  contents compared again with the shared copy, which is another object. Every
  widget's selection did this on every publication. A selection now takes the
  same answer as no change (snapshot.js, `select`).
- The projection's chrome found the elements wearing its origin and
  restatement marks with three queries of the whole page on each paint, and
  said each one's quiet word again. It now keeps the elements it marked, and
  says the quiet words of those alone (`sayQuietFacts`).

On a click at 1,024 sections, the values the publisher compared fell from
4,166 to 2,124, and its comparing from 28.4 to 10.8 ms (instrumented, under
load). `leaf-dev bench asks --input click --input comment --input resolve
--sizes 64,1024 --rounds 3 --base`, interleaved, lowest of 3, at 1,024
sections, base → head:

| Input | CPU (ms) | Server's reading shown (ms) |
| --- | --- | --- |
| click | 83.3 → 71.1 | 121.2 → 91.3 |
| comment | 154.7 → 155.5 | 178.9 → 158.6 |
| resolve | 140.5 → 131.4 | 133.8 → 128.8 |

At 64 sections each reading is within a few ms of base.

The browser tests of origin marks and quiet words (10), obligations and the
On Me lists (26), sends and the obligation walk (17), and widget state and
revisions (69 of 70) pass, as do `pnpm run check:browser` and
`pnpm run test:runtime` (982). The other one,
`test_a_control_a_widget_built_is_told_from_a_label_it_wrote`, fails the same
way on main on this Mac.

> _This was written by Claude Code on behalf of max-sixty_
@max-sixty
max-sixty merged commit 042db11 into main Nov 15, 2026
4 of 5 checks passed
@max-sixty
max-sixty deleted the fix-mac-only-tests branch November 15, 2026 20:03
max-sixty added a commit that referenced this pull request Nov 15, 2026
…per pass for each (#6078)

Comments only. After #6052 and #6070, a click on the 1,024-section page
`leaf-dev bench` generates shows the server's reading within the 100 ms
budget, but sending a comment (159 ms) and resolving a thread (129 ms)
still don't. Each remaining whole-page cost now has a note at the code
that pays it, saying what it costs there and what change would make it
cost what the gesture changed:

- `collectEntries` (annotation-inventory.js): rebuilds and re-sorts
every group each collection, about 10 ms, twice per send.
- `markerName` (margin-projection.js): every marker's name carries its
place and distance down, so one new marker renames them all and reads
every target's box, about 9 ms per send. Changing it changes what a
screen reader hears, so it is the maintainer's call.
- `layoutMountedRows` (margin-layout.js): seats every row each pass,
kept ones included, about 8 ms a pass.
- snapshot.js header: publication knows which members it shared, but
readers still diff whole collections.
- `admitted_event` (event_contracts.py): `after` and the state read fold
the whole log again.
- `read_events` (event_log.py): every request parses the whole log, a
fifth to a quarter of a request on the cards page at 1,024 events.
- event_meaning.py: each move records its container's whole authored
order, so the cards log grows with the square of its moves.

Asked for by max-sixty. Pre-commit passes on the changed files.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 16, 2026
…and a deleted theme section (#6125)

Brings seven comments and docstrings in line with code that changed in
the last day. No code changes.

- **Draft carrying (#6060).** #6060 removed `carry` from `openComposer`,
so a new target opens its own draft and earlier words stay with their
passage. It also dropped the word "Draft" from Threads' row status. Four
comments still described the old behavior:
- `composing/surface.js`'s header said `commentOnTarget` carries an
unsent draft to the new target.
- `composing/aim.js` said an ⌥ press moves the draft onto another
target.
- `composing/selection.js` said an explicit Comment gesture can carry
user text.
  - `floating-panel.js` said a drafted Threads row says "Draft".
- **Other pages (#6068).** The served `others` list became `/api/pages`,
but `server.py`'s docstring for the machine key still named the `others`
menu.
- **Theme tokens (#6025).** `tests/browser/test_render_anchors.py` cited
`package-themes.md`'s "Theme colors" section, which #6025 replaced with
"Theme tokens".
- **`renderQuiet` (#6070).** Its new comment said it runs as a message's
markup arrives. `paintDeclaredWords` also runs it on the page at upgrade
and on a revision's roots.

Found by the nightly review of the commits since the last run.

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