summaryrefslogtreecommitdiff
path: root/core/Term.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-26 09:16:28 -0300
committerGabriel Schneider <[email protected]>2026-11-26 09:33:45 -0300
commitaa3ff349f840f568ea0f052c1f051cdc0dbb18c1 (patch)
tree4e47531e47e8ac5ab53af2c75c099fdd88190a93 /core/Term.zig
parent8959b031dc330b4da21c0e89e0831d6fadbcd757 (diff)
downloadpardes-aa3ff349f840f568ea0f052c1f051cdc0dbb18c1.tar.gz
pardes-aa3ff349f840f568ea0f052c1f051cdc0dbb18c1.zip
Kind, dump, replica: a plain kind's state opened or closed in a pane that stays (a picker's preview of a PDF, Pick.showKind; a file changed under its pane; an addon reloaded) is a write outside a client's rollback copy, so a client lets the copy go with that unit and never replays it over the copy (agent T23's find, which blocked the install: the soak `replicas -- --clients 5 --rtt 30,80,207` died with `allocator leaks detected` at seed 0 rtt 80 on T1's base and on M2, MuPDF's allocations of documents a picker previewed: contexts, documents, lanes, from Kind.reopen under Pick.showKind); THE CAUSE: no path of the preview forgets its close (the next row and a source change close through Pick.preview, Esc and every roll-up through restore and putBack, ⏎ through land's roll-up, a pane's end through teardownPane, the session's through Core.deinit; a dump carries the slot and the client's join opens it, closed the same ways), but replica.confirm's `ahead` rule: a client idle with its copy taken ahead (Replica.ready) replays the session's units on it and keeps each in `since` to replay again when the copy is put back, unless the unit wrote outside the copy (Pardes.outside, counted by the emulators alone) or opened or closed a pane (its serials); a preview opens the pdf addon's state in the pane the picker lands in, which stays, and that state (the document and its lanes, MuPDF's on the kind heap, the addon's `Own` found by its block's address) is no copy's; so a rollback (another's unit before the client's own key) put the copy back, the epoch freed the block, and the replay opened the document again for a new block: the first was never closed (and its `Own`, keyed by an address the epoch hands out again, could be found for another block); THE FIX: Kind.reopen and Kind.close count a plain kind's open and close in Pardes.outside, by the registry's PA_PLAIN, on every side alike whether the kind's code runs there or not (a client without the library counts as the session does), so confirm's one question lets such a unit go with the copy; dump.plainHere, a client's own open of a plain kind's pane at its join and no step of the session's, puts the count back to the session's as dumped; Term.Outside's and Pardes.outside's docs say so; RUN (TEST FIRST): replica.zig "a picker's preview opens and closes a plain kind's state in the pane it lands in, no pane opened or closed: ..." (a plain test kind `Owned` noting each state it opens and letting it go at its close, as the pdf addon's `Own`; files `.own`): a session at notes.txt in a work tree with paper.own, a client joined in its own view running the kind, idle with its copy taken ahead while the session types `SPC f f p` (the preview through the kind in notes.txt's pane), then a key of the client's own on top and the session's own key first (a rollback), the client's key, Esc; asks the digests equal at each end and no state left noted after both cores end: fails on M2 (8959b031dc33) at the last check (expected 0, found 1), passes now; the soak with the pdf addon (`zig build replicas -Dplatform=tui -- --clients 5 --rtt 30,80,207`, every addon the build has): diverged 0, unequal 0, quiet checks 508/0 474/0 665/0, stops not on may_wait 0, the corpus 22 of 22 scenes the same, no leak, the pdf panes the session opened 8, 6 and 5; a user could hit it as a client of a session whose picker previewed a PDF (a far client in a pair, a window joined to a terminal's session): a document leaked in the client at each rollback over such a preview, and pages drawn from another document's state where an address came back; NEW HOT PATHS: none per key or frame (a plain kind's open and close count one integer; a client lets its copy go at such a unit, as at a pane's open); GATES: core-test 1163/1337 (174 skipped: +1), its globals test (`nothing of a core is a process global`: the test kind's var in its test); no dump layout change (Pardes.outside was dumped and digested already; its values move at a plain kind's open and close, on every side alike); load 1.0 to 8.4
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/Term.zig')
-rw-r--r--core/Term.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/Term.zig b/core/Term.zig
index 509da6d9..2f0a0f3f 100644
--- a/core/Term.zig
+++ b/core/Term.zig
@@ -19,9 +19,11 @@ const iface = plain.term;
/// digested and dumped, a function of the tape, the same on every side (one
/// side's emulator written where the others' are not is a digest that says
/// `outside`). Every write below takes it and counts, and so does a write a
-/// speculation owes (`resize`): over an input's apply, the count moved is
-/// "this input wrote, or owes, state outside the copy", the one question
-/// core/replica.zig `confirm` asks a unit. A load sets it from the dump.
+/// speculation owes (`resize`), and a plain kind's state opened or closed
+/// (Kind.reopen, Kind.close: what it keeps beside its block, a PDF's
+/// document): over an input's apply, the count moved is "this input wrote,
+/// or owes, state outside the copy", the one question core/replica.zig
+/// `confirm` asks a unit. A load sets it from the dump.
pub const Outside = struct { n: u64 = 0 };
/// The reloads this process made (a join's, on every side) and their time,
/// for the soak's join line (test/replicas.zig `--bytes`).