Skip to content

Read the machine's other pages apart from each page's own reading - #6068

Merged
max-sixty merged 4 commits into
mainfrom
decouple-other-pages
Nov 16, 2026
Merged

max-sixty merged 4 commits into
mainfrom
decouple-other-pages

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A page's state and its freshness no longer depend on the machine's other pages. Each page's state answer and news token used to carry the list of other live pages (others). So any row change on any other page, such as a turn starting or a thread count moving, changed every page's news, and every open tab on the machine read its whole state again. Measured with the real code, five row changes on one neighbour moved a quiet page's news reading five times before this change and zero after.

The list now travels on its own. The news answer is {"reading", "pages"}: the page's own reading, and a token naming the list of other pages, null while none is live. A new GET /api/pages answers the list. The browser (live-leaves.js, hearPages) reads it only when that token moves, so a neighbour's change re-reads only the list, and the list keeps no consistency with the page's reading. A read of the list ends when the news moves past it, or when a news look fails, so a stalled request can't hold the list back. The All pages list arrives with the first news look after the page presents, adding nothing before presentation.

What to weigh:

  • /api/state and event answers drop others. The served schema moves the row to $defs/LivePage and adds NewsAnswer and PagesAnswer; about 100 of the production lines are that move.
  • Captures (render check, export, leaf.page) show their page alone, so the render check no longer checks the All pages surface.
  • stand_in_other_leaves stays: it answers a page that frames another live Leaf page, not this list.
  • About a dozen edited journey and browser test sites haven't run locally; they now wait for the page to offer All pages (all_pages_offered).

Max asked for this after a review of what Leaf shares across the machine: "can we decouple them so it's not like a page needs to have consistency guarantees with other pages?" Codex reviewed it and reproduced one bug, a stalled /api/pages request blocking every later update, which the second commit fixes with a test that fails on the first.

Tests: pnpm run test:runtime (984), pnpm run check, focused process and model tests including a new one for the decoupling, nine single browser and journey tests, and a probe of the all-pages state.

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

A page's state answer and its news token carried the list of the machine's
other live pages (`others`), and the presence token hashed it in, so every
row change on any other page (a turn starting, a thread count moving) changed
every page's news, and every open tab on the machine read its whole state
again. Measured before this change: five row changes on one neighbour moved a
quiet page's own news reading five times; after it, zero.

Now a page's state and its reading depend on that page alone. The news answer
is `{"reading", "pages"}`: the page's own reading, and a token naming the list
of other pages (`presence.pages_reading`), null while none is live. A new
`GET /api/pages` answers the list. The browser hands the pages token to
live-leaves.js (`hearPages`), which reads `/api/pages` only when the token
moves and empties the list without a read when it is null, so a neighbour's
change re-reads only that list and the page's state is never asked for. The
list keeps no consistency with the page's reading.

Behavior that changed:

- `/api/state` and the state an event answer carries no longer hold `others`,
  and the state reading no longer moves with other pages. The schema moves the
  row to `$defs/LivePage` and adds `NewsAnswer` and `PagesAnswer`.
- A capture (render check, export, leaf.page) shows its page alone: it lists
  no other page, where a render check used to freeze whatever was live then.
- The All pages list arrives with the first news look after the page presents
  rather than with the first state answer, so nothing is added before
  presentation, and a page with no neighbour makes no extra request.
- The browser no longer asks for its state when a neighbour's activity comes
  due; the neighbour's own server republishes its row at that transition,
  which moves the pages token.

Tests that waited for `state["others"]` now wait for the page to offer All
pages (`all_pages_offered`), and `told` loses its `until`, which only those
waits used. The test of an accepted retry scanning neighbours outside the
page's lock becomes a test that no state answer scans them at all.
`stand_in_other_leaves` stays: it answers a page's iframe of another live
Leaf page, not this list.
A read of `/api/pages` had no way to end, and only one could be out at a time,
so a request the server never answered, in its headers or its body, held
every later list back: later pages readings, none live, and then a new
reading all waited behind it, and All pages stood stale for good. While the
list rode in the state answer it inherited the state reads' cancellation.

Now the read ends on the event that makes it moot. A news look naming another
reading aborts the read still out and reads the new one at once; one naming
none live aborts it and empties the list; a look that hears nothing aborts it
too, as the feed ends its state reads then, and leaves the list standing for
the next look to name again. A late answer from an ended read is dropped. The
new runtime test holds each read open; it fails on the previous module.
leaf-agent
leaf-agent previously approved these changes Nov 15, 2026
…text

test_a_replaced_private_server_keeps_the_active_tab and
test_a_page_snapshot_stays_on_one_page_reading compared the whole /api/news
body with the page's reading; the answer is now {"reading", "pages"}, and a
capture names no list of pages.
@max-sixty
max-sixty merged commit 4d6f6eb into main Nov 16, 2026
4 of 5 checks passed
@max-sixty
max-sixty deleted the decouple-other-pages branch November 16, 2026 04:19
leaf-agent added a commit that referenced this pull request Nov 16, 2026
…and a deleted theme section (#6125)

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

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

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

Co-authored-by: leaf-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants