Skip to content

Stop the poll these three draft-staleness tests race for - #6

Merged
max-sixty merged 4 commits into
mainfrom
fix/ci-32291274725
Aug 20, 2026
Merged

max-sixty merged 4 commits into
mainfrom
fix/ci-32291274725

Conversation

@leaf-agent

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

Copy link
Copy Markdown
Collaborator

Problem

Two draft-store tests went red on main — test_a_delayed_storage_event_cannot_send_a_stale_durable_generation (assert 1 == 0 on Traffic.sends) and test_poll_settlement_cannot_tombstone_a_newer_durable_generation (the stale tab's textarea already holding the newer generation). Both build a stale tab by suppressing its lf-draft:say:jobs storage event, but that only holds it stale until the tab's own next poll: settleAcceptedDrafts runs refreshDraftRecord over every draft context, which reads shared storage and adopts a newer generation. So the premise decays after POLL_MS, and a CI runner carrying eight workers spends more than that between the setup and the assertions.

Solution

Stop the stale tab's polls rather than racing them — tests/CLAUDE.md, "A race this machine won't lose is stated rather than run for". held_stale(context) is where that now lives, and it registers the refusal before the page exists, through primed: page.route reaches no request already in the wire, and a poll reconciles when its response lands rather than when its request went out, so a refusal registered on a live page leaves whatever is outstanding free to arrive later against storage the test has since moved. Routed through the context's new_page, no poll is ever unrouted. The first is let through because open_page waits for lf-applied, which rides on it — and that wait is also what leaves nothing outstanding when the page is handed over.

test_a_stale_cancel_cannot_settle_a_newer_durable_generation gets the same treatment: it passed on this run but rests on the identical window.

In the settlement test the released poll is the subject, so the refusal is lifted with the older attempt in the log and the older generation still cached — the only arrangement that asks anything. A reconciliation landing earlier leaves the tab already on the newer generation, and settlement then has nothing older to be tempted by: a vacuous pass rather than a red one.

Testing

Reproduction, fix, and bug-backs

Reproduced on this runner by inserting one poll interval where CI loses the race — time.sleep(3) after the other tab writes the newer generation. Without the fix that reproduces the CI failure exactly:

FAILED tests/test_render.py::test_a_delayed_storage_event_cannot_send_a_stale_durable_generation
AssertionError: Locator expected to have Value 'The stale tab's older generation.'
Actual value: The newer shared generation.

With the fix all three pass with that delay in place, and pass without it. The draft family around them (28 tests matching draft or stale or storage or attempt or tombstone or generation or send) passes.

Bug-backs, to check each test still catches what it names under the new arrangement:

  • sendDraft's refreshDraftRecord → rawDraftRecord (send trusting the stale cache): test_a_delayed_storage_event_cannot_send_a_stale_durable_generation fails, assert 1 == 0.
  • settleDraft and settleAcceptedDrafts' refreshDraftRecord → rawDraftRecord (settling from the stale cache): both test_poll_settlement_cannot_tombstone_a_newer_durable_generation and test_a_stale_cancel_cannot_settle_a_newer_durable_generation fail — the stale tab tombstones the newer generation and its box empties.

Suppressing a tab's `storage` event holds it stale only until its own next
poll: `settleAcceptedDrafts` refreshes every draft context against shared
storage before it settles anything, so the stale tab adopts the newer
generation within POLL_MS whatever the suppressed event did. Three tests rest
on that staleness across more of a wall clock than a loaded runner leaves them,
and two of them went red on main.

So the poll is stopped rather than raced, the way the neighbouring stale-first-
message test already does it. In the settlement test the poll released after the
append is the subject, so the refusal is lifted immediately before it: a
reconciliation landing earlier leaves nothing older for settlement to be tempted
by, and the test would pass having asked nothing.

@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.

One finding: the guard narrows the window it names rather than closing it, because page.route doesn't reach a request already in the wire. Detail and the one-line move inline — happy to push it if it reads right.

Comment thread tests/test_render.py Resolved
Comment thread tests/test_render.py Resolved

@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.

One finding, on the reasoning rather than the placement — the move itself is right, and it is the earliest point open_page leaves for it. What the new comment claims is that the window is closed; it is made narrow. refreshDraftRecord reads shared storage when a poll's response is handled, not when its request went out, so "a poll in flight at this moment" is not bounded by what storage holds at this line. Detail and a wording suggestion inline, plus the shape that would state it outright if you'd rather the code match the comment than the other way round.

Comment thread tests/test_render.py Resolved
held_stale routes each stale tab before it navigates, so the second
registration on the live page refuses nothing that was not already
refused — and the comments on it still said the guarantee came from
registering there, which is the claim the review refuted.

The settlement test keeps a note of its own, because that is where an
early reconciliation costs the most: it would leave the assertions
passing while asking nothing.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

A fourth member of this family went red on another branch's CI, if it's useful while this is open: test_failed_settlement_keeps_the_base_for_a_chained_nondurable_edit failed on #10's head with the local tab's draft record never reaching settled === true (run), and it passes in isolation. It builds its arrangement the same way the three here do — two tabs in one context, the local one's writes intercepted — so it may rest on the same window held_stale closes, though I haven't traced its settlement path to say that for certain.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

test_a_stale_cancel_cannot_settle_a_newer_durable_generation — the third test this PR covers, and the one whose window this PR describes as identical rather than observed — has now gone red on main: run 32321052048 on c9be5d4, failing at expect(current_draft.locator("textarea")).to_have_value(newer) after the stale tab's Cancel, with the textarea gone entirely (Actual value: None). So the window this closes is no longer hypothetical for that test.

The same run's other failure was unrelated (the keyboard-scroll test's stillness wait) and is in #13.

@max-sixty
max-sixty merged commit 602fd8b into main Aug 20, 2026
7 checks passed
max-sixty pushed a commit that referenced this pull request Aug 20, 2026
## Problem

[Run
32411981438](https://github.com/max-sixty/leaf/actions/runs/32411981438)
failed on two tests.
`test_the_ask_walk_reaches_an_ask_that_draws_no_box` was the recurring
one, and
[4bead16](4bead16)
has already fixed it on main — this PR is the other one,
`test_a_closed_sender_cannot_append_its_accepted_attempt_twice`, which
failed with `sends=0 acked=0 read=0 asked=16 heard=16`: the replacement
tab never posted at all.

The test says its premise in its own first line — "when its first sender
cannot settle it" — and only half of that was arranged. The wrapper the
test installs closes the send path: the POST lands, the server takes it,
and the runtime never hears the answer, so `sendDraft` never reaches
`settleDraft`. But `settleAcceptedDrafts` settles a draft from the poll
path too, and that tab was still polling. Within one poll of the server
taking the answer, the first tab read its own attempt back out of the
log, wrote the tombstone to shared `localStorage`, the replacement tab's
box emptied, and the send this test is about had nothing left to send.
Which assertion carried the failure depended on where the storage event
fell relative to Playwright's click — `sendDraft` refusing a settled
record (what CI saw), or Playwright refusing a Send the box had already
disabled.

The window is one poll interval against a Playwright click, so this
machine never loses it and a loaded runner does. The failing run took
624s against 478s for the run three minutes later.

## Solution

Both tabs open through `held_stale`, the helper
[#6](#6) added for exactly this:
every poll refused after the one `open_page`'s `lf-applied` stamp rides
on, registered through `primed` before the page navigates. On the sender
that closes the second settling path and completes the premise the
docstring already claimed. On the replacement it replaces a live
`second.route(...)`, which states the same fact but reaches no poll
already in the wire.

No assertion changed — `_until(second, t.acked == 1)`, the one-comment
check and the attempt check all still have to pass on their own terms.

## Testing

`uv run pytest tests/test_render.py --run-nightly` — 421 passed.
`pre-commit run --files tests/test_render.py` clean.

<details><summary>Reproduction and bug-back</summary>

The race is one poll interval wide, so it reproduces by spending one.
With a `first.wait_for_timeout(2500)` inserted between the accept and
the replacement's click, on main:

```
58 × waiting for element to be visible, enabled and stable
   - element is not enabled
1 failed in 39.44s
```

That is the later of the two shapes — the storage event had already
emptied the box and set `aria-disabled` before the click. CI caught the
earlier one, where the click lands and `sendDraft` finds a settled
record.

With this change, the same test survives `first.wait_for_timeout(6000)`
— three poll intervals — and passes in 14.84s. Removed before commit.

</details>

---

Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/32411981438)

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Aug 24, 2026
## Problem

[Run
32321052048](https://github.com/max-sixty/leaf/actions/runs/32321052048)
went red on main with two failures. This PR is the first:
`test_a_page_nobody_has_touched_scrolls_from_the_keyboard` failed with
`PageDown moved nothing on a page nobody had clicked in` (`assert 0 >
0`). The press was never what failed — the wait was. The test read the
scroll's resting place through `SCROLL_STILL`, which infers "stopped"
from a stretch with no change, and that is the inference
`tests/CLAUDE.md` names in "A wait consumes a fact the system states":
*a page that has not started moving is as still as one that finished*.
`wait_for_function` runs its predicate once at injection and once per
frame, so a runner that puts more than the 50ms hold plus a frame
between the press and the browser's first scrolled frame gets "still"
back while the page is still at the top the test reset it to a moment
earlier — and the assertion reads that zero as a dead key. The second
failure (`test_a_stale_cancel_cannot_settle_a_newer_durable_generation`)
is already fixed by #6; I've linked this run there rather than
duplicating it.

## Solution

The movement is waited for rather than inferred. `SCROLLED` is the fact
a press that scrolls the page states, and the stillness after it now
only measures where a scroll already in flight came to rest — which is
what leaves the next key's reset landing on a glide that is over rather
than one still on its way. The sibling test below already took that edge
first and now names it the same way, so the constant's contract ("only
ever asked after the movement itself has been observed") is true at both
call sites.

## Testing

<details><summary>Reproduction and bug-back</summary>

Reproduced by holding the browser's scroll back a fixed lateness while
frames keep ticking — `keydown` prevented, the scroll queued on a
`setTimeout` — which emulates the loaded runner without also stretching
the poller's own schedule (CPU throttling slows both, so it hides the
race rather than showing it):

```
old late=20ms  Space/PageDown/ArrowDown: read scrollTop=740
old late=120ms Space/PageDown/ArrowDown: read scrollTop=0     <- the CI failure verbatim
old late=400ms Space/PageDown/ArrowDown: read scrollTop=0
new late=20ms  Space/PageDown/ArrowDown: read scrollTop=740
new late=120ms Space/PageDown/ArrowDown: read scrollTop=740
new late=400ms Space/PageDown/ArrowDown: read scrollTop=740
```

Bug-back, so the test still catches what it names: commenting out
`document.body.focus({ preventScroll: true })` in `leaf.js` — the line
the test exists for — fails it, with the key named.

```
FAILED tests/test_render.py::test_a_page_nobody_has_touched_scrolls_from_the_keyboard
Failed: Space moved nothing on a page nobody had clicked in
```

With the runtime restored, the test passes, as do the 19 tests matching
`scroll or keyboard or esc_hands or focus`, and `pre-commit run --files
tests/test_render.py` is clean.

</details>

---

Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/32321052048)

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Sep 9, 2026
The notification playground previously spent most of a short first
viewport on repeated framing, and its configuration stopped at an
instruction rather than proving the promised agent workflow. This change
compacts the example around one question, gives the attention preset
honest content, and makes the selected configuration describe a concrete
local artifact and where its revision will appear.

The integration test drives the existing request lifecycle end to end: a
reader sends a configuration, the host picks it up, the agent writes and
captures `deployment-notification.html`, the page exposes that source
beneath the original configuration, and an anchored reader comment
produces a second artifact revision with a receipt. The test also covers
the replaceable configuration seat, source visibility, preserved
anchoring, and the updated file contents.

The catalog preview is refreshed at
`max-sixty/leaf-assets@357127280030c3a81425483f1c44fc152d29c7c6`, and
the completed #2, #4, #6, #8, #9, and #17 backlog entries are removed
while preserving the deferred evaluation work.

Verification: `uv run pytest tests` (944 passed), `uv run pre-commit run
--all-files`, rendered light/dark and short-window checks, standalone
export, and two context-blind Sol usability passes.

> _This was written by Codex on behalf of max-sixty_
max-sixty pushed a commit that referenced this pull request Sep 18, 2026
`notes/workspace-followups.md` has been presenting finished work as the
plan since 9 September. It opens with "Start #2, #3 and #4 as one
coordinated contract batch; run the review-queue simplification #8
alongside it" — all four of those shipped that week — and carries
thirteen briefs, each with a live "Next task" and "Done when", for work
`TODO.md` dropped as complete. This removes them and leaves the six
`TODO.md` still links: #11, #14, #19, #20, #22 and #23.

The trim follows the convention #666 set and the reason `CLAUDE.md`
gives for it: a note is never a second specification for shipped
behavior. #666 removed #6, #7, #16 and #17 the same way, rewriting the
two `Owner / dependencies` lines in surviving briefs that named them; it
simply did not reach the rest.

Each removal is evidenced by the commit that took the item out of
`TODO.md`, not by a reading of the current code:

| Brief | Removed from `TODO.md` by |
| --- | --- |
| #1, #3, #5 |
[`0f7f06a6`](0f7f06a)
— "Completed workspace items #1, #3, and #5 are removed from `TODO.md`"
|
| #2, #4, #8, #9 |
[`28b5da99`](28b5da9)
— "the completed #2, #4, #6, #8, #9, and #17 backlog entries are removed
while preserving the deferred evaluation work" |
| #13, #15 |
[`6df40353`](6df4035)
— "closes three bounded workspace follow-ups" |
| #10, #12 |
[`c9eaa2c6`](c9eaa2c)
— the continuation cue and the adaptive Threads placement |
| #18, #21 |
[`e46c8b93`](e46c8b9)
— the monitoring workspace and its package-owned root |

Alongside the briefs, three group headings are now empty and go; the
`Suggested work packages` table loses the rows whose whole scope landed;
and four cross-references that named a removed ID are rewritten — #14's
dependency on the Threads-placement experiment, #20's ordering behind
#8, and the two sentences in `Reproduction record` and `Browser
evidence` that pointed at briefs no longer here.

#14 needed more than a rewritten pointer. The experiment it waited on
was settled in two steps, and only the first removed an ID: [PR
#520](#520) kept the adaptive
placement and deferred the modal-focus work to #24, which landed in [PR
#536](#536) as inertness, dialog
semantics and focus containment for a covering workspace. That is the
surface #14 exists to verify, so its `Done when` — "Avoid imposing a
modal focus trap on a nonmodal panel" — described the containment #536
shipped as the defect to avoid. It now states the containment the
shipped modality requires, and the dependency line names both
settlements.

The dated evidence sections themselves stay. They are the record of what
was read in a browser on 8 September, not a plan, and the note's own
header scopes them to that date.

No test covers `notes/`, and this changes no behavior, so there is
nothing to regress. `pre-commit` passes on the file; the `TODO.md` →
note anchors all still resolve, and no surviving text references a
removed ID.

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 11, 2026
The module-authoring reference now states which renderer fits Leaf's
timing contract: public `render()` for a paint that must land in the
current turn, `LitElement` only for runtime faces that permit a
microtask delay. Package widgets remain `HTMLElement` consumers of
`widgetController` rather than keeping a reactive semantic-state copy.
The same section owns template container and native-node retention
guidance, and runtime maintainer instructions point to it.

Survey item #6. Runtime implementation is unchanged. The restriction on
`repeat` rows holding iframes or editors remains: sibling
[#2324](#2324) landed Leaf and
Sortable native moves but explicitly skipped the Lit adaptation after
stability failures. Lit still uses ordinary insertion; the guidance
describes that current boundary.

Measured source lines:

- skills/leaf/references/module-authoring.md: 1,295 → 1,307
- skills/leaf/assets/AGENTS.md: 558 → 562
- evals/widget-list-keeps-focus/case.yaml: 54 → 56

Validation: paired Codex authoring evaluation of an immediate receipt
after list removal passed on both base and candidate (one sample per
arm). Both traces loaded module-authoring.md and both answers used
synchronous public render with keyed focus recovery. This validates the
documented route; it does not establish an improvement in agent success
rate. The existing eval now grades that receipt and drops a stale
file-read assertion whose referenced helper no longer exists, consistent
with the evals' behavior-only contract. Focused instruction and eval
checks passed; independent review found no remaining issues.

> _This was written by Codex on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Oct 12, 2026
…s from TODO (#2525)

TODO.md gave #6 and #7 to items that notes/comparisons.md numbers
differently, so a bare id could mean either; TODO's two items are now
#26 and #27, the unfindable "#7 in the simplification audit" label is
gone, and the header says an id names one item across TODO.md and
notes/. Nothing outside TODO.md referred to the old ids.
notes/prose-review.md was mostly a record of landed phases, so it is now
notes/site-structure.md and holds only the open site-route proposal and
its two decisions, noting that the proposal predates /threads/ and
/website/ and that removing /registry/ has to re-home the `x-` key index
`leaf-dev keydocs` writes there. The stale "Rewrite Leaf's prose" Now
item, which still said the maintainer rewrite awaited review and cited
five decisions, becomes an Etc item triggered by preparing a release, as
the note itself deferred both decisions. Three notes no TODO item linked
now have one: undo-reach/ as a Next item waiting on the user's pick, and
datastore-review.md and named-widget-interfaces.md (#16) as Etc items
with their triggers; named-widget-interfaces.md now counts the diff
package's typed reference (`lf-call-diff` through `$diff.widgets`), and
#16's trigger names the command `goal` and `readings` interfaces. The
rust-sort item now links the workspace decision in chrome-and-covers.md
instead of calling that note its plan.

> _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 21, 2026
The local page server now answers documents and API requests with
`Cache-Control: no-cache` instead of `no-store`, so Chrome and Firefox
keep a Leaf page in their back/forward cache. Pressing Back after
following a link, such as a PR link on a page, now shows the page at
once instead of loading it from scratch. leaf.page keeps `no-store`,
including on its container's Python answers. This implements Max's
decision #6 on the overnight report.

`no-cache` lets the browser store an answer but has it check with the
server before each reuse. The server sends no validator, so each reuse
is a full fetch, and every load shows the page as it is now. The stored
copy holds what the page directory already keeps in plain files under
the same user's state home.

leaf.page keeps `no-store` because there the stored copy is new: a
visitor's private comments and replies would stay in the browser's disk
cache after their session ends, readable by anyone who later uses that
browser profile. `WebsitePageEndpoint` overrides the class attribute,
and a live sample's child page uses its parent's setting.

## Evidence

I served `release-notes` (no samples) and `corpus` (samples) from the
merge base and from this branch, followed a link off the page, opened a
thread from the CLI while the page was away, pressed Back, and waited
until the page had applied a `/api/state` answer taken after that
thread. Then I left again, opened another thread and loaded the URL
afresh. Chromium is Playwright's full Chromium 153 with Playwright's
`--disable-back-forward-cache` removed. Firefox is the installed Firefox
158.0.1 driven through geckodriver, because Playwright's Firefox
disables its page cache in the docshell.

| | Base (`no-store`) | This branch (`no-cache`) |
|---|---|---|
| Chromium, `release-notes`, Back | reloaded
(`MainResourceHasCacheControlNoStore`,
`JsNetworkRequestReceivedCacheControlNoStoreResource`), current after
243 ms | restored (`pageshow.persisted`), fetched `/api/state` 4 ms
after `pageshow`, current 43 ms after Back |
| Firefox, `release-notes`, Back | reloaded, current after 336 ms |
restored, current 31 ms after Back |
| Firefox, `corpus` (samples), Back | not run | not restored, as
expected for a page holding a sample; the document was fetched again
(767,652 bytes) and the page showed the current state |
| Chromium, `corpus`, Back | not run | restored, current 278 ms after
Back |
| Chromium, `release-notes`, Back with an `unload` handler (no page
cache) | not run | document fetched again (183,869 bytes), current |
| Fresh load after a change, every case | full fetch, current | full
fetch, current |

Safari wasn't tried. The run is recorded in `notes/browser-support.md`,
"Page cache", and the open leaf.page half of the question stays in
`TODO.md`.

> _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 Nov 6, 2026
…ge; travel goes to a passage's first drawn line

Placement re-placed a thread only where a change touched the text nodes its last
successful match stood in, so what a resolution depends on beyond those nodes went
unheard. In Chromium and Firefox, on 58753e4:
- words a script took out of a marked phrase and, in a later task, put back left it
  unmarked (#1);
- a second copy of a quote written in its section, with no context to tell the two
  apart, left the first marked (#1);
- a word prepended inside a declared shadow stage a passage runs into left both pieces
  marked, since the native walker never reached the page's piece before it (#2);
- an element inside a passage made contenteditable, which fences it, left it marked,
  since the watcher reported only text writes and child lists (#3).
Each was a mark a fresh resolution rejects, or one it finds that wasn't painted.

The page's index of quotes (passages.js, `trackQuotes`) now holds what a quote's
resolution depends on: every copy of each quote the threads name, placed or not, and the
words a resolution read beside a copy to tell copies apart (`near`). Copies are found by
hashing their letters, so one pass over the page finds every quote's copies, where a
pattern apiece searched the whole page, once per thread (#4). Between readings the index
is carried through the span the two readings differ in (`changedSpan`), which compares
the readings themselves, so text, edges, fences and the order the walk reads the page's
trees in all count, by the reading's own rules: copies outside the span stand, shifted
past it, and the span plus the widest quote's letters before it is searched again. The
words watcher no longer interprets which nodes a change touched; it says the reading
changed, and which text nodes a change wrote or took out, whose live ranges the DOM
moved even where the page then reads the same. Placement places again, after the
script, the threads whose quotes the index says changed (`quotesChanged`) and those
whose text nodes were rewritten, placed before or not. `runsOn`, the native walker and
the per-reading, per-section regex cache go.

A thread that comes to stand where the last paint marked nothing for it, and didn't
choose to (a resolved thread, a drawing), is painted by a presentation, since only a
paint of the page knows where it falls among the marks (anchor-paint.js, `replace`).

Overlapping copies still collapse into the first. What changes: the regex's lead
consumed its text whether or not the rest of the quote followed, so a lead that failed,
or crossed a fence, hid a real copy starting inside it; now only a copy does. This
reaches only quotes that overlap themselves.

Step 0, a paragraph holding N marked passages, toggling a leading space (Chromium):
- origin/main (6cc574a): the edit searches nothing and its next presentation searches
  each quote over the whole page: 32/512/1,600 searches, 24k/6M/59M characters,
  4.8/127/1,077 ms. The merge base (6b3159d) is the same.
- 58753e4: the edit runs those searches (reviewer's measure 0.5/7.5/42 ms).
- Now: 0 searches; the edit takes 0.75/2.5/6.4 ms, which at 1,600 is re-placing the 1,600
  threads whose node the edit rewrote. Pointer moves: 1.17 to 1.27 ms at 512, 3.29 to
  3.32 at 1,600; the scaling page's 1,600-section edit 9.0 to 7.1 ms, moves 1.58 to 1.44.
- Each script task that changes the page's words now builds the page reading once, for
  the index to compare: 0.3/2.2/6 ms at 32/512/1,600 sections. A counter redrawn every
  frame far from any mark costs 1.5 ms more a frame at 512 sections and 5 ms at 1,600.
- A presentation on the 1,600-mark paragraph still takes about 0.9 s, on main too: the
  inventory keys each passage's row by reading its whole block (`passageRow`).
- B, threads placed again over 80 moves beside a counter: 0 at 32 and 512 marks.

Where travel lands (#5, #6). `passageStart` read a passage's first line down the page,
so in vertical-rl it returned one character and `t` left the column at y 765-1165 in a
900 px window, and it took the first segment even where it draws no box, so `t` left a
passage whose first words are display:none at y 1,685. It now takes the first segment
the browser draws a box for and reads its line along the block axis of its writing mode.

Tests, each failing on 58753e4 in Chromium and Firefox:
- test_a_mark_whose_words_a_script_puts_back_is_marked_again (#1);
- test_a_marked_phrase_a_script_writes_again_is_marked_no_more (#1);
- test_words_a_script_puts_inside_a_passage_s_shadow_stage_unmark_it (#2);
- test_a_passage_a_script_makes_editable_inside_is_marked_no_more (#3);
- test_travel_to_a_thread_shows_the_first_line_its_passage_draws, vertical and hidden
  start (#5, #6).
Runtime: a kept quote answers each of nine changes as a fresh pass does, and the quotes
the index says changed are those whose answer did; a change beside a told-apart copy
changes its quote. Each fails with the window search, the fence or segment comparison,
or the `near` check taken out.
max-sixty added a commit that referenced this pull request Nov 14, 2026
… it lands (#5958)

Three readings asked where Leaf's glides under way will take a node,
each its own way. They now share `glideTravel` and `glideGap` in
`scroll-containers.js`: the distance the glides have still to scroll
every box carrying a node (`carriersOf`, so the page's glide carries a
thread card), and how far outside the window the node stands now and
once moved by it. Each caller keeps its own question.

Two behaviors change:

- **`focusPlace` counts a glide only while it carries focus toward the
window.** On main, with focus on a link mid-page, `g g` then `c` once
the link has left the window takes the page back down and comments on
the link. Now `c` opens the panel's comment at the top, as it does once
the glide has landed (Chromium and Firefox).
- **off-flow.js leaves an unseen surface to a glide that will bring it
into the window.** On main, `t` then `c` brings the card back mid-walk
and stops the page 360–375 px short of the walk's landing; now it lands
where `t` alone lands, and `t` then Tab does too in Firefox. Chromium's
own focus reveal still moves the page on `t` then Tab.

Where to look: focus uses "toward" and off-flow uses "into" because they
fail differently (a card's box trails its placement mid-walk; a
suppressed reveal is never retried), which the commit message details.
`alreadyShown` keeps its rule; `holdUserPlace` is untouched (it asks
whether any scroll moved the place, browser-run ones included).

Max asked for this as #6.3.3, the follow-up to #5895. Codex reviewed
three rounds; each found a defect in predicting where a node will stand,
which led to this design. Tests: a runtime assertion, a new `g g` then
`c` browser test and a stricter #5841 walk test, both failing on main's
runtime; `check:browser`, `test:runtime`, 25 focused browser cases.

> _This was written by Claude Code on behalf of max-sixty_
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