diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 20:40:15 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 20:55:07 -0300 |
| commit | 0f7d09690676656f03318362c0bc6a29f7ca801a (patch) | |
| tree | 063390f312f5c5d8435a3449b6c96964cc728f73 /docs/next-daemon.md | |
| parent | a92d7f81fa21598c23cbbe1b0ee827386bdd4f9c (diff) | |
| download | pardes-0f7d09690676656f03318362c0bc6a29f7ca801a.tar.gz pardes-0f7d09690676656f03318362c0bc6a29f7ca801a.zip | |
docs: next-daemon.md's notes on the reorganisation (2026-11-17 to 19), the last but two, in the notes' own form: the rulings it built on (P12 to P16, P30's principle), the tree, the frontends from the frame, one client loop and one session loop, the soak running both, what a far client does at once and may_wait, the session's facts and the machine's lines, no process globals and the two rollback faults, nothing a frame writes read by a step, an entry written once, the tape as a handle as far as it went, slots as types, and what the real loops found (an idle client's checks, an addon load taken for a crash, a draw kept, the cli's serve thread, mvzr's reads); its opening points at them, and the GUI replica notes' "no glide" in a client is marked built since (measured 2026-11-17: the notch glides); the cheatsheet, the book and the site build (zig build cheatsheet, book, site, -Dplatform=tui, to a scratch prefix), core-test's drift test (docs/typ names only words, keys and default tags that exist) passes, and every path, identifier and line cited in the added lines exists on pardes-merge22 (the checker in .scratch/sketch/reorg/pardes-docs-arch/check.py: 454 ok, 0 bad); no code changed, so the suites and the corpus were not run
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'docs/next-daemon.md')
| -rw-r--r-- | docs/next-daemon.md | 109 |
1 files changed, 105 insertions, 4 deletions
diff --git a/docs/next-daemon.md b/docs/next-daemon.md index d93cbbea..f4682b56 100644 --- a/docs/next-daemon.md +++ b/docs/next-daemon.md @@ -9,8 +9,9 @@ Designed 2026-10-29 in discussion (the user, the coordinator, a survey agent), and built since, phase by phase (phases 1 to 6, then the -architecture steps): each phase's notes below say what was built, and where -it went otherwise than the design that follows. Where the build differs, the +architecture steps, then the reorganisation of 2026-11-17 to 19): each +phase's notes below say what was built, and where it went otherwise than +the design that follows; the reorganisation's notes are the last but two. Where the build differs, the design's line is kept and marked *Built otherwise*. What runs today, in the words ruled on 2026-11-17 (session, client, far, frontend, detached, attach), is the manual's "How pardes runs" (`docs/typ/running.typ`); where @@ -3358,7 +3359,10 @@ either kind. Decisions at the forks, with the ponytail lens: - **The wheel in a client moves a row a turn.** The window's glide and a touchpad's fraction run on the core's clock, which in a client is the session's and moves only with its units. ponytail: whole rows, no glide; - the local window's is unchanged. + the local window's is unchanged. *Built since:* the notch glides in a + client as in the session's own window (measured 2026-11-17, 5 frames, 0 + to -22 px): whole rows go to the session, and the picture moves between + them on the client's own clock (`dev/gui/gui.zig` `glideFrame`). - **A client says its frontend first** (`Event.frontend`: windowed, native images and patches; wire 16, client tag 0x20): the view the session opens for a joiner copies the live view's, and a window's view of a terminal's @@ -3610,7 +3614,7 @@ Not done, and why: touchpad's fractions are the client window's own picture, and only its whole rows go to the session (`gui.zig`, the test "detached trackpad scrolling keeps fractions local and queues whole rows for replication"); - a wheel's notch is still whole rows with no glide. + a wheel's notch glides too (above). - **The notice a client gets is in its title and its log, not its frame** (the session's words: joined again, let go, refused). The tty's draws them on its notice band, which the window's frame has no slot for @@ -4615,6 +4619,103 @@ After it, the query pane's two: min and six clients (late windows and a late terminal among them): no rejoin, no differing check, no panic. All pass. +## The reorganisation notes (2026-11-17 to 2026-11-19) + +The reorganisation (`.scratch/sketch/PARDES.md`, its rulings P12 to P30) +kept the design above: speculation and rollback, the session the only +orderer. The user's rulings it built on: a far client keeps instant local +echo and the replicated core stays (P12, P13); on a far client typing, +motions, edits and layout are instant and what has a side effect on the +system may take the round trip (P14); a client's yank fills the client's +clipboard, and a layout change beside a shell is instant (P16). And the +rule every later choice is measured by (P30): "keep the wire protocol +simple and raw, and the local state process it" (`docs/typ/building.typ`, +"The principle"). What was built, as it stands: + +- **The tree.** `src/` became four directories, each a module that names + the others: `core/` (`core/root.zig`, the core's struct + `core/Core.zig`), `dev/` (the frontends `dev/tui`, `dev/gui`, `dev/macos`, + and `dev/host_io.zig` cut into `Host`, `Shell`, `Inbox`, `KindJob`, + `Lsp`), `runtime/` (main, the daemon, the upgrade, 9P's transport, the + loops) and `abi/` (the wire, `plain`, `term`, the headers). A test + program runs its root module's tests, so a suite runs one a module. +- **The frontends draw from the frame.** A frontend reads the `Surface` + and one record beside it, `Facts` (`core/surface.zig`, filled by + `draw.place`), to draw and to turn input into events, never the core; + so a client no longer makes its view live to read it (`OwnView`, + `Replica.within` deleted). Its frame statistics are its runner's + (`FrameStats`), and `present` says whether it showed the frame + (`present_skipped` gone). Left reading the core: the window's hit + test, its close, a session window's font. +- **One client loop** (`runtime/client.zig`, `Loop(Frontend)`), which the + terminal's client (`Tty`) and the window's (`Client`) run: the joins and + the reader thread, and a pass of the frontend's calls (`own`, `again`, + `deadline`, `wait`, `present`, `copy`, `paste`, `open`, ...), written + once where `runClient` and `clientSession` each had their own. A client's + input is sent before it is applied (`Replica.pend`), and its yank, paste + and link are done on the client's machine. +- **One session loop** (`runtime/session.zig`, `Loop(Frontend)`), which + the terminal's and the window's own frontend (`Own`) run: the + allocators, the workers, the core, the prompt files, the 9P listener, + `Peers`, the pump and the unit, an Upgrade or a Restore, and one order + for the parts' end. The devices are still each frontend's. +- **The soak runs both** (`test/replicas.zig`): each client is + `client.Loop`, the session `session.Loop` over a frontend whose host is + the soak's delayed network (`Peers.threads` off: the soak does the + reader's and the writer's work in memory). It judges every stop against + `may_wait`, runs a frame corpus through a client (22 scenes, its frame + and `Facts` against a session's own), and ends each run with the + session's allocators' leak check. `replica.Authority` remains the + session's stand-in in the core's unit tests and the soak's side cases. +- **What a far client does at once.** A Host entry that returns nothing no + longer stops a speculation, but for those on `keeps_stopping` + (`core/tape.zig`); closing a pane learns from its open whether Recent + keeps the file (`File.State.on_disk`), with no stat; `n`/`N` in a kind's + pane step the rows' own places, asking the disk nothing; a pane switch + beside a shell that asked for focus events tells the program a round + trip later. What may wait is one list, `may_wait` (`core/replica.zig`), + each row with why, pinned by a test that walks every word, key and + gesture on four kinds of pane. +- **The session's facts** (its home, default shell and directory) are the + core's state, read once through the tape; `DumpDir`'s check and + `Font`/`Fonts` read the session's machine through it too. A count of + what `core/` asks of the machine is a test (`core/root.zig`, + `machine_lines`). +- **Nothing of a core is a process global**: `config.tab_now`, + `Addon.distrusted` and `Kind.draw_tokens` went (the tab is the core's + `settings.tab`, handed down; the distrusted list is the client's, + `Options.distrusted`; a draw's token is its slot's); a test walks + `core/` for container-level `var`s (`allowed_vars`). With it, two + faults a rollback met: a terminal's image cache on the epoch's allocator, + a non-plain kind's slot freed by a speculation. +- **Nothing a frame writes is read by a step.** A step read a pane's + notice bands and a big markdown text's tables as the last frame left + them; both are made from the step's state now (the tables read whole at + once, the budgeted reading deleted). `kept_out` (`core/root.zig`) names + every field out of the digest with who writes it, and `core/draw.zig`'s + test steps a core that draws and one that never does, digests equal. +- **An entry written once.** Each of the core's taped entries is a private + body with its public name beside it, + `pub const update = pardes.tape.taped(updateInner);`; the tape's `Input` + variant and the replay come from the body's parameters. Six stay by + hand, each with why. +- **The tape as a handle.** A core holds its tape as it holds its + allocator (`p.tape`, never null; `tape: *Tape` where no core is handed), + and the kinds, the addons, a directory's listing, the file system, the + core's own files and the smaller ones ask it so. The effects, the + budgets, the terminals and the process's `tape.on` are not moved yet. +- **A slot is a type** where it crosses the core's edge: `Pane.Id` and + `View.Id`, each an `enum(u8)`, in the entries, events, effects, the Host + table, the wire's welcome and the device messages. +- **Found by the real loops**: an idle client's quiet check woke its + session every 0.3 s for ever (now a check answered covers the units that + came while it was asked); an addon load under way in another live process + was taken for a crash (the mark is the loader's, `addon-loading.<pid>`); + a kind's draw landing after its pane closed was kept; the command line's + serve thread freed its core under a request; mvzr read past a pattern cut + short (`a{`), patched as it is fetched (`build/patches.zig`, + `docs/mvzr-bounds.md`). + ## Architecture step 6 notes: the rollback and the digest through the journal The clean-room plan's step 6 (`.scratch/clean-room/architecture.md` 9.4) |
