summaryrefslogtreecommitdiff
path: root/core/rollback.zig
Commit message (Collapse)AuthorAge
* config, look, Trail, tests: jumps walk by default, `Jumps new-pane` the ↵Gabriel Schneider3 days
| | | | | | opt-out (walk UI G item 3, the coordinator's ruling: SPEC §6.6), every test about a jump opening a pane set to new-pane, a reader placed with its walk in its tag and a stepped pane lifted to its tag's rows: config.zig Settings.jumps is `.walk`; FOUND BY THE FLIP (core/ninep/tree.zig 'random placements, refused or not, leave no pane under its tag and two rows', seed 69 rows 21: a Look's reader 5 rows high where its tag takes 2): look.zig walk set a new reader's walk (‹@pN and its place) after openNew had placed it, so its rows were given for a tag a row shorter; openNew sets it before layout.placeNew now; Trail.show (a step to another file in place, Back, Forward, a list's n) replaced the pane with its trail and a longer name and gave it the old pane's rows, and a step in the same file pushed a word the tag may wrap on: Trail.lift gives the stepped pane its minimum from its column (layout.restoreMinimaFrom, the others keeping theirs); NOT FIXED (seed 109): a step in place in a column with no rows to give still wraps its tag under its minimum (the spec's give-way, folding the trail further, is the fix): that test runs with new-pane now (it is about placements as a Look made them), its comment says so; core/replica.zig's may_wait gets `Look *` stopping at read_file: a jump from a held pane (a kind's, a listing's) opens its reader from the disk where new-pane focused the reading pane already showing the file (SPEC §6.1 focuses a held one only); TESTS SET TO `Jumps new-pane` (each ABOUT a Look opening a pane, a query pane, a twin, Back/Forward over panes, a placement): 39 core and pane tests (look.zig 10, Query.zig 7, jj.zig 7, edit_cmd.zig 3, ninep/ctl.zig 2, test/panes.zig 3, lsp/Ask, Messages (C's SPC e +Search way), Store, layout, rollback, replica, ninep/tree), 25 behaviour tests (look-and-exec 5, placement 4, other-files 5, modes 3, language-servers 3, settings, follow, addons, columns-and-tags, panes), 18 process cases (`.init` or Tty.config: edit, flags 2, the canary, mounts, other-files 2, root-ctl, tree 2, filewatch, topbarexec, chordcut, cmdword, grep, lsprelpath, lsp-rename-files, layout-open); TESTS OF A FILE PANE'S TAG made to hold their pane first (`Keep`, SPEC §6.5: the `Keep` word moves every offset after the path): 16 behaviour tests (tags 11, keys 2, panes, columns-and-tags); GOLDENS regenerated and read, each changed row only ` Keep` after a reading pane's path (.scratch/walkui/G/gkeep.py): argv builtins cmdexit collapse delask lsp-rename lspcomplete markup mini msg nested-optout pipe savepane selregex themesel tutor (16); the other 41 changed goldens are NOT in this change (their rows move with more than the word: see the next change); tui core-test 1037/1206 (169 skipped), shell-test 1253/1256, pane-test 183/184 (1 skipped), behaviour-test 277/277, process-test 41 of 146 failed (those 41 goldens, every one a GoldenMismatch) Co-Authored-By: Claude Opus 5.5 <[email protected]>
* scroll: a view's top is a line and a row within that line's own wrapped ↵Gabriel Schneider4 days
| | | | | | | rows, and a scroll moves it by rows (P62, round 3, on the layer's new model where the `Changes` layer's lines are lines of the buffer): a wheel's notch, the glide, PageDown/PageUp, zj/zk, Ctrl-d/u, zt/zz/zb and the margin (`scroll_off` now ROWS) go a row at a time through a line wrapped over many rows and through a long description line of the layer, where the base jumped all of a wrapped line's rows at once (the user, 2026-11-23: "the scroll view jumps around near deleted lines on the diff view"; one-row deleted lines were cured by the layer's second step, a wrapped one was not): TESTS FIRST: core/jj.zig "a view scrolls by rows through a line wrapped over 12 rows and a change's description wrapped over several (a line of the layer): ..." (a notch is one row down the whole text and back, the notches the text's rows exactly; PageDown/PageUp a page of rows; zj/zk one; a held j and k keep the cursor's row `scroll_off` rows inside the body) failing on the base at notch 21 (line 20's 12 rows crossed at once), and "a client wheels its session's view a row a notch into a change's description wrapped over several rows ..., agreeing at every notch; a client joined over that view loads its row"; kept from round 1: core/replica.zig's join over a view scrolled into a wrapped line (with a rollback and a dump) and the explorer of a view's rows (30 seeds), dev/gui's glide a row a notch; THE CHANGE, taken from pardes-row-scroll (`xrxmqlnw`) and -2 (`xxzmwnvq`) without their ghost-row "blocks" (a block is now just a line's own rows): `File.State.scroll_row` and `views.PaneView.scroll_row` in the generic walk (digested, dumped, copied; a dump of 34 loads at its lines' first rows), the wire 35; core/File.zig `Top`, `rowIn`/`rowWalked` (a line's rows as fillBody wraps them, `guideOf` shared), `rowOf`, `lineRows`, `top`/`setTop`, `walkRows`/`walkKnown`, `rowsTo`, `rowsOf` (off the map where it holds the line), `mapFresh`, `scrollRows`, `shownRows` (the geometry laid out first), `show` (a cursor's or a result's row inside the band, the line's rows whole when they fit), `textRowLine`, fillBody's skip to the top's row walked once a geometry (`Pane.top_skip`, derived), the geometry's key with `scroll_row` and stored as what the map was made from; the one-row fact `State.widest` (`Widest`, an upper bound kept by the index's own vector passes `countLines`/`fillLines`) so a view whose lines are each one row walks nothing (`oneRow`: line arithmetic, checked against the walk in Debug); `fitEnd` a vector of printable ASCII at a time; the callers in rows: panes.zig `scrollBy(tab, delta)` and `ensureCursorVisible` (a file's through `File.show`), the wheel and the rail and the edge scroll (mouse.zig), Ctrl-d/u (normal.zig `halfPageMove`), zt/zz/zb, Ctrl-f/b and PgUp/PgDn (Text.zig `scrollViewMove`), Look's reveal and centring, Places' `goTo`/`restore`, Query's `showCurrent`/`caretTo`, the frames' `Region.row` and the glide (dev/glide.zig, the window's `topOf`); test/perf.zig's checks by (line, row) and its seek at a line's first row; Debug in the workspace: core-test 963/1129 (166 skipped), shell-test 1172/1175 (3 skipped) Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* replicas: what a core field points to is the rollback copy's, or lives ↵Gabriel Schneider5 days
| | | | | | | outside the core by its own declaration (pardes-term-join-12, item 1: the double free of round 11's gate): the copy skipped memory two ways, by inference and by a list, and each let a write survive a put-back: (1) `unwalked` took any type with a digest of its own and no `replica` annotation as outside the copy, so `jj.Session` (`Pardes.changes`, added with the layers) was saved as bytes and its heap never: a splice of the pinned lines at a client's edit (jj.edited) wrote a new `lines` into the answers buffer in place, the put-back freed it and left the pointer, and the next splice or the core's end freed it again (the test before this: allocated at jj.spliceValues under the speculation, freed at Epoch.discard, freed again at jj.spliceValues; the soak's abort at jj.Session.deinit); now a type is outside the copy only by declaring it (`outside_copy`: Term.State, the emulator written by confirmed units alone and counted; locations.Row, made again and never written, in a pinned blob), and every other type is walked, whatever digest it has; (2) `unsaved` skipped the rows cache (`Pardes.shell_rows`, `.derived`) and the replica kept it apart by hand (`speculate` emptied it before its take, `toConfirmed` set it `.{}` after a put-back), which an idle client's copy (`ready`) never emptied: the rows read before it were orphaned in the epoch at every rollback; now the cache is the copy's like any state: its text and rows are made whole and freed whole, so they are blobs the copy pins (no copy of a grid's text; freed raw), the put-back restores the cache with the core (valid: no emulator is written while a copy is held: a unit that writes one lets the copy go, or is applied after it is put back), and both hand resets are deleted; THE RULE the compiler holds: a type is skipped by the copy only by its own `outside_copy`, and a cache (`.derived`) on the copy's skip list (`unsaved`) is a compile error ("a cache the core holds is the copy's, or lives beside what it caches, outside the core"); the copy pins a blob once whoever reaches it (a text and the allocation it starts: never pinned twice nor also saved); not changed: the arenas (the copy saves their bytes, not their nodes: scratch content), the queues (asserted empty at a take), the host's and the process's own (store, Recent, the echo, the tape), a picture's pixels under a speculation (replica.zig's ponytail at `initDump`); the three tests of the change before: pass (the jj test and the rows test under a DebugAllocator as the epoch's child too, no double free reported); the gate (g12, a frozen copy; loads 1.5-12): core-test 918/1082 (164 skipped), shell-test 1124/1127 (3 skipped), term-test 17/17, kitty-test 45/45, pane-test 182/183 (1 skipped), behaviour-test and --replay 275/275, process-test 0 of 146 own and as pairs, the soak 3 of 3 whole and 10 of 10 at seed 0 and 80 ms (diverged 0, unequal 0, unlisted 0, quiet checks all agreed, the corpus 22 of 22, no leak, no abort), daemon.py every mode on Debug and ReleaseSafe (plain 3 of 3 each, --far 7 of 7 on ReleaseSafe, --games on ReleaseSafe with the Debug prefix's game libraries), --upgrade from the installed build 3 of 3, R2D 1 of 1, D2R 4 of 7 (two known test races: Exit's clunk answered after the window ended, far_exec's environment read at the exec; one quiet check of a Debug window client's key not in 30 s, load 6.1), --upgrade --gui 3 of 3, the cross-builds, the frame and perf gate against tree4: 77/77 frames, perfab corpus2x +0.014% (noise 0.049%), 121 counts within 0.1% (largest terminal on all +0.0794%), the gui unit-test 1719/1723 in the workspace (4 skipped, none failing; the copy's longer build root fails six tests whose messages name a temporary path: a 9P error's room is Plan 9's 128 bytes, ninep/tree.zig:549-556) Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* rollback: the copy walks a type by its fields when it says what they are ↵Gabriel Schneider7 days
| | | | | | | (`replica`), whatever digest of its own it has: it skipped every type with one as if it were a terminal, so since faults-4 the 9P state (fs.Namespace, a pane's ninep State) was saved only as the bytes of its records, never the buffers they own, and a unit kept over a copy that wrote one in place came back other than it was (a script's exec held "Ta", the next write ran `Tab 8` and moved "Un" to the front of the same buffer, and the rollback's replay ran `Unb 8`: the client's digest other than the session's); now only a type with a digest and no `replica` (Term.State, the authority's emulator; locations.Row, made again and never written) is left out (`unwalked`); the test, that exec write over a copy taken ahead and a rollback by another's key, differed on the base (digest 12509739004356058903 against 4039275215734315918) and passes; the tree gated whole (load 1-8): tui core-test 875/1033 (158 skipped), shell-test 1075/1078, term-test 17/17, pane-test 183/184, kitty-test 45/45, behaviour-test 275/275 and --replay 275/275, process-test 0 of 145 failed; both soaks diverged 0, unequal 0, unlisted 0, quiet checks 597/0 673/0 779/0 and 693/0 586/0 829/0, the corpus 22 of 22, no leak; daemon.py --clients 39 of 40 alone and 20 of 20 pinned, plain 5 of 5, --far, --far-find, --relink, --launch, --pair, --restore, --games (addon-test 5/5), --window-clients (its PDF case skipped: no pdf.so in a tui prefix), --gui pass; the cross-builds (macos, macos arm, freebsd) build; the frame and perf gate against tree2: 77/77 frames, perfab +0.043%, 121 per-operation counts within 0.1% (largest client-key-down on medium +0.0749%), gui unit-test 1671/1675 with no failure the base has not Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* core: the two tests that failed when their edits straddle a wall-clock ↵Gabriel Schneider8 days
| | | | | | | second compare what was done, not when, and a failed rollback test no longer poisons the next: an edit stamps its text's mtime with the second (core/File.zig:782, CLOCK_REALTIME through tape.value(.mtime)), so rollback's "a copy put back..." (rollback.zig:599) and Places' "...loaded from its dump..." (Places.zig:893), each comparing whole-core digests of one edit made twice a moment apart, failed whenever a second turned between them (reproduced at will with an LD_PRELOAD that makes each CLOCK_REALTIME read a second later: 1 of 1 each; plainly 0 of 50 and 0 of 104 started 5-60 ms before a second turned); no clock can be handed in there (a tape's stamp answers only inside a step of a stepping tape, tape.zig:814, and Places' edit is no step), so each test sets the second edit's mtime to the first's before comparing, as draw.zig's twin test leaves mtime out by name; and the failed rollback test left syntax.held_trees pointing into its dead Epoch (Epoch.begin sets it, only end puts it back), so the next test ("a text written in place...") panicked in syntax.parseTree: Epoch.deinit now lets go of a hold that is its own (+3, product code no user could reach: an epoch dies held only in a failed test); with the shim the rollback file passes 14/14 and Places' 8/8, 50 runs each plain and shimmed 0 failures (load 17-18); tui core-test 848/991 (143 skipped), the base's Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* core: the entries that take or answer a slot take and answer its type (P21, ↵Gabriel Schneider8 days
| | | | | | | pardes-ids change 2): a pane's slot is `Pane.Id` in the twelve entries that took it, six as `usize` (setCwd, acknowledgeShell, setMessage, setStatus, reportError, noteLateFailure) and six as `u8` (readerFailed, shellFailed, restartFailed, saveFailed, reloadWatchedFile, File.deleted), and in what adoptShell answers (`?Pane.Id`); a view's slot is `View.Id` in closeView, leaveView, awayView, rejoinView and the hand-written toView (its `to_view` variant is `Pardes.View.Id` now, and its replay arm unchanged) and in what openView answers (`?View.Id`); the tape's other variants follow their inners' types with no edit (`Args`); each inner converts where its body indexes (`id.index()`), passes the id itself to another entry, and the core's own code stays integers; every caller converts at its own line, `p.reportError(.at(id), ..)` (the decl literal of the parameter's type), 514 calls in 56 files written by a script that refuses any path outside the workspace (`.scratch/sketch/reorg/pardes-ids/wrap.py`), 46 `.index()`; nothing the compiler caught was a pane's slot passed as a view's or the reverse: what it caught were a script's wrong guesses (Editor.reportError(err) and macos.zig's own reloadWatchedFile, same names, undone) and the integers a view's id met (views.zig's tests, replica.zig's Authority and Peers.join, host_io's Adoption); in files another agent is in, each conversion on the line that was there: core/Kind.zig 5 lines, core/Addon.zig 4, core/replica.zig 23 (Authority.openView and join, closeView/toView/awayView/rejoinView/leaveView calls, Peers.join's `openView`, tests), test/replicas.zig 1; the tape's records are smaller (a `usize` is a byte in six inputs) and its shape moves, so the semantics word moves, 313a99190b93a8c5 -> c47ecf638b3f4b9f; test/perf.zig untouched (its harness id does not move); the Mac: runtime/macos.zig 16 call lines, abi/pardes.h unchanged; 581 lines changed in 56 files, no line added. Gate (load 4 to 28: a drat build and other agents' gates beside): tui core-test 841/984 (143 skipped), shell-test 1020/1023, term-test 15/15, pane-test 183/184, kitty-test 45/45, behaviour-test 275/275 and --replay 20 seeds of 70 steps, 0 failures, process-test lspcomplete and lspcompletemoved (the base's), gui unit-test 1618/1622 (BaselineHarnessMismatch, the base's); replicas --clients 5 (TMPDIR /tmp/claude-1000/ids, alternated with the base twice, both pass both times): diverged 0, unequal 0 at rtt 30, 80, 207, deltas checked/wrong 1811/0, 1838/0, 1715/0, quiet checks 567/0, 650/0, 544/0, stops not on may_wait 0 (its corpus-through-a-client scene fails at step 21 as on the base with that TMPDIR); two earlier runs of this tree under a load of 10 to 28 ended in a leak of Places' compiled regex (Places.derive from Query.produce) and one rtt-207 run in an assertion in mouse.kindMouse's clamp during a client's speculation, the leak not seen in the eight runs of this tree after them (the full soak, each rtt alone, single seeds), the assertion not in the two full runs after it, and neither in three full runs of the base (by reading neither touches a slot: in the report); daemon.py plain, --far, --games, --window-clients, --upgrade both ways against pardes-tree's base prefix pass; test/cross_replay.py (tui records, gui replays): 27 digests agree in each of three replicas; rollback-bench runs; the macOS library for Linux and aarch64-macos and the FreeBSD cross-build build; frames (gpu/ids-2 against tree1) 77/77 byte-identical in Debug, unit-test 1618/1622 there too, perfab corpus2x -0.059% (session noise 0.134%, threshold 0.4%), pictures identical in all 10 runs, perfops 97 counts within 0.1% (largest image-frame on longline +0.0274%), key-down on medium 10,040,104 -> 10,039,959 an operation (-0.0014%), render on medium 11,455,764 -> 11,455,707 (-0.0005%) Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* tape: a core holds its tape as it holds its allocator, `p.tape` (the ↵Gabriel Schneider8 days
| | | | | | | handle's step 0, P19/P20, pardes-handle-sizing section 1): Pardes.tape: *Tape, never null, set when a core is made (Options.tape for init, else tape.on's, else tape.none; tape.adoptCore for a client's join, tape.adopt for a Restore, the tape's own apply for a replay's init and restore, replica.zig's Peers when a session's first client joins and when its last leaves), tape.none the tape of a session nobody records (Tape.through: every call goes through, nothing is taped, nothing writes it), Tape.io Zig's io for a site's body (the process's, as every global read of it was), the entry points as methods on the tape (site, value, authority, over, replaying, stray, stepping, screenReplica, screenAuthority, poison, authorityOnly, viewOnly, touchTerminal, adopt, current, forget; `speculating` and `screen_state` are its fields; `diverged` stays free, its name being the field it writes) and the free functions kept beside them, each now the method on `on orelse &none`, so every caller exercises the methods; the field is this process's own, in no digest, dump or tape (Pardes.replica.local, Options.replica.local) and no rollback copy (rollback.zig's `unsaved`), with a test that neither the digest nor the dump moves with it and that a copy put back leaves it as set; a safe build checks at every entry that a core's field is the tape `on` steps it on (or, with none on, an idle one): it found that a client's own frame drawn between its steps (Replica.draw, an entry with `on` null) is entered on its idle tape, which `enter` must not record into once it reads the field (step 9), and that a replay's dump check loaded its core on the session's tape through its options (now on none); Core.zig names the module `pardes.tape` (82 lines), its import `tape` colliding with the field; `init` and dump's `initFromDump` leave the tape once, deferred, with the core made or none (they left it twice, one per way out: the owner's reading); Stepping's swap and the three tests' save-and-restore stay: the free functions still read `on`, so a replica's step needs it pointed at its tape until the last of them goes. The five numbers: (1) functions that gained the parameter 0 (row: 0); (2) perfops 97 counts within 0.1%, largest image-frame on large +0.0215% (the base's own spread), none on a per-row path gained anything; (3) nothing stopped compiling for want of an io (none was removed); (4) global io uses 11 plus the tape's field default, calls into the free functions 93 (each now a method's), machine_lines tape.zig 10 -> 11 (the io field); (5) lines changed: tests 32, code about 580 (164 of them Core.zig's module name, about 250 bodies moved into methods; tape.zig 1533 -> 1623 lines). Gate: tui core-test 837/980 (143 skipped), shell-test 1015/1018, pane-test 183/184, behaviour-test 275/275 and --replay 20 seeds 0 failures, process-test lspcomplete and lspcompletemoved (the base's), replicas --clients 5 diverged 0, unequal 0, deltas wrong 0 (1646/0, 1620/0, 1737/0), quiet 484/0, 554/0, 651/0; daemon.py plain, --far, --games, --window-clients pass; semantics 2f615168fe07b35f (unmoved); frames 77/77 byte-identical in Debug, gui unit-test 1613/1617, perfab corpus2x +0.028% pictures identical in all 10 runs, perfops PASS Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* frontends: the terminal and the window draw and turn input into events from ↵Gabriel Schneider8 days
| | | | | | | the frame and one record beside it (the reorganisation's runners, step 10a, on the line as it is now): surface.Facts, the core's (Pardes.facts) and pointed at by the frame it is filled for (Surface.facts), filled by draw.place in the walk over the panes it makes anyway and by a runner after an input it applied (draw.facts), carries what a frontend took from the core (the view's size, cell pixels and row metrics, each open pane's rectangle, tag rows, context rows, serial, whether a terminal whose program takes the wheel or a kind's, its mode, the jumps' back and forward, the settings it draws by); the window keeps a copy (Gui.facts) with the frame it shows (Gui.frame) and its hit tests, wheel, touchpad rows, timedemo, blink, overlays and dim read only those; Host.present returns whether the frame was shown, so present_skipped leaves the core and nothing writes it; the frame statistics are the runner's (Options.frames, Pardes.frames a pointer to them), which the frontends write and the core's draw reads; Replica.draw returns the shown and keeps needs_frame itself, so the two client loops put nothing back; OwnView and Replica.within are deleted (the window client's own pass reads its facts, its inputs fed after each event as before); rollback-bench compiles again; the tape's watched fields lose present_skipped and present answers a bool, so the semantics word moves (0900e560fd6395ef, pardes-seam-b's, -> 2f615168fe07b35f). The first version (psvoxrup, on pardes-tree) kept the record by value in every Surface, and every Surface a tag line builds for a moment copied its 1.3 KB more: +1,556 instructions an image-frame, +3,763 a render (perf record: memcpy); now perfops against tree1 97 counts within 0.1%, largest image-frame +0.029%. Brought onto pardes-seam-b: the client set-up keeps the Distrusted list beside the runner's frame statistics, Options' local fields both, and the rollback test's present answers a bool. Gate: frames 77/77 byte-identical in Debug, the alternated windows' pictures identical in all 10 ReleaseFast runs, corpus2x -0.039% (PASS); tui core-test 836/979 (143 skipped), shell-test 1014/1017, term-test 15/15, pane-test 183/184, kitty-test 45/45, behaviour-test 275/275 and --replay 275/275, process-test lspcomplete and lspcompletemoved (the base's) and grep (passed alone three times of three); gui unit-test 1612/1616 with the base's BaselineHarnessMismatch; replicas --clients 5 diverged 0, unequal 0, deltas wrong 0, quiet 470/0, 600/0, 764/0; daemon.py plain, --far, --games, --window-clients, --upgrade both ways (from pardes-tree's pfx-base); the macOS library for Linux and aarch64-macos and the FreeBSD tui configure; rollback-bench runs Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* core: src/ becomes core/, pardes.zig its root.zig (the reorganisation's ↵Gabriel Schneider9 days
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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T