From 99f5b10eccd95aa0066ea6fe6bb75f367ab56a47 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 18 Nov 2026 22:03:14 -0300 Subject: core: src/ becomes core/, pardes.zig its root.zig (the reorganisation's tree, step 2d), and every mention of a src/ path follows: the build's paths, the core's imports of its root, the tests that read the repository's files by path (lspbench's, look.zig's spans over core/look.zig), the comments that cite files, the documents and the manual (the typst corpus reads core/tutor.txt and core/plumbing); left as they were: the /src tree's served names (src/pardes.zig and the rest are the 9P tree's, not the repository's), the CHANGELOG's history, fixtures that are only strings; fs-unit-test runs from the core's root (a module of the core rooted at fs.zig had the runtime's and the devices' `core` be fs.zig); nothing else changes: the ledger (pardes.test.* now root.test.*), frames byte-identical, replicas and process-test the base's Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- docs/next-daemon.md | 72 ++++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'docs/next-daemon.md') diff --git a/docs/next-daemon.md b/docs/next-daemon.md index 382b3098..d93cbbea 100644 --- a/docs/next-daemon.md +++ b/docs/next-daemon.md @@ -60,7 +60,7 @@ smallest common grid across them. - **Processes.** - The daemon is subreaper, spawner, fd holder, registry and 9P root. *Built otherwise:* fd holder and registry only, and the switchboard of - the replica socket; no subreaper, no spawner, no 9P (`src/daemon.zig` + the replica socket; no subreaper, no spawner, no 9P (`runtime/daemon.zig` "It spawns nothing and is nobody's parent"). - Every session is a child of the daemon: a GUI window, a tty session behind a stub, or a headless session. *Built otherwise:* none is; a @@ -115,7 +115,7 @@ smallest common grid across them. metadata. Blobs are pinned rather than copied. A file's text and its line index are neither: an edit writes them in place, and the copy's allocator notes what each write into one that was there took out, which - a rollback writes back, the newest first (src/rollback.zig `wrote`). + a rollback writes back, the newest first (core/rollback.zig `wrote`). - On a divergence it restores that copy, then replays the confirmed events and its own pending ones. - The authority never rolls back. @@ -203,7 +203,7 @@ open. ## Phase 3 notes -Built 2026-10-29 (`src/daemon.zig`, the tty and GUI hosts, `main.zig`). +Built 2026-10-29 (`runtime/daemon.zig`, the tty and GUI hosts, `main.zig`). Decisions taken at the forks, with the ponytail lens: - **Sessions are not the daemon's children; every one registers.** The @@ -308,7 +308,7 @@ child; `std.posix.tcgetattr` (an ioctl on that layout) is the right one. a view is indexed now, and a second local terminal or window is a replica client; the in-process extra views described here are gone.) -Built 2026-10-29 (`src/views.zig`, the tty and GUI hosts, `daemon.zig`, +Built 2026-10-29 (`core/views.zig`, the tty and GUI hosts, `daemon.zig`, the snapshot harness and the monkey). Decisions taken at the forks, with the ponytail lens: @@ -644,7 +644,7 @@ Everything of ours lives in `/root/pardes-test`, nothing outside it. ## Phase 1 notes -Built 2026-10-29 (`src/walk.zig`, `src/tape.zig`, the hooks across the +Built 2026-10-29 (`core/walk.zig`, `core/tape.zig`, the hooks across the core; `pardes-snap --tape`, `pardes-monkey --tape`, `zig build replay`). Decisions taken at the forks, with the ponytail lens: @@ -790,7 +790,7 @@ thread start in the render). ## Tty throughput notes -Found and fixed 2026-10-29 (`src/tui/tui.zig`, `waitInput`). +Found and fixed 2026-10-29 (`dev/tui/tui.zig`, `waitInput`). - **What the 1 GB `yes` cell measures is mostly the kernel.** A pty's output processing (ONLCR, a `\n` made `\r\n`) costs the writer about @@ -982,7 +982,7 @@ against that tty, is the Tty throughput notes' keystroke-to-present. ## Phase 5 groundwork notes Built 2026-10-29: the delay relay (`test/delay_relay.py`), the replica -socket (`src/daemon.zig`, `src/detached/wire.zig`), and two measurements +socket (`runtime/daemon.zig`, `src/detached/wire.zig`), and two measurements for open points 3 and 5 (`zig build rollback-bench`, which runs `test/rollback_bench.zig`, and `test/fork_stall.py`). Decisions taken at the forks, with the ponytail lens: @@ -1175,14 +1175,14 @@ What proved wrong in the design: ## Phase 5 part A notes Built 2026-10-29, in one process and with no transport: the rollback copy -(`src/rollback.zig`), the replica engine (`src/replica.zig`), the tape's -speculation mode (`src/tape.zig`), and an in-process harness +(`core/rollback.zig`), the replica engine (`core/replica.zig`), the tape's +speculation mode (`core/tape.zig`), and an in-process harness (`test/replicas.zig`, `zig build replicas`). `zig build rollback-bench` now times the real copy. Decisions taken at the forks, with the ponytail lens: - **The copy saves bytes and puts them back where they were.** Its walk - is the digest's (src/walk.zig): views, buffers, registers, counters and + is the digest's (core/walk.zig): views, buffers, registers, counters and terminal metadata. It saves the bytes of every allocation the walk reaches, and puts each back over its allocation. That works because the replica core's allocator (`rollback.Epoch`) changes three things while @@ -1220,7 +1220,7 @@ lens: and their answers, digests aside), the head goes: that is the fast path. The digests are left out of the comparison because the starting states are equal by induction. A digest checks every unit a replica replays. -- **Each client has its own view** (src/views.zig). The authority goes +- **Each client has its own view** (core/views.zig). The authority goes into the client's view before its input (`toView`, which is taped), and the replica's speculation does the same. So a unit records the switch only when another view was live, alike on both sides. The views not @@ -1345,7 +1345,7 @@ Not done, and why: ## Phase 2 notes -Built 2026-10-29 (`src/walk.zig` Dump/Load, `src/dump.zig`, terminal.zig's +Built 2026-10-29 (`core/walk.zig` Dump/Load, `core/dump.zig`, terminal.zig's dump hooks; `pardes-snap --dump`, `pardes-monkey --dump`, and both in `zig build replay`). Decisions taken at the forks, with the ponytail lens: @@ -1602,7 +1602,7 @@ output); a dump is off the hot path. ## Phase 5 part B terminal notes Built 2026-10-29: screen-state terminals wired into the replicas -(`src/screen_state.zig`, `src/replica.zig`, `src/tape.zig`, +(`src/screen_state.zig`, `core/replica.zig`, `core/tape.zig`, `src/terminal.zig`; `zig build replicas`). Transport-free: bytes in, bytes out, proven in part A's in-process harness; the remote agent's stream carries them. Decisions taken at the forks, with the ponytail lens: @@ -1902,7 +1902,7 @@ Follow-ups (2026-10-29): ## Phase 5 part B notes -Built 2026-10-29 and 30: the stream over the replica socket (src/replica.zig +Built 2026-10-29 and 30: the stream over the replica socket (core/replica.zig `Peers`, and its client half, `dial` and `readStream`; detached/wire.zig version 15), the client process (`pardes --attach=:` and `--attach=:`, tty.zig `remote`), the session's side of it in @@ -1958,7 +1958,7 @@ replica clients. Decisions taken at the forks, with the ponytail lens: - A dump-loaded client's emulators are on the C heap, as `terminal.create` makes a screen replica's (walk.zig `.alloc` of a pane's `terminal`, dump.zig `terminal_gpa`). -- **Predicted echo is the echo agent's** (src/echo.zig), wired as its +- **Predicted echo is the echo agent's** (core/echo.zig), wired as its notes say: the client's core points at its replica's `echo`, a frame judges it before drawing, and a wake comes a frame later while predictions are out. PARDES_NO_ECHO turns it off. @@ -2276,7 +2276,7 @@ Not done, and why: ## Phase 6: upgrade notes -Built 2026-10-29 (`src/upgrade.zig`, the tty and GUI hosts, `daemon.zig`, +Built 2026-10-29 (`runtime/upgrade.zig`, the tty and GUI hosts, `daemon.zig`, `main.zig`, `dump.resumeFromDump`; `test/daemon.py --upgrade`). A running session, and the daemon, move onto the pardes installed since they started, in place: text, undo, views and layout, terminals with their @@ -2536,8 +2536,8 @@ Not done, and why: ## Phase 6: 9P round trips notes -Built 2026-10-30 (`src/9p_io.zig` Client, `src/fs.zig`, the Mount word in -`src/builtins.zig`, a paragraph of `docs/typ/reference.typ`). pardes's own +Built 2026-10-30 (`runtime/9p_io.zig` Client, `core/fs.zig`, the Mount word in +`core/builtins.zig`, a paragraph of `docs/typ/reference.typ`). pardes's own 9P client is what mounts, the Mount word, the forwarding CLI, `--wait` and Handover use; scripting clients (9p(1), 9ns, test/ninep.py) are not changed here. Decisions at the forks, with the ponytail lens: @@ -2592,7 +2592,7 @@ changed here. Decisions at the forks, with the ponytail lens: 2 s budget again, as each Twrite already did. Found on the way: on main, every read of one operation shared one 2 s budget, so a remote file of 1.3 MB failed to open (`dial failed: timed out`) at 80 and 207 ms. On - the box without `-C`, the 77 KB `src/fs.zig` failed too. + the box without `-C`, the 77 KB `core/fs.zig` failed too. - **A mount keeps its connection** (`kept`), as Plan 9's mount keeps its channel: an operation through it is the flight alone, with no dial, version or attach. @@ -2719,7 +2719,7 @@ Not done, and why: ## Phase 6: predicted echo notes -Built 2026-10-30 (`src/echo.zig`; hooks in `src/replica.zig`; a field on +Built 2026-10-30 (`core/echo.zig`; hooks in `core/replica.zig`; a field on the core and one call at the end of `body_layer.renderBody`; `zig build replicas -- --echo`). Transport-free like part B: proven in part A's in-process harness, carried by the remote client. A key typed into a @@ -3028,7 +3028,7 @@ Installed 2026-10-30 05:27 into ~/.local/bin: pardes and pardes-gui ## Phase 6: content cache and zstd notes -Built 2026-10-30 (`src/replica.zig`: `Peer.farJoin`, the `Framer`'s +Built 2026-10-30 (`core/replica.zig`: `Peer.farJoin`, the `Framer`'s envelopes, `Have` and `Cache`; detached/wire.zig version 16; `walk.blobs`; tty.zig `remote`; main.zig `remoteAttach`; libzstd in build.zig). A far client, one through ssh, is sent a join's blobs by hash and only those it @@ -3315,8 +3315,8 @@ Not done, and why: ## Phase 6: GUI replica notes -Built 2026-10-30 (`src/gui/gui.zig` `remote` and the window session's -`Peers`, `src/replica.zig` `Link`, `src/views.zig` `within`, the +Built 2026-10-30 (`dev/gui/gui.zig` `remote` and the window session's +`Peers`, `core/replica.zig` `Link`, `core/views.zig` `within`, the `builtins.zig` registry's `here`, `Event.frontend`, wire 16; `test/daemon.py --window-clients`). A window is now a replica client, of a terminal's session or a window's, and a window's session serves replicas of @@ -3716,7 +3716,7 @@ both the rule already written above, broken at one site each. leader) ran with `ops == null` and defaulted its outcome, where the authority's was the kind's: mispredicted every time. Fix: one line at the top of `Kind.reopen`, which a Look's open, a revived placeholder and a - kind's reload all pass through. Test at the end of `src/replica.zig`. + kind's reload all pass through. Test at the end of `core/replica.zig`. - **A view's facts read derived state a joiner had not derived.** `Kind.viewOf` told a kind its view's body rows minus its bands, read from `Pane.notices` (the live view) or `Pane.pv[k].notices` (another), both @@ -3731,7 +3731,7 @@ both the rule already written above, broken at one site each. view and `collectNotices` assigns it. Replicating the notices was rejected: `draw.place` writes `pane.notices` outside a step, a divergence of its own waiting; it still does, harmless now that no fact - reads it. No wire or digest cost. Test at the end of `src/replica.zig`. + reads it. No wire or digest cost. Test at the end of `core/replica.zig`. - The rule, restated: a fact told to a kind, or to anything a digest covers, is derived again from dumped state at the call, never read from a copy a step or a park left behind. @@ -3884,7 +3884,7 @@ the session's step and its replicas' replay disagreed. None was a lag. ThemeFile, DumpThemes, Config, DumpConfig, an init file saved). **The model:** what only the authority holds stays the authority's, and a - step reads it through `tape.authority` (src/tape.zig): a `value` read, + step reads it through `tape.authority` (core/tape.zig): a `value` read, its answer taped; a replay takes the answer, and a speculation that reaches one waits for it, as at a host call (one RTT, never wrong). A replica's own store and Recent are never read by a step. Rejected: the @@ -3968,13 +3968,13 @@ the session's step and its replicas' replay disagreed. None was a lag. 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 +Tests, each failing before its fix: core/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 +leaves the live view's slot holding nothing"), core/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"; src/replica.zig's "a step +client leaves, and one joins"), core/Places.zig ("a lowered copy's pieces not +searched yet are the same in every process"; core/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 @@ -4207,10 +4207,10 @@ before it. ## Phase 6: instant interaction notes -Built 2026-10-30 (`src/replica.zig`, `src/tape.zig`, `src/terminal.zig`, -`src/echo.zig`, `src/detached/wire.zig`'s `stamp`, one line in -`src/pardes.zig`; PARDES_TEST_LATENCY's `I` and `U` lines in -`src/gui/gui.zig`). The user: "make sure to use the mosh +Built 2026-10-30 (`core/replica.zig`, `core/tape.zig`, `src/terminal.zig`, +`core/echo.zig`, `src/detached/wire.zig`'s `stamp`, one line in +`core/root.zig`; PARDES_TEST_LATENCY's `I` and `U` lines in +`dev/gui/gui.zig`). The user: "make sure to use the mosh tricks so that user interaction to type/scroll/move the cursor feels instant specially when they don't require a request going to the daemon", and "measure it too since I don't want to catch those myself". The @@ -4252,7 +4252,7 @@ Decisions at the forks, with the ponytail lens: - **No digest in a speculation.** A first version kept a terminal speculation's digest to check its unit's against; but a blob born under the copy and digested keeps its word past the epoch's free of - it (src/walk.zig), and a later blob at that address read as it (the + it (core/walk.zig), and a later blob at that address read as it (the harness's Debug blob check, seed 11 at 207 ms). Gone: it is confirmed by its records, as any speculation is. - **Never kept to replay later.** A unit confirmed on the fast path @@ -4446,7 +4446,7 @@ After the line, the hunt's H21 (a client's normal end aborted): 2.5 min, both end 0; 4 min at seed 32, four clients, none aborts (its one breach, a window's panes gone from its view, is not this one). -**A rejoin's view is its own again** (2026-10-30; `src/views.zig`'s +**A rejoin's view is its own again** (2026-10-30; `core/views.zig`'s `away`, `Pardes.awayView`/`rejoinView`, wire 19). Every rejoin gave the client a new view, a copy of the session's: a divergence's, and above all an Upgrade's, which every client makes after each install (the hunt's -- cgit v1.3