Skip to content

Make version travel one module, package diagram and diff, and let the corpus travel between versions - #207

Merged
max-sixty merged 20 commits into
mainfrom
simplification-review
Sep 2, 2026
Merged

max-sixty merged 20 commits into
mainfrom
simplification-review

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 2, 2026 •

Copy link
Copy Markdown
Owner

Three simplifications from the architecture review, plus the rewrite the first of them turned out to need. Each was picked on the review page; nothing here changes behaviour the suites pin.

Version travel is one module. runtime/version.js replaces version-navigation.js, version-diff.js, version-activation.js, and view-continuity.js, which were one gesture split four ways and wired back together with callbacks. The first pass merely joined the files (1200 lines for 1201), so it was rewritten: state application drives activation through prepareActivation and renderVersions instead of eleven accessors; install() returns the closure that restores the reader's place, standing, and comparison; the 95-line rollback snapshot is gone because the chooser renders from the last accepted state once the three current-document fields are restored beside the others; one fetcher serves the comparison base and the followed revision; one row builder serves stamped versions and drafts; the authored roots are captured at import. Code lines 844 to 789; leaf.js loses 51; #205's focus-keeping activation and banner notices are ported in.

Diagram and diff are packages. lf-diagram with Mermaid and lf-diff with the diff renderer move out of the default package into bundled diagram and diff packages selected by name; pr-review pages select diff beside it. A default page init goes from 7.73 MB to 2.57 MB. scripts/vendor.py gains package_vendor(name).

The corpus travels between versions. examples/log-retention ships a prior version under examples/versions/, and every builder stamps priors oldest first, so the corpus, the site, and the harness sweep reach the chooser, the changes-since marks, and a thread that survives a revision. example_versions() refuses a gap in the numbering.

The MCP snapshot reads the document's own text. Its posted quote now equals the file-side reading (shared collapse rules and block vocabulary), and the anchor refusal names a recourse both readers have. Parity tests compare the snapshot's quote with the file reader and the mark on the full page.

Also: three tests derive the version count and pr-walkthrough's title instead of assuming them, the standing-action gate composes the packages the served page runs, the layer test holds examples/layer.json against the packages directory so a bundled package cannot go unlisted, and tests/conftest.py carries main's macOS browser-fixture fix.

Verification

On fe4005a: uv run pytest tests 796 passed. The eight browser files that pin version travel pass plain and with --run-nightly except two reds that fail on main without this branch (the pr-walkthrough axe contrast check and the fragment-hydration retry); three other reds under a load average above 90 pass alone on both this branch and main. pre-commit run --from-ref main --to-ref HEAD clean.

An independent review of the version delta found four items, all folded in: the newest-version chip is painted only at the commit so a refused candidate's rollback is complete, an unused export removed, the module docstring names its whole surface, one formatter spelling.

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

🤖 Generated with Claude Code

https://claude.ai/code/session_01BvsgqUYTVQJ7gz9bmNqasz

max-sixty and others added 19 commits September 1, 2026 13:52
The comments-only MCP snapshot read a selection with `Selection.toString()`,
which gives back the host's rendering rather than the page's words. The theme
uppercases a `<th>` and an `.eyebrow` — every shipped example carries one — and
a `<br>` breaks a run the version file holds unbroken, so the append gate
answered a perfectly good selection with "the page doesn't say that", and the
reader had no way to fix it. The element anchor had the same shape of fault:
`composedPath()` runs out through the app's own shell, so a double press with no
page id above it posted `section: "page-host"`, an id no version has.

The app now reads the selected text nodes, puts one space wherever the enclosing
text block changes, and collapses with JS's whitespace class, which passages.py
spells out as COLLAPSE_CHARS. That block vocabulary travels in the tool result as
`textBlocks`, built from TEXT_BLOCK_TAGS, so there is no third list to hold equal
to the two that already exist. A dblclick looks only inside the rendered page.

Nothing else moves. The app still posts quote and section alone, and
`EventEndpoint(capture_anchors=True)` stays the one resolver: it writes the
neighbours that tell two copies apart and refuses a quote repeated without unique
context. The status box keeps that refusal's occurrence list on separate lines,
with the reader's draft where they typed it.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Version travel was 1,201 lines over four modules — version-navigation.js,
version-diff.js, version-activation.js, view-continuity.js — that only leaf.js
imported, wired with about sixty injected callbacks. Most of those callbacks
went between the four: the walk through the chooser's menu states a comparison
per row, an activation drops the standing comparison and puts it back, the
chooser's word says whether one is standing, and the activation captures the
reading landmark before it replaces the authored main. A boundary there is a set
of callbacks passed back and forth rather than a seam anything else can stand at.

runtime/version.js is those four, in the order the gesture runs: the chooser
control and its menu, the comparison, activation, then the landmark that survives
it. The callbacks the four exchanged with each other are now local calls, so
`comparable`, `paintDiff`, `pressComparison`, `setDiff`, `goVersion` and
`captureView` leave the public surface entirely, and leaf.js wires one factory
where it wired four. Twelve more dependencies were injections of things leaf.js
had itself imported (runtime, keys, paintKeys, inChrome, wrote, quoted, settle,
settling, textNodesUnder, pageScroller) and are now direct imports; the
`midComposition` passed to the navigation factory was never read at all.

Two moves the merge forced. `CHOOSER` — the page-level `v` that presses the
chooser — moves in beside the control it presses, which is what lets the initial
`paintDiff()` run at construction: the factory is composed where the banner row
is built, and reaching back to a `const` declared 1,700 lines later would be a
temporal dead zone. And `blocksOnScreen` stays exported, because
runtime/decisions/view.js starts its walk from it; geometry.js would have to be
handed the banner element and the text-block selector to own it, which is a new
seam in place of the one removed.

No reader-visible behaviour changes. `leaf version check --render` and the
version tests in tests/test_render_anchors.py pass.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
`page init` vendored the whole default layer into every page directory, and
two widgets carried most of its weight: `lf-diagram`'s Mermaid bundle is
3.57MB, `lf-diff`'s Pierre bundle and licence notice 1.73MB. Most pages draw
neither, so 5.3MB of every page directory was a renderer nobody on that page
would run — across 46 pages here, 211MB of vendor against 11MB distinct.

Each now travels in a bundled package selected by bare name, the way
`command-hub` and `pr-review` already are: `skills/leaf/packages/diagram/` and
`.../diff/`, each with its registry entry, widget module, theme rules and
vendored bundle, and the `unified-diff` data contract moving with the diff.
`scripts/vendor.py` gains `package_vendor(name)` so a bundle lands in the
package whose widget imports it, and re-running it reproduces the tracked
mermaid bytes at the new path. Nothing keeps the two reachable from the
default layer: a page that wants one says
`leaf page init --package diagram --package diff PAGE`.

Measured, `bin/leaf page init` into an empty directory: 8,108,637 bytes across
113 files before, 2,697,999 across 108 after — a 5.41MB drop, with `vendor/`
now 0.97MB (`plot.esm.js` and `mcp-page-app.html` are what remain).

The theme split is the delicate half. The default package stated its
pre-upgrade presentation as one rule over five tags; each moved tag restates
that rule in its own package, and the composed stylesheet is otherwise
byte-identical — the diff's whole `lf-shadow` block moves intact, and
`[data-lf-wide="drawing"]` stays in the default theme because it is written
against a declaration rather than a tag. Both examples that use the widgets
pass `version check --render` in light and dark.

`examples/layer.json` gains both names, which carries preview, the site build,
and the browser harness's default `serve`. The corpus floors now read their
package list off that file (`SHIPPED_PACKAGES`) rather than naming three
packages inline, so a widget leaving the default package cannot silently leave
the sweeps; widening it that way brought pr-review's widgets under the
attribute floor for the first time and found one uncovered attribute,
exempted with the reason it is unreachable.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
No authored page reached version travel, because examples/CLAUDE.md defined an
example as one stamped version. The chooser, the changes-since marks, the
activation that follows a newer version and the landmark that keeps the reader
in place across it were the page's largest body of behaviour with nothing in the
corpus behind them.

An example that was revised now ships each earlier version as
examples/versions/<stem>.vN.html. `example_versions` in scripts/example_data.py
is the one reader of that list, and each builder walks it oldest first through
the real `version stamp`: preview.py, publish_pages in site.py, `serve` in
render_harness.py, and test_examples_pass_check, which lints every version rather
than only the current one. The ordering is the filename's rather than a
manifest's, because every builder already writes its own stamp text; a
<stem>.versions.json naming each source with its changelog prose was the
alternative, and it would have added a fourth companion format that nine of the
ten examples would not have. Prior versions live under versions/ so the
`examples/*.html` glob every builder starts from keeps reading exactly the
examples — and so the twelve-shared-words check never reads a revision against
its own earlier draft.

Three orderings hold across the builders. The seed goes in after the first stamp
and before any later one, so a revised example reads the way it happened: the
version, what the reader said, then the version that answered them. The cursor
goes to the end after the last stamp. And the current version is written into the
page before the data operations, because the data door validates a source against
the page's markup.

The example is log-retention: a proposal to cut raw request log retention, and
the second version that answered a comment on its evidence. v2 rewrites one
paragraph around the sentence the reader quoted and adds a paragraph and a step,
so comparing with v1 marks exactly three blocks and leaves the section the other
thread stands on alone; both threads stay attached because both quotes survived.
test_a_revised_example_travels_between_its_own_versions reads that, and is the
corpus's floor for the feature — the example sweeps serve the newest version and
press nothing.

The site publishes every version of an example rather than v1 alone, and its
index forwards to the newest, so the chooser on leaf.page travels too.
test_a_shipped_log_opens_its_example_on_a_live_thread stops requiring a widget in
every seeded log: a message widget is a shared mechanism held by ship-review, and
its floor is the `drawn`/`decided` assertion after the loop.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
`capture_anchor` now answers two readers: the agent running `leaf comment`, and
a person selecting text in the comments-only MCP snapshot, who has no flags to
reach for. Its refusals told the second one to "scope it with --section", which
they cannot do.

Each refusal about a quote or a section keeps its finding — the passage appears
N times, is not in this version, sits in a widget's data body, or runs across a
widget's parts — and states the recourse both readers share: quote more of the
surrounding text, or name the section the passage sits in. One message per
condition, no per-transport wording, no flag selecting it. A refusal about a
CLI-only input still names its flag, since only the CLI can send one.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The corpus lede said "all nine authored pages" from a string constant no test
reads; it now says "every authored page", so adding an example cannot leave it
wrong. The log-retention example's first seeded comment carried a suffix
captured against v2 while claiming revision 1, and resolved only because the
quote was unique; it is recaptured through `leaf comment` against v1.
`example_versions` refuses a gap in prior-version numbering instead of
renumbering later versions by list position. The site test asserts every
shipped root has a theme half rather than that more than three do, and a
docstring line in site.py is re-wrapped.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…r path

`test_every_example_stands_as_a_live_page` asserted every example's chooser reads
v1; the revising example shows its newest version, so the expectation now comes
from `example_versions`. Two tests hard-coded pr-walkthrough's old heading, which
main retitled; both now read the h1 from the example source. The
`headless_shell` fixture found Playwright's Chromium build directory two levels
above the executable, which holds on Linux and not inside a macOS .app bundle;
it now finds the `chromium-<build>` ancestor by name, which turns four setup
errors on macOS into passes.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
# Conflicts:
#	tests/test_render_export.py
#	tests/test_site.py
#204 folded the comments-only snapshot into the one adaptive resource, so the
mechanism moves with it. `assets/mcp-app.html` is gone; the passage reading and
the shadow-scoped element lookup now live in snapshot mode inside
`scripts/mcp-app/page-app.js`, the status rule in `page-app.css`, and both reach
the host through `scripts/vendor.py mcp-app` rather than a hand-written asset.
The reading takes its block vocabulary from `current.textBlocks`, which
`app_snapshot` still carries from `passages.TEXT_BLOCK_TAGS`.

`cleanDocument` now strips `<style>` from the snapshot, so one class of
divergence the visibility check was covering is gone at the source; the check
stays for the generated and runtime nodes `pageCss` hides.

The reference keeps main's account of the adaptive bundle and its containment
rules, with the passage paragraph beside them. The parity tests follow main's
frame lookup, and the host stub answers a planted refusal before it picks which
payload to return.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
# Conflicts:
#	skills/leaf/packages/default/theme.css
#	tests/test_interact_mcp.py
The test hand-listed the default and command-hub packages, so a verb the
diff package declares (lf-diff review) counted as undeclared once the
renderer moved there. SHIPPED_PACKAGES is the list the served page runs.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The merge of the four version modules kept every seam it removed the
files around. This rewrite collapses them: state application drives
activation through prepareActivation and renderVersions instead of
eleven accessors; the activation's second half (the reader's place and
the dropped comparison) is a closure the install returns; the rollback
snapshot goes, since renderVersions is a function of the last accepted
state once the three current-document fields are restored beside the
others; one fetcher serves both the comparison base and the followed
revision; one row builder serves stamped versions and drafts; the
authored roots are captured at import, which runs before any head or
root write; LIVE_ROOT and the newest-version chip move to the owners
that read them.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
# Conflicts:
#	skills/leaf/assets/leaf.js
#	skills/leaf/assets/runtime/state-application.js
#	skills/leaf/assets/runtime/version-activation.js
#	skills/leaf/assets/runtime/version-diff.js
#	skills/leaf/assets/runtime/version-navigation.js
#	skills/leaf/assets/runtime/view-continuity.js
#	tests/conftest.py
Preparation lit the chip before the commit boundary, so a candidate
refused after that paint left the chip dark where the old snapshot had
put it back. renderVersions is now the chip's one painter, which makes a
refused candidate's rollback complete by construction. Also drops the
unused goActive export, names the module's whole surface in its
docstring and CLAUDE.md, and takes the pinned formatter's spelling in
passages.js.

Co-Authored-By: Claude Fable 5.1 <[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 version-travel merge holds up: the four modules' behaviour is present in runtime/version.js, the surface state-application.js drives is narrower than the eleven accessors it replaces, and the rollback path is genuinely simpler — repainting the chooser from the restored state works because an open menu never rebuilds its rows, so a focused row survives both the candidate and its rollback. The reading-parity work in page-app.js agrees with passages.py on the case that matters: Python's "block": tb if tb else self._fresh() is the same fallback as the runtime's blockOf, so text under no enclosing text block reads the same on both sides.

One thing the package split leaves open, on the same seam it set out to close.

Comment thread tests/test_interact_product.py Resolved
examples/layer.json is what every corpus floor reads, so a bundled package
missing from it would leave a green suite with no coverage of that
vocabulary. The layer test now asserts the manifest names every bundled
package directory and derives the resolved paths from it rather than
listing them a second time.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BvsgqUYTVQJ7gz9bmNqasz
@max-sixty
max-sixty merged commit dbdacbb into main Sep 2, 2026
9 checks passed
@max-sixty
max-sixty deleted the simplification-review branch September 2, 2026 02:05
max-sixty added a commit that referenced this pull request Sep 2, 2026
…the wrapped line's console

Two tests this branch added met main's #207 in the merge. The sentence test in
test_interact_layer builds its own page and that page holds an lf-diagram, which
now lives in the diagram package, so `page init` selects it the way the file's
other diagram page does. The wrapped-diff-line test took the console errors from
`_bound_diff` and never read them; it asserts they are empty at the end, as its
two siblings do, which is also what CI's lint was asking for.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
max-sixty added a commit that referenced this pull request Sep 2, 2026
…ts transition

The merge put `await importWidgets(source)` inside activateRevision, which main's
#207 now runs from `activation.install()` under the activation lock and inside
the view transition, so a first-time module fetch was spent while rendering was
paused and other state reads waited. prepareActivation already has the stretch
where the document itself is fetched; the import goes there, beside it, and the
install is synchronous up to settlement again. activateRevision has no other
caller, so the guarantee moves whole.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
max-sixty added a commit that referenced this pull request Sep 2, 2026
…diff: ten pieces from a UI and UX review (#209)

A UI and UX review of the layer, run as a Leaf page, and the ten pieces
picked from it as "Now", each built with a test. The review page is the
record of what was found and why each piece was picked; this description
is the map to the diff.

## What changed

**The banner folds instead of clipping.** Its addresses fold into one
overflow menu in a stated order when the row runs out of width, and the
status line is the one thing that gives up width; the newest-version
chip is marked urgent so the menu's door says when it holds news
(`runtime/banner-shelf.js`, `runtime/chrome-style.js`). The versions
menu hangs from the button that opens it, and its two ways out say their
direction (`runtime/version.js`).

**Every control has a box a reader can hit.** One theme rule gives every
pressable in the layer a floor of 24px on a fine pointer and 44px on a
coarse one, and one marker, the `data-lf-offer` value, says what a
reader can press, so the cursor and the outline come from the theme
rather than from each widget (`chrome-style.js`,
`packages/default/theme.css`). A receipt is a flat Button, not a press
(`runtime/living-margin.js`).

**The margin rail is reserved before the first gesture**, so the page no
longer narrows when the reader's first mark lands
(`runtime/margin-layout.js`). The inline thread card has a floor, and it
follows its marker when the page reflows under it (`living-margin.js`).

**A reader who lands is handed their place and their way in.** The skip
link rests transparent and stands where an ask arrival lands, an ask
arrival stands on the decision rather than below the fold, an empty Asks
tray says what it is empty of, and the resting key line shows only
presses that say something back, with the priority no row declared cut
from the register (`runtime/keyboard/`, `runtime/decisions/`,
`runtime/trays.js`).

**Diff basics.** A file header that pins under the banner while its rows
scroll, `]` `[` `}` `{` hunk and file keys — from the diff itself, with
nothing focused inside it, `]` lands on the first hunk and `[` on the
last — and a Soft wrap switch that paper always takes
(`packages/diff/widgets/lf-diff.js`, `packages/diff/theme.css`). A page
with only a manifest loads the renderer when it first draws lines.

**A page loads only the widget modules it uses**, and a version or a
reply that carries a new tag imports its module before insertion
(`runtime/widget-loader.js`, `runtime/version.js`,
`runtime/state-application.js`).

**The agent's path answers in sentences** where leaf was silent, `leaf
edit` included, with `--json` for the tests that parse it
(`scripts/leaf/cli.py`).

**Polish sweep**: a reacted passage has a visible mark, every elevation
shadow is cast in the scheme's own ink, every word on a surface names
one thing, a sheet prints what it can show and nothing it can press, a
reader can take an approval back, the diff tools row is declared as a
control archetype, and the small-screen map reads its seat from the
row's one order.

## Reading the diff

The branch merges main seven times; #205 (banner notices, persisted
keys) was dispatched from this review and is already on main. The #207
merge takes its single `runtime/version.js` and `diff` package: this
branch's hunks in the four modules it folded and the theme block it
moved are ported there, and `readingBlock` replaces the `blocksOnScreen`
export as the one reading the decision walk and the keyboard reference
start from. The fifth takes 17ed171, which moves each file's "Mark
reviewed" press out of its `<summary>` into a `.lf-diff-file` row beside
it. Two of this branch's rules met that row and are fixed in the merge
commit: the pinned summary's z-index covered the press on every file, so
the press now shares that level and paints above as the later sibling;
and the soft-wrap switch reached its rows through `~ details`, which the
wrapper broke, so it names the file rows. A review of that merge found
the third meeting: once a long file's header pinned, the press stayed
absolute at the file's top and drifted off it, its reserved column empty
and out of pointer reach for the rest of the file. The press is now a
block in the flow ahead of the disclosure, which is pulled back up over
it by a negative top margin, and sticks with the summary where it pins;
the pull is the disclosure's rather than the press's because a sticky
box is held inside its containing block by its margin box, and a
negative margin on the press let it outlive its file by 32px at every
boundary. The pinned-header test reads the press on the pinned line,
reaches it with a pointer, and reads it leaving with its file. The
seventh takes #212 (Button states, receipts, overflow), which answers
the same question this branch's "Sew a receipt Button flat" answered:
what the Button beside a move already made should promise. #212 keeps it
a pressable disclosure wearing its phase as a corner mark and states
that a settled outcome is receipt text beside Undo, never an inert
Button-shaped status; this branch had made it a flat `status` with no
press. The merge takes main's model and drops the flat receipt, its
theme rule, and its test; the accessible-name test beside it stays. The
choice is flagged in the review page, where the pick that led to the
flat receipt stands.

The sixth merge takes #211, which lands `a` on the region that explains
an ask, and 9a59df7's growing comment field. This branch focuses the
decision itself on arrival, its controls the next Tab stops, so the walk
keeps `arriveAt` in front of main's region travel, and #211's three
arrival tests expect the suggestion focused rather than its Accept, as
this branch's own arrival tests do.

The tend review on 1708469 read the whole diff and asked for three
things, all in ec55abb: `[` with nothing focused inside the diff
answered no hunk anywhere and walked the whole file list opening and
fetching each one — `beyond` now answers true in both directions, so the
backward walk opens the last file and lands on its last hunk, with a
test on a collapsed manifest that counts fetches and open files and
fails on the old answer; a comment in twice in
`served_state/conversation.py`; and `taken_back(events)` rebuilt per
event inside the `done` comprehension, now hoisted as every other reader
does.

<details><summary>Verification</summary>

On the branch head before the #207 merge (2fe649e): ten render suites
590 passed with one failure, main's own WCAG nested-interactive red on
the pr-walkthrough diff review button (since fixed on main by 17ed171);
everyday suite 793 passed; `pre-commit` clean. After merging #207 and
#208 (fbc02fe), on a machine at load average 200 shared with another
session's suite: everyday suite 797 passed, 1 failed — a test this
branch added whose page carries an `lf-diagram` that #207 moved into the
`diagram` package, fixed in 03cd748 by selecting the package. CI's lint
caught an unread console capture in one new test, fixed in the same
commit. An independent review of the merge resolution found every branch
hunk ported and no defects; its one design note, the widget import spent
inside the activation transition, is 3dea60b. A fourth commit dropped
two `.lf-margin-action` minimums as dead under the aim floor and
1b66f16 restores them: the floor's rule sits inside the `@scope
(.lf-chrome)` block and margin items are hoisted into `main`, outside
it, which a margin shape test pins. The thread-card fix carries a test
that fails with its listener removed. The b89560d merge ("Asks (3/7)"
while standing in an ask) keeps this branch's landing on the decision in
the one test both sides touched and takes main's count; the 17 ask and
decision tests pass. After the 17ed171 merge and the review fixes, the
19 diff, hunk and control-sweep tests across four render modules pass,
the Python sign-off tests pass, and the everyday suite passed on
ec55abb (798). After the #211 merge the 27 ask, decision, arrival and
response-field tests pass and the everyday suite passed again on the
merge (a56cdeb, 798) and on the pinned press (4bf1bb7, 798); CI's lint
wrapped one assertion in that test, 7dd0d41. CI on this PR is the
clean-machine gate.

</details>

> _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]>
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