diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 15:26:56 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 17:21:46 -0300 |
| commit | 3ad8138b483031aeb9a406f1928891631e7e7833 (patch) | |
| tree | 5d9fe94f7af8c1f41f24b50e1f03f8a7b41917bf /core/mouse.zig | |
| parent | 553a62bac675bfc0a64254718488d3c8012f533e (diff) | |
| download | pardes-3ad8138b483031aeb9a406f1928891631e7e7833.tar.gz pardes-3ad8138b483031aeb9a406f1928891631e7e7833.zip | |
replicas: a step reads a notice band's rows as its state stands, never as the last frame left them, and the soak's session draws after every pump as a terminal's does (the user's rule: replica bugs caught by a soak that does what real use does): drawn so, `replicas --seeds 2 --rtt 30 --clients 5` diverged client 5 on seed 1 (`the tape's answer to addon is short (tape byte 145, in mouse)`, then every key of it stopped at `a key into a kind's pane`): another client's wheel_up over the PDF's pane in view 3 was `inside` on client 5 (top 23, no band) and not on the session (top 24, one message band), so the session called no addon (kindLeave and the rest) where the client called mouse; the read is `kindMouse`'s `pane.notices.span()` (core/mouse.zig, the same read as `edit.pointerTextSelection`'s chip test), and `notices` is derived (core/panes.zig's replica `.derived`, views.zig's PaneView: in no digest and no dump, which says "recomputed from the rest whenever it is wanted") yet was written outside every step, by a frame (`draw.place` -> `Messages.collectNotices`, at the frame's time and in the drawn view), and inside a step only for the live view at its end (`sync`), so what a step found there was the last frame this process drew, the band of a view as it stood when that view was last live, or nothing in a client joined from a dump since (client 5's case: the session's view-3 band was made by view 3's last step, client 5 joined after it); now `updateInner` (and `presentedInner`, whose look-hover reads the same chip test) makes every pane's bands again from the step's state before it reads them (core/Core.zig, a line each), so a step's calls no longer depend on whether a frame was drawn, and the soak's `watchedHost` is true (the `at_frame` field gone); a test, `a press on a notice's chip is the same state whichever frame this process drew last` (core/mouse.zig: a session that drew its frame once Del's question was due, a replica joined from its dump that drew none, a B1 press on the chip): before the fix the session swallowed it (drag .none) and the replica began a sweep (.select), after it both alike; the soak drawing after every pump: diverged 0/0/0, unequal 0/0/0, deltas checked/wrong 2078/0, 1773/0, 1775/0, quiet checks 932/0, 794/0, 893/0, stops not on may_wait 0/0/0 (rtt 30/80/207), corpus through a client 22/22; tui core-test 839/982 (143 skipped), shell-test 1018/1021, term 15/15, pane 183/184, kitty 45/45, behaviour-test 275/275 and --replay 275/275, process-test the base's two (lspcomplete, lspcompletemoved), gui unit-test 1616/1620 + BaselineHarnessMismatch (the base's); daemon.py plain, --far, --window-clients pass, --games fails as on the base (item 2, load 6-7), cross_replay 27 digests agree each; the frame and perf gate against tree1 (dd-i1b): PASS, frames 77/77 byte-identical, corpus2x +0.264% (bar 0.4%, noise 0.094%), the 97 per-operation counts within 0.1% (largest +0.038%)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/mouse.zig')
| -rw-r--r-- | core/mouse.zig | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/core/mouse.zig b/core/mouse.zig index 8e761453..150ea81c 100644 --- a/core/mouse.zig +++ b/core/mouse.zig @@ -1769,6 +1769,50 @@ test "a tag press is the same state whichever frame this process drew last" { try expectSame(two.a, two.b, "after the press"); } +// A notice band over a body's top rows is derived (Pane.notices): a frame +// writes it at its own time, so a step makes it again as its state stands +// before it reads it. Here the session draws a frame once Del's question is +// due (its band shown) and the replica none: a press on the band's chip is +// the same in both (the soak's divergence, through `kindMouse`, was this read). +test "a press on a notice's chip is the same state whichever frame this process drew last" { + const gpa = std.testing.allocator; + const a = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 40 }); + defer a.deinit(); + a.update(.{ .resize = .{ .cols = 80, .rows = 40, .row_metrics = test_metrics } }); + // Del asks which neighbour takes the rows of a pane with two. + a.newScratchBelow(a.view().active); + const mid = a.view().active; + a.newScratchBelow(mid); + a.view().active = mid; + a.sync(); + const bytes = try pardes.dump.dumpBytes(a); + defer gpa.free(bytes); + const b = try pardes.dump.load(gpa, a.opts, bytes, null); + defer b.deinit(); + for ([_]*Pardes{ a, b }) |p| { + p.clock.now_ns = 5 * std.time.ns_per_s; + p.clock.stepped_ns = p.clock.now_ns; + p.update(.{ .key = .{ .cp = ' ' } }); + p.update(.{ .key = .{ .cp = 'd' } }); + p.clock.now_ns = p.panes[mid].?.question_due_ns; + } + var frame: std.heap.ArenaAllocator = .init(gpa); + defer frame.deinit(); + _ = try a.render(frame.allocator()); + const pane = a.panes[mid].?; + try std.testing.expect(pane.notices.len > 0); + const last = pane.notices.len - 1; + try std.testing.expectEqual(Pane.Notices.Kind.prompt, pane.notices.kinds[last]); + const row = a.bodyTop(pane, a.view().rects[mid]) + pane.notices.row[last]; + const press: pardes.Event = .{ .mouse = .{ .button = .left, .kind = .press, .col = pane.notices.left[last] + 1, .row = row } }; + a.update(press); + b.update(press); + // What the press did (a pane's cwd and a message's wall-clock stamp + // differ between two cores in one test process: not compared). + try std.testing.expectEqual(a.view().drag, b.view().drag); + try std.testing.expectEqual(a.panes[mid].?.sel[0], b.panes[mid].?.sel[0]); +} + // The same through a body hit (edit.pointerTextSelection, a sweep's drag), // on a compact body layer (TreeContext), which a pixel shell inverts. test "a body press, drag and release are the same state whichever frame this process drew last" { |
