Skip to content

Correct three stale test comments the code no longer supports - #78

Merged
max-sixty merged 3 commits into
mainfrom
fix/stale-wait-mechanism-docstrings
Aug 27, 2026
Merged

max-sixty merged 3 commits into
mainfrom
fix/stale-wait-mechanism-docstrings

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

Three test comments state mechanisms or counts the code does not have. None of them changes what a test asserts — each is the causal argument a reader leans on when deciding whether the test is still evidence, which tests/CLAUDE.md ("Make a green test non-vacuous") makes load-bearing.

test_a_copy_carries_a_workers_standing_report names networkidle twice as what ordinarily absorbs the first state read. ad8bf50 took networkidle out of the export path — export_page now goes wait_until="load", with a comment saying the page holds the news stream open so the network is never idle and never will be. The same paragraph says replay's remaining chance is "the 2s retry"; the corrected text names both asks that sit on the far side of the stamp, since the stand-in refuses request zero alone — the news stream's ask as it opens, and the 2s tick behind it, which is still an ask while the first read is unanswered. The test still proves what it says it proves — export_page waits on lfApplied >= n_replayed, a product fact — so only the explanation moved.

test_site.py's site fixture says the build checks thirteen examples. publish_pages walks sorted(EXAMPLES.glob("*.html")), which is eleven. The count is dropped rather than corrected: it is not derived from anything, so the next example added or removed makes it wrong again.

test_render_controls.py's reload block makes the identical claim about the same corpus — "every one of the thirteen examples fails on it" — in the comment that justifies waiting on BOTH_STAMPS rather than one stamp. Same treatment: the count goes, the argument stays.

render_cases_layout.py and tests/CLAUDE.md also say "all ten examples", and those stay: they record what a planted cut did when it was run, not what the corpus is now.

No test accompanies this — the change is comment text only, and all three files collect and pass ruff check / ruff format --check unchanged. The three corrections are independent; any hunk can be dropped without affecting the others.

Where the code says otherwise
  • plugins/leaf/skills/leaf/scripts/leaf/rendering.py:886 — "See the gate: a page listening for news is never network-idle."
  • plugins/leaf/skills/leaf/scripts/leaf/rendering.py:902 — the lfApplied wait the test actually rests on.
  • plugins/leaf/skills/leaf/assets/leaf.js — listen()'s open handler: if (!readAnswered) void ask();, and the interval readAndPresent().finally(...) installs: if (readAnswered) heartbeat(); else void ask(); at TICK_MS = 2000.
  • scripts/site.py:216 — for source in sorted(EXAMPLES.glob("*.html")):
  • examples/ holds eleven *.html files.

The wider rename ad8bf50 began — "poll" as the name for the mechanism — is still standing in around forty comments across leaf.js, the runtime modules, and plugins/leaf/skills/leaf/CLAUDE.md, plus most of the browser test modules. Those read as a stale noun rather than a false statement (the heartbeat still re-applies every two seconds, so what they describe still happens), so they are left alone here — including the "first poll" in the controls comment this PR otherwise touches.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both corrections check out against the code: export_page goes wait_until="load" with the gate comment saying a page listening for news is never network-idle, the lf-upgraded stamp really is set synchronously right after readAndPresent() is started rather than awaited, and publish_pages walks sorted(EXAMPLES.glob("*.html")), which is eleven files. Dropping the count instead of correcting it is the right call for the same reason.

Two things, one in the diff and one just outside it.

The replacement re-states an exclusivity the code doesn't have. Inline suggestion below — the 2s tick is still an ask when the first read failed, so the news-stream open is the faster of two chances, not the only one.

tests/test_render_controls.py carries the same stale count this PR is fixing. Inside the reload block of the control sweep, the comment that ends refuse the first poll of each navigation here and every one of the thirteen examples fails on it — grep thirteen examples. That is the identical present-tense claim about a corpus of eleven, in a comment that is load-bearing in exactly the way the PR body argues these are (it is the justification for waiting on BOTH_STAMPS rather than one). It is outside the diff, so no inline suggestion; the same drop-the-count treatment applies — happy to push it as a second hunk here if you'd rather the two land together, since it is the same concern rather than a separate one.

(render_cases_layout.py and tests/CLAUDE.md also say all ten examples, but those read as a record of a past experiment — what a planted cut did when it was run — rather than a claim about the corpus now, so I left them.)

Comment thread tests/test_render_export.py Resolved
max-sixty and others added 2 commits August 27, 2026 03:11
The export docstring's replacement said the news-stream ask was replay's only
chance; the 2s tick behind it is still an ask when the first read failed, and
the route refuses request zero alone, so both are on the far side of the stamp.

The control sweep's reload comment made the same present-tense claim about the
corpus this PR is correcting elsewhere — thirteen examples, where the corpus is
eleven — in the comment that justifies waiting on BOTH_STAMPS.
@leaf-agent leaf-agent changed the title Correct two test docstrings the code no longer supports Correct three stale test comments the code no longer supports Aug 27, 2026
@max-sixty
max-sixty merged commit 9794ea4 into main Aug 27, 2026
7 checks passed
@max-sixty
max-sixty deleted the fix/stale-wait-mechanism-docstrings branch August 27, 2026 11:12
max-sixty added a commit that referenced this pull request Aug 27, 2026
Three test comments state mechanisms or counts the code does not have.
None of them changes what a test asserts — each is the causal argument a
reader leans on when deciding whether the test is still evidence, which
`tests/CLAUDE.md` ("Make a green test non-vacuous") makes load-bearing.

**`test_a_copy_carries_a_workers_standing_report`** names `networkidle`
twice as what ordinarily absorbs the first state read. `ad8bf50` took
`networkidle` out of the export path — `export_page` now goes
`wait_until="load"`, with a comment saying the page holds the news
stream open so the network is never idle and never will be. The same
paragraph says replay's remaining chance is "the 2s retry"; the
corrected text names both asks that sit on the far side of the stamp,
since the stand-in refuses request zero alone — the news stream's ask as
it opens, and the 2s tick behind it, which is still an ask while the
first read is unanswered. The test still proves what it says it proves —
`export_page` waits on `lfApplied >= n_replayed`, a product fact — so
only the explanation moved.

**`test_site.py`'s `site` fixture** says the build checks thirteen
examples. `publish_pages` walks `sorted(EXAMPLES.glob("*.html"))`, which
is eleven. The count is dropped rather than corrected: it is not derived
from anything, so the next example added or removed makes it wrong
again.

**`test_render_controls.py`'s reload block** makes the identical claim
about the same corpus — "every one of the thirteen examples fails on it"
— in the comment that justifies waiting on `BOTH_STAMPS` rather than one
stamp. Same treatment: the count goes, the argument stays.

`render_cases_layout.py` and `tests/CLAUDE.md` also say "all ten
examples", and those stay: they record what a planted cut did when it
was run, not what the corpus is now.

No test accompanies this — the change is comment text only, and all
three files collect and pass `ruff check` / `ruff format --check`
unchanged. The three corrections are independent; any hunk can be
dropped without affecting the others.

<details><summary>Where the code says otherwise</summary>

- `plugins/leaf/skills/leaf/scripts/leaf/rendering.py:886` — "See the
gate: a page listening for news is never network-idle."
- `plugins/leaf/skills/leaf/scripts/leaf/rendering.py:902` — the
`lfApplied` wait the test actually rests on.
- `plugins/leaf/skills/leaf/assets/leaf.js` — `listen()`'s `open`
handler: `if (!readAnswered) void ask();`, and the interval
`readAndPresent().finally(...)` installs: `if (readAnswered)
heartbeat(); else void ask();` at `TICK_MS = 2000`.
- `scripts/site.py:216` — `for source in
sorted(EXAMPLES.glob("*.html")):`
- `examples/` holds eleven `*.html` files.

The wider rename `ad8bf50` began — "poll" as the name for the mechanism
— is still standing in around forty comments across `leaf.js`, the
runtime modules, and `plugins/leaf/skills/leaf/CLAUDE.md`, plus most of
the browser test modules. Those read as a stale noun rather than a false
statement (the heartbeat still re-applies every two seconds, so what
they describe still happens), so they are left alone here — including
the "first poll" in the controls comment this PR otherwise touches.

</details>

---------

Co-authored-by: leaf-agent <[email protected]>
Co-authored-by: Maximilian Roos <[email protected]>
max-sixty added a commit that referenced this pull request Aug 27, 2026
Three test comments state mechanisms or counts the code does not have.
None of them changes what a test asserts — each is the causal argument a
reader leans on when deciding whether the test is still evidence, which
`tests/CLAUDE.md` ("Make a green test non-vacuous") makes load-bearing.

**`test_a_copy_carries_a_workers_standing_report`** names `networkidle`
twice as what ordinarily absorbs the first state read. `ad8bf50` took
`networkidle` out of the export path — `export_page` now goes
`wait_until="load"`, with a comment saying the page holds the news
stream open so the network is never idle and never will be. The same
paragraph says replay's remaining chance is "the 2s retry"; the
corrected text names both asks that sit on the far side of the stamp,
since the stand-in refuses request zero alone — the news stream's ask as
it opens, and the 2s tick behind it, which is still an ask while the
first read is unanswered. The test still proves what it says it proves —
`export_page` waits on `lfApplied >= n_replayed`, a product fact — so
only the explanation moved.

**`test_site.py`'s `site` fixture** says the build checks thirteen
examples. `publish_pages` walks `sorted(EXAMPLES.glob("*.html"))`, which
is eleven. The count is dropped rather than corrected: it is not derived
from anything, so the next example added or removed makes it wrong
again.

**`test_render_controls.py`'s reload block** makes the identical claim
about the same corpus — "every one of the thirteen examples fails on it"
— in the comment that justifies waiting on `BOTH_STAMPS` rather than one
stamp. Same treatment: the count goes, the argument stays.

`render_cases_layout.py` and `tests/CLAUDE.md` also say "all ten
examples", and those stay: they record what a planted cut did when it
was run, not what the corpus is now.

No test accompanies this — the change is comment text only, and all
three files collect and pass `ruff check` / `ruff format --check`
unchanged. The three corrections are independent; any hunk can be
dropped without affecting the others.

<details><summary>Where the code says otherwise</summary>

- `plugins/leaf/skills/leaf/scripts/leaf/rendering.py:886` — "See the
gate: a page listening for news is never network-idle."
- `plugins/leaf/skills/leaf/scripts/leaf/rendering.py:902` — the
`lfApplied` wait the test actually rests on.
- `plugins/leaf/skills/leaf/assets/leaf.js` — `listen()`'s `open`
handler: `if (!readAnswered) void ask();`, and the interval
`readAndPresent().finally(...)` installs: `if (readAnswered)
heartbeat(); else void ask();` at `TICK_MS = 2000`.
- `scripts/site.py:216` — `for source in
sorted(EXAMPLES.glob("*.html")):`
- `examples/` holds eleven `*.html` files.

The wider rename `ad8bf50` began — "poll" as the name for the mechanism
— is still standing in around forty comments across `leaf.js`, the
runtime modules, and `plugins/leaf/skills/leaf/CLAUDE.md`, plus most of
the browser test modules. Those read as a stale noun rather than a false
statement (the heartbeat still re-applies every two seconds, so what
they describe still happens), so they are left alone here — including
the "first poll" in the controls comment this PR otherwise touches.

</details>

---------

Co-authored-by: leaf-agent <[email protected]>
Co-authored-by: Maximilian Roos <[email protected]>
max-sixty added a commit that referenced this pull request Oct 12, 2026
…grows about the prose axis (#78)

A block that breaks out of the column (`data-width="wide"|"available"`, or a
widget's `x-space`) grew from its holder: its room and the split between its
two sides were measured against the holder's edges. A holder that stands in
from the column moved it: a wide block three list items deep centred 36px right
of the prose axis, one in a step list 17px, and one in a page's own indented
block 20px, and an `available` block left the room on the holder's indented
side unused.

## What changed

- **Measured, not declared.** The runtime's margin pass (prepaint.js,
  `residency`), which already measures the column before the page paints, now
  also reads, for each breakout in `main`, how far its holder's content box
  stands in from the column's on each side, and writes that on the breakout as
  `--lf-indent-l` and `--lf-indent-r` (registered in layouts.css, not
  inherited). Whatever moved the holder counts: a nested list item, a step
  list's padded items, a list the page resets to no indent (which declares
  nothing), or a page's own indented block. One layout read per breakout, on
  the pass that already reads the column: during parsing, before first paint,
  on resize and toggles, and, through a MutationObserver on the page's `main` in
  content-layout.js, on the frame after a revision or a widget inserts a
  breakout, or a `hidden` attribute changes over one, before that frame
  paints. A holder that is not rendered keeps its last reading; a breakout
  never read stands as if its holder were the column.
- **The breakout's split.** The breakout rule counts the indent as room on
  that side and splits its growth about the prose axis rather than the
  holder's, with neither side's growth below zero, so the box always covers
  its holder. Every breakout kind follows, since this split is the one rule
  they share. At 1440px a wide block stands at 180..1260 and an available one
  at 24..1416 in any holder, as in the page's own flow. On a phone a wide or
  available breakout in a nested list takes the full column (24..366), as the
  room there is the column.
- **Tables.** A table granted room that fits its holder stays with it,
  starting where the holder's text starts (432 three lists deep, 394 in a step
  list, 400 in an indented block). One wider than its holder keeps the
  holder's far edge until it is as wide as the column, then stands centred on
  the prose axis, so it covers its holder at every width and never jumps; with
  a sidebar in the left margin it starts at the prose's left edge and grows
  right. Its span and its caption's bound are the column's
  (`--lf-table-span`), no longer read through `100cqi`, which a container
  between the table and the column made the container's width.
- **Deleted.** The list-item exception for tables: a table with a width in a
  list item no longer fills its room (reading.css's `:not(li table)`), and
  layouts.css no longer leaves it out of table placement, since the measured
  indent places it as anywhere else. No kind of holder declares its indent:
  an earlier draft had lists publish theirs from reading.css and shadow.css,
  with an override for `ol.steps`, and it missed every holder it did not name.
- **Lists.** A list indents on its start side (`padding-inline-start`), so a
  right-to-left list indents on the right rather than taking 24px on the left
  and the browser's 40px on the right; `ol.steps` resets the same property.

## Measured (Chromium, 1440px, prose 360..1080, axis 720)

Main → this change. A wide block's offset of its centre from the axis, an
available block's extent (in the page's flow: 24..1416), an 8-column table's
centre offset, and where a 2-cell table starts:

| Holder | wide block | available block | 8-column table | 2-cell table |
|---|---|---|---|---|
| three nested list items | +36 → 0 | 96..1416 → 24..1416 | filled 96..1416 → 0 | filled → 432 (item's text) |
| `ol.steps` item | +17 → 0 | | | filled → 394 |
| list reset to no indent | 0 → 0 | | | filled → 360 |
| `.inset { padding-left: 40px }` | +20 → 0 | 64..1416 → 24..1416 | | 400 → 400 |

The same holds right to left, beside a contents map (available blocks take
the map's room, 72..1416, as in the flow), and with a margin sidebar (the box
starts at the prose's left edge, 360..1416). Exported pages place every case
identically in Chromium 153, Firefox 155 and WebKit 26.6, both directions.

## Tests

`test_a_breakout_in_an_indented_holder_measures_its_room_from_the_column`
replaces the nested-list test: three nested list items, a step list, a reset
list and an author-indented block against a breakout in the page's flow, on
even margins, beside a map, with a margin sidebar and on a phone, in both
directions, with a narrow table staying in its holder. It fails in every case
without the measurement. A later insertion was checked by inserting a nested
list holding a wide block after startup: the frame that first paints it
already holds it on the axis.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 12, 2026
…grows about the prose axis (#78)

A block that breaks out of the column (`data-width="wide"|"available"`, or a
widget's `x-space`) grew from its holder: its room and the split between its
two sides were measured against the holder's edges. A holder that stands in
from the column moved it: a wide block three list items deep centred 36px right
of the prose axis, one in a step list 17px, and one in a page's own indented
block 20px, and an `available` block left the room on the holder's indented
side unused.

## What changed

- **Measured, not declared.** The runtime's margin pass (prepaint.js,
  `residency`), which already measures the column before the page paints, now
  also reads, for each breakout in `main`, how far its holder's content box
  stands in from the column's on each side, and writes that on the breakout as
  `--lf-indent-l` and `--lf-indent-r` (registered in layouts.css, not
  inherited). Whatever moved the holder counts: a nested list item, a step
  list's padded items, a list the page resets to no indent (which declares
  nothing), a page's own indented block, or a widget's slot. The pass reads
  every edge before it writes any, so the page is laid out once however many
  breakouts it holds. It reads only what the browser is drawing: a breakout in
  a tab not chosen or a closed disclosure keeps its last reading (one never
  read stands as if its holder were the column), since reading skipped content
  forces its style and layout. A breakout inside another, and every breakout
  on a page whose `main` requests no column shell (a sidebar or workspace
  Layout, where nothing grows past its holder), carries none.
- **Read where the indent changes.** The pass runs during parsing, before
  first paint, on resize, toggles and chrome layout. Two later causes are read
  where they happen, before the frame that shows them paints, rather than on
  the next margin pass, which reads at most once a frame and would leave the
  breakout one frame off (content-layout.js): a breakout a revision or a
  widget inserts, or one a holder reveals (`hidden` removed, a disclosure
  opened), in the microtask a MutationObserver on `main` queues; and a holder
  a class or a style pads anew, through one ResizeObserver on every measured
  holder, which re-reads when a holder's width changes and ignores a change of
  height alone. A holder that moves without changing width, as a positioned or
  translated one, keeps its reading until the next pass.
- **The breakout's split.** The breakout rule counts the indent as room on
  that side and splits its growth about the prose axis rather than the
  holder's, with neither side's growth below zero, so the box always covers
  its holder. Every breakout kind follows, since this split is the one rule
  they share. At 1440px a wide block stands at 180..1260 and an available one
  at 24..1416 in any holder, as in the page's own flow. On a phone a wide or
  available breakout in a nested list takes the full column (24..366), as the
  room there is the column.
- **Tables.** A table granted room that fits its holder stays with it,
  starting where the holder's text starts (432 three lists deep, 394 in a step
  list, 400 in an indented block). One wider than its holder keeps the
  holder's far edge until it is as wide as the column, then stands centred on
  the prose axis, so it covers its holder at every width and never jumps; with
  a sidebar in the left margin it starts at the prose's left edge and grows
  right. Its span and its caption's bound are the column's
  (`--lf-table-span`), no longer read through `100cqi`, which a container
  between the table and the column made the container's width.
- **Deleted.** The list-item exception for tables: a table with a width in a
  list item no longer fills its room (reading.css's `:not(li table)`), and
  layouts.css no longer leaves it out of table placement, since the measured
  indent places it as anywhere else. No kind of holder declares its indent:
  an earlier draft had lists publish theirs from reading.css and shadow.css,
  with an override for `ol.steps`, and it missed every holder it did not name.
- **Lists.** A list indents on its start side (`padding-inline-start`), so a
  right-to-left list indents on the right rather than taking 24px on the left
  and the browser's 40px on the right; `ol.steps` resets the same property.

## Measured (Chromium, 1440px, prose 360..1080, axis 720)

Main → this change. A wide block's offset of its centre from the axis, an
available block's extent (in the page's flow: 24..1416), an 8-column table's
centre offset, and where a 2-cell table starts:

| Holder | wide block | available block | 8-column table | 2-cell table |
|---|---|---|---|---|
| three nested list items | +36 → 0 | 96..1416 → 24..1416 | filled 96..1416 → 0 | filled → 432 (item's text) |
| `ol.steps` item | +17 → 0 | | | filled → 394 |
| list reset to no indent | 0 → 0 | | | filled → 360 |
| `.inset { padding-left: 40px }` | +20 → 0 | 64..1416 → 24..1416 | | 400 → 400 |

The same holds right to left, beside a contents map (available blocks take
the map's room, 72..1416, as in the flow), and with a margin sidebar (the box
starts at the prose's left edge, 360..1416). Exported pages place every case
identically in Chromium 153, Firefox 155 and WebKit 26.6, both directions.

## Cost

The margin pass on the corpus page, which holds 35 breakouts and draws none
of them at first, most being in tabs not chosen, timed as
`lfInitial.residency()` after a style change on `body`: 8.3 to 8.9ms on main,
8.0 to 8.4ms with this change (medians of 9). Reading skipped content
instead took 119 to 125ms. Over a session of scrolling down
and back, choosing tabs, opening disclosures and keys on the same page, the
pass ran 13 times on main and here, and the indent was read 5 more times on
arrivals and resizes: 2.9ms in all on main, 7.7ms here. On a page where 40
nested breakouts all move, reading before writing takes a pass from 14.5ms to
10.7ms. Startup loads the same requests and bytes, with no layout shifts.

## Tests

`test_a_breakout_in_an_indented_holder_measures_its_room_from_the_column`
replaces the nested-list test: three nested list items, a step list, a reset
list and an author-indented block against a breakout in the page's flow, on
even margins, beside a map, with a margin sidebar and on a phone, in both
directions, with a narrow table staying in its holder. It fails in every case
without the measurement.
`test_a_breakout_moved_in_after_load_re_lands_before_it_paints` holds every
frame callback and reads in the rendering update that lays out a change: a
breakout inserted a list deeper, and a holder padded by a class and by an
inline style. Each fails without its reading (the insertion without the
microtask read, the padding without the holder observer).

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