diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-24 05:28:45 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-24 05:49:28 -0300 |
| commit | 4e28df7f8e02ceec66a9d62ca75f8ec006e26d7c (patch) | |
| tree | eeee707f41a480fdcf038179ff1a527105b620c1 /core/replica.zig | |
| parent | da985ae98180c2394ccdf48cf8bdf5bd85873c2f (diff) | |
| download | pardes-4e28df7f8e02ceec66a9d62ca75f8ec006e26d7c.tar.gz pardes-4e28df7f8e02ceec66a9d62ca75f8ec006e26d7c.zip | |
layout: a view's geometry is read back as its session holds it, never laid out again at a load, and held to its screen (walk.zig `.within`): a dump whose rect or column is off its screen is REFUSED, the field named: RUN FIRST (the soak, `replicas -- --clients 5`, Debug): `rpplxwst` ALONE diverged 124 at rtt 30 (225 clients parted at their first unit after a join, `addon pdf: its state after view is not the session's (it breaks PA_PLAIN)` and `the tape's answer to addon is short`; then 532 keys into the pdf's pane stopped at `a key into a kind's pane`, the kind distrusted; the witness's replay past a divergence panicked, `integer overflow` in Core.advanceInner), `pardes-merge67` 0 at 30, 80 and 207 ms; THE CAUSE: a join opens its client a view (views.zig `open`: the live one's screen and columns, NO rects: laid out at that view's first input), and rpplxwst's load (dump.zig `afterLoad`) laid every view out again, so the client had rects for its own view the session had not, told its plain kinds a view the session never told them (Kind.zig `step`, `viewOf`), and parted at the session's next step; a join's dump is the session: THE FIX: `rects`, `col_x`, `col_w` back in the digest, the dump and the copy as merge67 had them, `afterLoad`'s relayout gone (and walk.zig `pastHeld`'s pass over a derived buffer with it), and where a value read back may be is declared beside the field: `replica.within` (a predicate of the struct by the entry's place in the field, as far as its length says), checked with the indexes (`heldIndexes`) in all three decoders (a tape's `decode`, a byte dump's and an image's `holdTo`): `View.rects` on its screen (`onScreen`: x + w <= screen_w, y + h <= screen_h, as the layout pass puts every one, and a view not laid out yet has empty ones), a column's edge with its width (`columnOnScreen`, declared on `col_w`), refused in words (`Core.View.rects[0] is not within Core.View.onScreen: refused`), never clamped (a clamped rect is a state no session had); `cols` stays held to `ncol` (a column past `ncol` is a dropped one's, which the index rule would read); TESTS FIRST: replica.zig "a client joins with its session's geometry as the session holds it ..." (a plain kind keeping the rows its view was told; on pardes-load-index: `expected 0, found 5`, the joined view's rect, and without that line `the tape's answer to addon is short (tape byte 241, in tick)`), dump.zig "a view's geometry is read back as the session holds it, never laid out again; a rect or a column off its screen is refused, the field named" (the fuzz's restore seed 589: a pane 534 rows tall on a 24-row screen; a column 900 wide; a column's edge at 900), walk.zig's index test gains an entry not where it may be (`S.edges[1] is not within`, a tape, a dump and an image)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/replica.zig')
| -rw-r--r-- | core/replica.zig | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/core/replica.zig b/core/replica.zig index 46320fea..4126972a 100644 --- a/core/replica.zig +++ b/core/replica.zig @@ -6615,6 +6615,45 @@ test "a kind's place moved in a step of another view's: a replica's key that rea try agrees(a, r); } +/// Placed, plain (PA_PLAIN): a client runs it, and its state is the rows +/// its last view was told. +const Viewed = struct { + const pa = pardes.Kind.c; + const words = [_]pa.pa_word{std.mem.zeroInit(pa.pa_word, .{ .name = "Viewed", .opens = 1, .doc = "the rows its view was told" })}; + const ops = std.mem.zeroInit(pardes.Kind.Ops, .{ + .head = std.mem.zeroInit(pa.pa_head, .{ .size = @sizeOf(pa.pa_head), .abi = pardes.Kind.abi, .name = "viewed".* ++ @as([10]u8, @splat(0)), .version = 1, .exts = "", .flags = pa.PA_PLAIN, .words = &words, .nwords = 1 }), + .open = Placed.open, + .paint = Placed.paint, + .view = Placed.view, + }); +}; + +test "a client joins with its session's geometry as the session holds it: the view opened for it, not laid out yet, is not laid out in the client either, and a plain kind is told the same views on both" { + // The soak's (test/replicas.zig): a client parted at its first unit + // after its join, `addon pdf: its state after view is not the + // session's`: it had laid every view out at its load, its own new one + // too, which the session lays out at that view's first input. + const gpa = std.testing.allocator; + const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .file = "mise.toml" }, TestHost.host()); + defer a.deinit(); + var words: [64]pardes.Kind.LoadedWord = undefined; + const viewed = pardes.Kind.loadedOf(&Viewed.ops, "/x/viewed.so", @splat(7), &words); + _ = try a.local(.{ .addon = .{ .op = .load, .pane = .at(0), .kind = &viewed } }); + _ = try a.local(.{ .command = "Viewed" }); + const kid = a.core.view().active; + const joined = (try a.join(1, null)).?; + defer gpa.free(joined.dump); + const r = try Replica.initDump(gpa, 1, joined.view, joined.dump, .{ .cols = 80, .rows = 24 }); + defer r.deinit(); + try std.testing.expect(r.loaded(joined.digest)); + try runsHere(r, kid, &Viewed.ops); + try std.testing.expectEqual(a.core.views[joined.view].?.rects[kid], r.core().views[joined.view].?.rects[kid]); + // The session's own step tells the kind each view whose facts changed. + r.confirm(try a.local(.tick)); + r.settle(); + try agrees(a, r); +} + /// A kind whose every key asks a job, for the job tokens' test. const Jobber = struct { const pa = pardes.Kind.c; |
