From 2d269375f7b49cf430a2c2d62caed88aa5c10e37 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 30 Oct 2026 18:27:55 -0300 Subject: docs/next-daemon.md: fix2 on H18 (the same mechanism as fixer 1's, which lands; its create must make resize_to null), the kept-rows read flag, and the round's gate Co-Authored-By: Claude Opus 5.5 --- docs/next-daemon.md | 66 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 26 deletions(-) (limited to 'docs') diff --git a/docs/next-daemon.md b/docs/next-daemon.md index 9589c24f..b7820b06 100644 --- a/docs/next-daemon.md +++ b/docs/next-daemon.md @@ -3848,13 +3848,52 @@ the session's step and its replicas' replay disagreed. None was a lag. signatures, which were the jumps (Recent) and the places (the lowered copy) above; the slot was saved and put back all along. +- **A step that resized a terminal read rows its replicas could not be + sent** (H18). A client's first key into a terminal sizes it to its view + (`typedInto`, `sizes`); one that also read the shell's history in that + step (an edit copy over its text, `ovl`) read rows the replicas held as + holes. The session's `sync` reflowed its emulator inside the step, so + the rows `Screens.fill` sent before the unit were the reflowed grid's, + in the resize's new numbering (`Rows.epoch`); a replica replaying the + step on the grid its last delta made drops rows of another numbering + and read blanks. Every client diverged at that unit (`pane N.ovl`, and + `jumps … pane N.body` where the rest of the step read the reflowed + grid; `registers pane 2.body pane 2.ovl` in fixer 1's soak, a `d` in + a terminal's text whose step resized it). Seen with an instrumented + build on the hunt's seed 5 at 80 ms: the replica's `rows pane 2 epoch + 69/68`. + - The fix is fixer 1's (`terminal.resizeGrid` notes `resize_to` on an + authority with screen-state replicas, made after the unit in + `Peers.unit` and at `Peers.stop`), found on both lines at once; fix2's + was the same and is dropped. With it, `terminal.create` must make + `resize_to` null: it sets every field by hand, and the heap's bytes + there reflowed an emulator to 43690x43690 in a Debug run (0xAA). + - Found on the way: `shellRows` marked a terminal read only when it + built its rows, not when it handed out the kept ones, so a client that + came since (its history all holes) was sent none of what a step read. + - Not a stale round trip, as first supposed: a delta across a + renumbering is a reset already. The hunt's H7 fix (fixer 1's + `Rows.update`) is under this one. + - The gate on fix2's version of it (main mqkxnsqu, fixer 1's line): Debug `core-test` + and `unit-test` tty, `snap`, `replay`, `replicas` (none diverged or + unequal at 30, 80 and 207 ms), `test/daemon.py` 20, `--far`, + `--manage`, `--upgrade`, `--window-clients`, `--gui` 5, `test/fs.py`; + gui `core-test` and `unit-test` on main's two; ReleaseSafe + `test/daemon.py` 20, `--far`, `--window-clients`, `--gui` 5, + `--upgrade`, `test/fs.py`. Once, `test/daemon.py` 20 failed in its + far clients' end: a session asked to Exit twice closed its 9P link + before the second write's clunk was answered, an `EOFError` the test + takes for no `OSError`; twice again it passed. + Tests, each failing before its fix: src/rollback.zig ("a rollback leaves the store and Recent as a speculation left them", "a view drawn outside a step leaves the live view's slot holding nothing"), src/replica.zig ("a replica joined after a pane closed", with the variant hunt's Recent written by another window; "a replica's Del of a file its session's Recent knows"; "a client leaves, and one joins"), src/Places.zig ("a lowered copy's pieces not -searched yet are the same in every process"). The hunt's repros +searched yet are the same in every process"; src/replica.zig's "a step +that reads a terminal's rows as the core keeps them"). +The hunt's repros (`panes_closed.py`, `del_file.py`, `recent_store.py` with the client's own XDG_STATE_HOME, `leave_resize.py`) agree on the fixed builds; on the installed 0.24 `panes_closed.py` still rejoins 16 times. `zig build @@ -3919,31 +3958,6 @@ and scripts among the moves), twice: Not done, and found on the way: -- **H18, handed back: a terminal's resize leaves a replica's screen state - stale for a round trip.** Two signatures, both on every client at one - unit (`to_view`, a key, a `step` with a `pty_resize`): - - `pane 2.ovl` (the hunt's seed 5 at 80 ms, deterministic): an edit copy - extended over a three-row terminal read history rows that both - replicas held as blank holes where the session read text, and the - session sent none before the unit (`Screens.fill`). The resize in that - unit was another pane's. An instrumented build showed the step read - the rows through the core's cache (`shellRows`), which marks a - terminal read only when it builds the rows, so `fill` skips it; and - with that fixed the unit still diverged. - - `jumps … pane N.body` (this table's 80 ms cell, H5's own signature). - - The window: a resize renumbers a terminal's rows (`Rows.epoch`); the - session's next delta is against the old base, a replica refuses it - (`Renumbered`) and is started afresh a round trip later, while - `noteSent` took it as applied and expects the replica's holes where - they were. A step that reads the terminal meanwhile, or in the step - that resized it after the reflow, reads another grid on each side. - - The likely fix, untried: a delta across a renumbering is a reset - (`encode` with no base when the base's epoch is another), so the peer - is afresh at once and `fill` knows its holes; `shellRows` marks a read - on a kept hit too; and, with screen-state replicas, the session - reflows at the cut of the step's unit, not inside it, so the step - reads one grid on both sides. A test needs Screens with two replicas - of different sizes and a short terminal with a history. - **Two edges of the same class, left:** a pipe or an Edit in flight when a client joins (`Pipe.wait`, `.authority`, not dumped: the joiner drops its answer), and a 9P batch held at a join (`fs.batch`). Both need a -- cgit v1.3