Repository navigation
Keep each reading by the versions it read, and make again only the key one moved - #6413
Merged
Merged
Conversation
…y one moved A fact no signal carries, such as the page's reading, the threads' placement, a widget's layout, a visual's parts or a stored choice, now has a `version` its owner moves, in place of a function each reading asked again on every read (`reads`). A version whose owner moves it only as it catches up, as the page's watcher and placement do, names its catch-up, which a reading runs as it first reads the version and before it is checked. Every move of any version moves one count, so a reading checked since the last move stands without asking anything. `keptEach` keeps each key's reading on its own, so a version one key read makes that key again and no other: the assertion that an input any item read makes all again now asserts the opposite. A reading takes arguments, compared by identity and two lists by their items, and is read as `read(key, ...args)` rather than `read()(key)`. A reading around a make that threw is made again, as before. Outside any reading, `elementById` no longer catches the page's reading up, since it reads the document directly.
leaf-agent
approved these changes
Nov 18, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 18, 2026
#6413 and #6417 landed on main 15 seconds apart. #6417's `savedAt` called `placement()` and `reads(placement)`, which #6413 had replaced with versions its readings check, so on main `savedAt` throws a ReferenceError whenever the margin reads a saved comment draft, and the browser type check and three anchor-placement runtime tests fail. `savedAt` now settles and reads placement's version as `placedAt` does, and the merge of main into this branch no longer leaves it written twice.
This was referenced Nov 18, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 18, 2026
…t gallery (#6420) **Main is broken until this lands.** #6413 and #6417 merged 15 seconds apart, and #6417's `savedAt` still called `placement()` and `reads()`, which #6413 had removed. On main, `savedAt` throws a ReferenceError whenever the margin reads a saved comment draft, and the browser type check and three tests in `anchor-placement.test.mjs` fail. `savedAt` now reads placement as `placedAt` does; those tests fail on main's file and pass here. `leaf-dev placement cards` now has a case for a thread on one point of a chart. Since #6417 a thread on a part of a picture has its own margin entry and its card opens beside that part, but the gallery could only put a thread on a block or on quoted words. A case now takes `visual`, the part as an anchor names it, and the fixture page gains a chart of dots below its wide table. Each capture outlines what the card keeps clear of: the resolved element where the target names one, and the block otherwise. A part's capture therefore outlines the point rather than the whole chart, and every other case outlines the same box as before. | 1440×900: beside the point | 1000×700: above the point | | --- | --- | | <img width="420" src="https://gist.githubusercontent.com/max-sixty/cb0cd2b18d4f4718c5603b1ae50a92d7/raw/f46a65464c56682e47a1ec9914c3619d9170d24a/cards-chart-point-1440.png"> | <img width="420" src="https://gist.githubusercontent.com/max-sixty/cb0cd2b18d4f4718c5603b1ae50a92d7/raw/f46a65464c56682e47a1ec9914c3619d9170d24a/cards-chart-point-1000.png"> | In the 1000×700 window the card stands above the point and clear of it, but it covers the chart's upper half, including the week 4 and week 5 dots. It keeps clear of the part alone, as `comment-placement.js` has a card on a pointed table row keep clear of that row rather than the table. The gallery case was a follow-up the user asked for once #6417 landed. Tests: `check:browser`, the anchor-placement, annotation-inventory and kept runtime tests, and `uv run leaf-dev placement cards --case chart-point --case words` in Chromium, where the `words` case reads as before. > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Nov 18, 2026
…readings, and drop keptReadings (#6423) The second of the pull requests that bring Leaf's derived data onto one keeping primitive, which max-sixty asked for. It moves the publication fold and the memos written by hand onto `kept`/`keptEach` from #6413, and deletes `keptReadings`, the reader that kept each record beside an input list written by hand. Each thread, message, reaction, widget, obligation and queue row is now kept by the served record it is made from and the arguments it is given; each step and index of the fold by its arguments; and the whole fold by the seven values it reads, so a publication of a widget's output or new data folds nothing. A make sits at module scope and reads only its arguments, so a record can't read more than it is kept by: the message reading that read `messageBodies` without listing it now takes its body as an argument. The memos keyed by a list, and the vocabulary's readings, are kept readings too. To weigh: - Adoption captures message bodies by thread, and keeps a thread's together while its messages' read the same, so the fold's per-thread arguments stay one value each. - Admitted projection entries are kept by the served entry, so a widget's fold compares the entries in force by identity; a new wrapper around the same parts now counts as a change (the board test passes the same entry again). - A message's workflows are read from its thread's workflows, which the code already relied on holding every message's. - The page's version now moves where its reading changes rather than being compared on every catch-up. How it works replaces State → Shared readings with Derived data. Cost, on `leaf-dev bench --base` (Chromium, lowest of 3 rounds): on the threads page at 512 threads a click takes 32.0 ms of main thread against 34.5 and a reply 53.5 against 58.9; a keystroke and a wheel step measure as on main. On the asks page a click, keystroke, `m` press, wheel step and reply measure as on main within round-to-round noise. Tests: `pnpm run test:runtime` (1,044 pass), `pnpm run check:browser`, `tests/model/test_product_page.py`. > _This was written by Claude Code on behalf of max-sixty_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The first of the pull requests that bring Leaf's derived data onto one keeping primitive, a redesign of runtime caching max-sixty asked for, refined by a review. A fact no signal carries (the page's reading, the threads' placement, a widget's layout, a visual's parts, a stored choice) now has a
versionits owner moves, in place of a function every kept reading asked again on each read (reads). A version whose owner moves it only as it catches up, as the page's watcher and placement do, names its catch-up, which a reading runs before it is checked. Every move of any version moves one count, so a reading checked since the last move stands without asking anything.keptEachnow keeps each key on its own: a version one key read makes that key again and no other, where any key's version used to remake every key. Readings take arguments, compared by identity and lists by their items, which the next pull request uses to replacekeptReadingsin the publication fold.To weigh: a reading read from outside any other runs its catch-ups on every read, as
seats()did once per lookup it handed out; On Me's seats are now read one key at a time.Cost, on
leaf-dev bench --base(Chromium, 8–512 items, lowest of 3 rounds): a keystroke, anmpress and a wheel step measure as on main on the asks, document, prose, rows and threads pages, within round-to-round noise. The widest gap is the asks page's wheel step at 512 questions, 4.9 ms against 4.2.Tests:
pnpm run test:runtime(1,044 pass),pnpm run check:browser.