summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-19 12:56:12 -0300
committerGabriel Schneider <[email protected]>2026-11-19 13:57:28 -0300
commit1553f31259f545329dd8032b73888b688520dd38 (patch)
treedebfd95a282d697f1b0aafc1e21e51ff62d5d7a8
parenta355c7fee38bd940da12f330408639fc3875234b (diff)
downloadpardes-1553f31259f545329dd8032b73888b688520dd38.tar.gz
pardes-1553f31259f545329dd8032b73888b688520dd38.zip
kinds and addons: a kind's and an addon's tape calls are the handle's, the step's core's tape or a `tape: *Tape` parameter (the handle's step 3, P20, pardes-handle-sizing section 3's third noun): Kind.zig's fourteen (a kind's open, close, key, search, address, mouse and word refused to a speculation, `p.tape.authorityOnly`; its tag's prefix, `p.tape.value(.addon, ..)`; a tick's `p.tape.speculating` and `poison`; a call's end, `Call.end`, on its core's tape: its outcome taped, its plain block hashed only on a tape that is not `none` (`t.through`, where `tape.on == null` was: the one read of the global outside tape.zig and replica.zig is gone), and a client's plain kind that broke its promise diverging the replay through `Tape.diverge`, made public, under `t.replay` as `tape.diverged` was), and the C callback `api.job` (callconv(.c), no parameter to give) reaching its handle through `Kind.current`, the call under way, whose core it holds at that line (a call that asks a job and is not quiet is a step's: `cl.p.?.tape`), which holds at its one site: the other callbacks ask nothing of the tape; Addon.zig's three, its import gone with Kind.zig's (`const tape = @import("tape.zig")`, 2 lines apart from the count): Addon.need, Addon.take and Kind.Registry.started take `tape` (3 functions, the row said 1 + 20: the graph tied `take` by name to walk.Reader.take and the rest), `swap` reads `p.tape`; Kind.reopen takes the core it was always handed (`*Pardes`, was `?*Pardes`: no caller passed null); Pardes.create names its tape once, for `.kinds = .started(tape, ..)` and `.tape`; the count asked for first: Addon.zig's 48 machine lines are all in functions handed no core (hold 17, scan 11, mark 4, scanDir 3, readSmall 3, closeIdle 2, read 2, listed 2, fileOf, loadListed, unmark, crashedPath), 0 in one that holds it; a step reaches 29 of them through `need` (a kind's first pane, the session's: loadListed, mark, hold, closeIdle) and all 48 on a client's first plain kind (need -> plainOps -> scan), and the addon effect (Effect.perform's arm, not replaying) reaches the same 29 through readLoaded; none of these host halves asks the tape anything, the one question (`replaying`) sits above them in `need` and in perform's arm, so none took the tape, none is handed `&tape.none`, and none needed splitting: `need` is already the split (the step's question, then the host's body); the five numbers: (1) functions that gained the parameter 3 (row: 1 + 20); (2) the 97 per-operation counts within 0.1%, the largest image-frame on longline +0.0308% (the base's own spread); no function on a per-row or per-grapheme path gained it; (3) nothing stopped compiling for want of an io (no io moved: Addon's reads are libc); (4) global io uses 7 (6 and the tape's default, unchanged), free calls into the tape 80 -> 63 (count.py, a call on a `tape` parameter not counted), machine_lines rows unchanged; (5) lines changed: tests 4 (the take calls of three tests), code +41/-37 (with tape.zig's `pub` of diverge and the two import lines). Lines in files not this work's: none (no line in dev/, runtime/, core/replica.zig or test/). Gate: tui core-test 840/983 (143 skipped; Places' "a session's places loaded from its dump find what an edit makes as the session's do" failed once in the whole run, an edit's second crossing a clock second, and passed alone three times of three), shell-test 1018/1021, pane-test 183/184, term-test 15/15, kitty-test 45/45, behaviour-test 275/275 and --replay 20 seeds 0 failures, process-test lspcomplete and lspcompletemoved (the base's; headersweep and headersweep-restored failed once and passed on the runner's retry), replicas --clients 5 diverged 0, unequal 0, deltas wrong 0 (2033/0, 1978/0, 1682/0), quiet 568/0, 581/0, 748/0, stops not at may_wait 0; its "corpus through a client" fails at steps 18 to 21 (the client's frame 34 or 35 cells otherwise than the own frontend's, row 20) on this change and on the base alike (pardes-entries with the rules' tests, run the same hour), so not this change's; gui unit-test 1616/1620 (the perf check's BaselineHarnessMismatch, the base's); daemon.py plain, --far, --games, --window-clients pass; a session recorded and replayed (test/cross_replay.py, tui to tui, private runtime directory): 28 digests agree in each of the three replicas; semantics 313a99190b93a8c5 (unmoved); frames (gpu/handle2-3 against tree1) 77/77 byte-identical in Debug, gui unit-test 1616/1620 there too, perfab corpus2x +0.083% (session noise 0.071%, threshold 0.4%), pictures identical in all 10 runs, perfops PASS
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
-rw-r--r--core/Addon.zig13
-rw-r--r--core/Core.zig9
-rw-r--r--core/Kind.zig60
-rw-r--r--core/dump.zig2
-rw-r--r--core/tape.zig4
5 files changed, 45 insertions, 43 deletions
diff --git a/core/Addon.zig b/core/Addon.zig
index 5c23ed51..d52462e0 100644
--- a/core/Addon.zig
+++ b/core/Addon.zig
@@ -21,7 +21,6 @@ const std = @import("std");
const Kind = @import("Kind.zig");
const dump = @import("dump.zig");
const pardes = @import("root.zig");
-const tape = @import("tape.zig");
const Pardes = pardes.Pardes;
const Why = Kind.Buf(160);
@@ -342,7 +341,7 @@ fn listed(data: []const u8, path: []const u8, n: usize, why: *Why) Loaded {
/// Kind `k`'s code, a session's (a replica's is `plainOps`'s or none): its
/// library loaded at the first pane of its kind, from the file the start
/// listed it from (`listed`); null, and why, when it will not load.
-pub fn need(r: *Kind.Registry, k: u8, why: *Why, distrusted: ?*const Distrusted) ?*const Kind.Ops {
+pub fn need(r: *Kind.Registry, tape: *pardes.tape.Tape, k: u8, why: *Why, distrusted: ?*const Distrusted) ?*const Kind.Ops {
if (r.ops[k] != null) return r.ops[k];
// A client's: its own code for a plain kind, loaded at its first pane.
if (tape.replaying()) {
@@ -612,7 +611,7 @@ pub fn leader(r: *const Kind.Registry, keys: []const u8) union(enum) { none, pre
/// `l` taken in, its words and extensions with it, or listed refused,
/// and why: collisions with the core's names and the kinds here
/// (`except`'s own looked past, a reload's old one).
-pub fn take(r: *Kind.Registry, l: Loaded, except: []const u8) ?[]const u8 {
+pub fn take(r: *Kind.Registry, tape: *pardes.tape.Tape, l: Loaded, except: []const u8) ?[]const u8 {
if (r.n == Kind.max_kinds) return "refused: no room for another kind";
const e = &r.kinds[r.n];
e.* = .{ .version = l.version, .abi = l.abi, .hash = l.hash, .caps = l.caps };
@@ -775,7 +774,7 @@ pub fn landed(p: *Pardes, op: Op, pane: u8, l: Loaded) void {
while (i < p.kinds.n) {
if (p.kinds.kinds[i].refused and std.mem.eql(u8, p.kinds.kinds[i].path.slice(), l.path)) p.kinds.drop(i) else i += 1;
}
- if (p.kinds.take(l, "")) |why| {
+ if (p.kinds.take(p.tape, l, "")) |why| {
if (l.why.len == 0) release(p, l.hash);
return p.reportFailure(id, std.fmt.bufPrint(&said, "Addon load: {s}: {s}", .{ base, why }) catch "Addon load: refused");
}
@@ -812,7 +811,7 @@ fn swap(p: *Pardes, l: Loaded, why: *Why) bool {
if (p.kinds.collides(l, name, &scratch)) |r| return fail(why, "{s}", .{r});
if (!std.mem.eql(u8, l.name, name)) return fail(why, "refused: its kind is now {s}, not {s}", .{ l.name, name });
const old_ops = p.kinds.ops[k];
- const new_ops: ?*const Kind.Ops = if (tape.replaying()) null else @ptrFromInt(l.ops);
+ const new_ops: ?*const Kind.Ops = if (p.tape.replaying()) null else @ptrFromInt(l.ops);
const gen = p.kinds.kinds[k].gen +% 1;
var fresh: [pardes.MAX_PANES]?*Kind.Slot = @splat(null);
defer for (fresh) |f| if (f) |s| {
@@ -857,7 +856,7 @@ fn swap(p: *Pardes, l: Loaded, why: *Why) bool {
};
const old_hash = p.kinds.kinds[k].hash;
p.kinds.drop(k);
- _ = p.kinds.take(l, "");
+ _ = p.kinds.take(p.tape, l, "");
p.kinds.kinds[p.kinds.n - 1].gen = gen;
release(p, old_hash);
return true;
@@ -899,7 +898,7 @@ test "addon reload gives migration the old record version and saves the new vers
var old = std.mem.zeroInit(Kind.Ops, .{ .head = std.mem.zeroInit(Kind.c.pa_head, .{ .size = @sizeOf(Kind.c.pa_head), .abi = Kind.abi, .version = 1 }), .open = Fake.open, .paint = Fake.paint, .dump = Fake.save, .load = Fake.load });
@memcpy(old.head.name[0..7], "migrate");
var words: [64]LoadedWord = undefined;
- try std.testing.expect(p.kinds.take(loadedOf(&old, "test.so", @splat(0), &words), "") == null);
+ try std.testing.expect(p.kinds.take(p.tape, loadedOf(&old, "test.so", @splat(0), &words), "") == null);
const pane = try Kind.open(p, 1, p.kinds.byName("migrate").?, null, null);
var new = old;
new.head.version = 2;
diff --git a/core/Core.zig b/core/Core.zig
index b4745b24..9684de26 100644
--- a/core/Core.zig
+++ b/core/Core.zig
@@ -514,16 +514,17 @@ pub const perform = @import("Effect.zig").perform;
/// second copy of this drifted once, leaving restored tags without an
/// allocator and every 9P mtime 0.
pub fn create(gpa: std.mem.Allocator, opts: Options) !*Pardes {
+ // The global still set beside the field (P20): a core made while
+ // a tape records (PARDES_RECORD, a replica's step) is its.
+ const tape = opts.tape orelse pardes.tape.on orelse &pardes.tape.none;
const p = try gpa.create(Pardes);
p.* = .{
.gpa = gpa,
.image_gpa = opts.image_allocator orelse gpa,
- .kinds = .started(opts.addons),
+ .kinds = .started(tape, opts.addons),
.tree_sitter_gpa = opts.tree_sitter_allocator orelse gpa,
.opts = opts,
- // The global still set beside the field (P20): a core made while
- // a tape records (PARDES_RECORD, a replica's step) is its.
- .tape = opts.tape orelse pardes.tape.on orelse &pardes.tape.none,
+ .tape = tape,
.tty_toggle = opts.tty_toggle,
.views = .{ View{
.frontend = .{ .windowed = opts.windowed },
diff --git a/core/Kind.zig b/core/Kind.zig
index 9844369d..500319a5 100644
--- a/core/Kind.zig
+++ b/core/Kind.zig
@@ -19,7 +19,6 @@ const builtin = @import("builtin");
pub const c = @import("pardes_addon");
const pardes = @import("root.zig");
const walk = @import("walk.zig");
-const tape = @import("tape.zig");
const surface = @import("surface.zig");
const views = @import("views.zig");
const Addon = @import("Addon.zig");
@@ -104,10 +103,10 @@ pub const Registry = struct {
nexts: u8 = 0,
ops: [max_kinds]?*const Ops = @splat(null),
- /// What the scan at start found.
- pub fn started(found: []const Loaded) Registry {
+ /// What the scan at start found, taken on `tape` (a replica's holds no code).
+ pub fn started(tape: *pardes.tape.Tape, found: []const Loaded) Registry {
var r: Registry = .{};
- for (found) |l| _ = r.take(l, "");
+ for (found) |l| _ = r.take(tape, l, "");
return r;
}
@@ -297,25 +296,25 @@ pub fn openFile(p: *Pardes, id: usize, k: u8, path: []const u8) !*Pane {
/// The slot's kind state made (`open`, then `load` with its record, or
/// `address` with its place and its words' last values): its refusal,
/// if the kind refused, in `slot.refused`. One call for both cores.
-pub fn reopen(p: ?*Pardes, id: usize, s: *Slot, bytes: ?[]const u8) bool {
+pub fn reopen(p: *Pardes, id: usize, s: *Slot, bytes: ?[]const u8) bool {
// A replica has no kind's code: what the open says is the authority's.
- if (tape.authorityOnly("a kind's open")) return false;
+ if (p.tape.authorityOnly("a kind's open")) return false;
var cl: Call = .{ .p = p, .id = id, .slot = s };
const prev = cl.begin("open");
- if (p) |core| if (core.kinds.byName(s.nameOf())) |k| {
+ if (p.kinds.byName(s.nameOf())) |k| {
// Its code: its library loaded at the first pane of its kind.
- if (s.ops == null) s.ops = Addon.need(&core.kinds, k, &cl.refused, core.opts.distrusted);
+ if (s.ops == null) s.ops = Addon.need(&p.kinds, p.tape, k, &cl.refused, p.opts.distrusted);
// Its block made afresh by this open.
- if (core.kinds.kinds[k].caps.plain) {
+ if (p.kinds.kinds[k].caps.plain) {
if (s.plain) |b| if (b.len > 0) s.gpa.free(b);
s.plain = &.{};
}
var w: std.Io.Writer = .fixed(&s.tail.bytes);
w.writeAll(" Term") catch {};
- for (core.kinds.words[0..core.kinds.nwords]) |*kw| if (kw.kind == k and kw.opens == 0) w.print(" {s}", .{kw.name.slice()}) catch {};
+ for (p.kinds.words[0..p.kinds.nwords]) |*kw| if (kw.kind == k and kw.opens == 0) w.print(" {s}", .{kw.name.slice()}) catch {};
w.writeAll(" Collapse Del") catch {};
s.tail.len = @intCast(w.buffered().len);
- };
+ }
s.opened = if (bytes) |b| std.hash.Wyhash.hash(0, b) else 0;
// Its file not read (not here): it waits for it, a placeholder.
if (s.ops != null and bytes == null and s.path.len > 0) _ = cl.refused.print("{s} is not here", .{s.path}) else if (s.ops) |ops| {
@@ -346,7 +345,7 @@ pub fn reopen(p: ?*Pardes, id: usize, s: *Slot, bytes: ?[]const u8) bool {
if (s.record) |r| s.gpa.free(r);
s.record = null;
s.live = true;
- if (p) |core| poke(core, s);
+ poke(p, s);
return true;
}
@@ -397,7 +396,7 @@ pub fn close(p: *Pardes, pane: *Pane) void {
// A client's pane of a plain kind closed in a speculation: its kind's
// own memory (its pictures) is left be, as the rollback brings the pane
// back; the session's order closes it.
- const kept = s.plain != null and s.ops != null and s.ops.?.close != null and tape.authorityOnly("a kind's close");
+ const kept = s.plain != null and s.ops != null and s.ops.?.close != null and p.tape.authorityOnly("a kind's close");
if (!kept) {
var i: usize = 0;
while (i < ready.items.len) if (ready.items[i].draw == p and ready.items[i].serial == pane.serial) ready.orderedRemove(i).drop() else {
@@ -559,7 +558,7 @@ fn colorOf(v: u32, default: surface.Color) surface.Color {
pub fn prefix(p: *const Pardes, arena: std.mem.Allocator, pane: *const Pane) ![]const u8 {
const slot = pane.addon.?;
var buf: [400]u8 = undefined;
- return arena.dupe(u8, tape.value(.addon, prefixOf, .{ p, slot, &buf }));
+ return arena.dupe(u8, p.tape.value(.addon, prefixOf, .{ p, slot, &buf }));
}
fn prefixOf(p: *const Pardes, slot: *const Slot, buf: *[400]u8) []const u8 {
@@ -584,7 +583,7 @@ fn prefixOf(p: *const Pardes, slot: *const Slot, buf: *[400]u8) []const u8 {
pub fn key(p: *Pardes, id: usize, k: pardes.Key) bool {
const slot = (p.panes[id] orelse return false).addon orelse return false;
if (!caps(p, slot).key) return false;
- if (!runsHere(slot) and tape.authorityOnly("a key into a kind's pane")) return true;
+ if (!runsHere(slot) and p.tape.authorityOnly("a key into a kind's pane")) return true;
const pk: c.pa_key = .{ .cp = k.cp, .ctrl = @intFromBool(k.ctrl), .alt = @intFromBool(k.alt), .shift = @intFromBool(k.shift), .view = p.live + 1 };
var cl: Call = .{ .p = p, .id = id, .slot = slot };
const prev = cl.begin("key");
@@ -608,7 +607,7 @@ pub fn takesKeys(p: *const Pardes, s: *const Slot) bool {
pub fn search(p: *Pardes, id: usize, pat: []const u8) ?[]const u8 {
const slot = (p.panes[id] orelse return null).addon orelse return null;
if (!caps(p, slot).search) return null;
- if (tape.authorityOnly("a kind's search")) return null;
+ if (p.tape.authorityOnly("a kind's search")) return null;
var cl: Call = .{ .p = p, .id = id, .slot = slot };
const prev = cl.begin("search");
if (slot.ops) |o| o.search.?(slot.st, pat.ptr, @intCast(pat.len));
@@ -624,7 +623,7 @@ pub fn address(p: *Pardes, id: usize, text: []const u8, said: *Buf(160)) bool {
const slot = (p.panes[id] orelse return false).addon orelse return false;
// By its caps, not its code: a replica without it calls as the authority does.
if (!caps(p, slot).address) return false;
- if (tape.authorityOnly("a kind's address")) return true;
+ if (p.tape.authorityOnly("a kind's address")) return true;
var cl: Call = .{ .p = p, .id = id, .slot = slot, .missing = said };
const prev = cl.begin("address");
if (slot.ops) |o| cl.ret = o.address.?(slot.st, text.ptr, @intCast(text.len));
@@ -641,7 +640,7 @@ pub fn takesMouse(p: *const Pardes, s: *const Slot) bool {
pub fn mouse(p: *Pardes, id: usize, m: pardes.Mouse, col: u16, row: u16) bool {
const slot = (p.panes[id] orelse return false).addon orelse return false;
if (!caps(p, slot).mouse) return false;
- if (!runsHere(slot) and tape.authorityOnly("the mouse in a kind's pane")) return true;
+ if (!runsHere(slot) and p.tape.authorityOnly("the mouse in a kind's pane")) return true;
const pm: c.pa_mouse = .{
.button = switch (m.button) {
.left => c.PA_LEFT,
@@ -684,8 +683,8 @@ pub fn step(p: *Pardes, due: bool) void {
// A kind's call is the authority's alone but a plain kind's here: a
// speculation's tick after a call into the pane waits with that call's
// input (it stopped there).
- const speculating = tape.speculating();
- if (speculating) for (p.panes) |pslot| if (pslot) |pane| if (pane.addon) |slot| if (slot.next_tick == 1 and !runsHere(slot)) return tape.poison("a kind's tick");
+ const speculating = p.tape.speculating;
+ if (speculating) for (p.panes) |pslot| if (pslot) |pane| if (pane.addon) |slot| if (slot.next_tick == 1 and !runsHere(slot)) return p.tape.poison("a kind's tick");
for (p.panes, 0..) |pslot, id| if (pslot) |pane| if (pane.addon) |slot| {
if (speculating and !runsHere(slot)) continue;
if (due and caps(p, slot).view) for (0..views.max) |k| {
@@ -875,7 +874,7 @@ pub fn ctl(p: *Pardes, id: usize, line: []const u8, reply: *[160]u8) ?[]const u8
const slot = (p.panes[id] orelse return "no such pane").addon orelse return "not a kind's pane";
if (!slot.live) return "its addon is not loaded";
if (!caps(p, slot).ctl) return "its kind takes no words";
- if (tape.authorityOnly("a kind's word")) return null;
+ if (p.tape.authorityOnly("a kind's word")) return null;
var cl: Call = .{ .p = p, .id = id, .slot = slot };
const prev = cl.begin("ctl");
@memset(reply, 0);
@@ -975,19 +974,20 @@ const Call = struct {
current = prev;
if (checked) overBudget(cl);
if (cl.quiet) return .{};
+ // One that is not quiet is a step's, made with its core.
+ const t = cl.p.?.tape;
var place: [32]u8 = undefined;
// A refused open closed its state: no `where` to ask.
const at: ?[]const u8 = if (cl.refused.len == 0) where(cl.slot, &place) else null;
// Hashed while it records or replays: no client, no cost.
- const state: u64 = if (tape.on == null) 0 else if (cl.slot.plain) |b| std.hash.Wyhash.hash(0, b) else 0;
- const o = tape.value(.addon, same, .{Outcome{ .state = state, .ret = cl.ret, .text = cl.refused.slice(), .said = cl.said.slice(), .err = cl.err, .look = cl.look.slice(), .pane_name = cl.pane_name.slice(), .pane_text = cl.pane_text, .exec = cl.exec.slice(), .selected = cl.selected, .rows = cl.rows, .prefix = cl.prefix, .where = at, .jobs = cl.jobs, .cancels = cl.cancels }});
+ const state: u64 = if (t.through) 0 else if (cl.slot.plain) |b| std.hash.Wyhash.hash(0, b) else 0;
+ const o = t.value(.addon, same, .{Outcome{ .state = state, .ret = cl.ret, .text = cl.refused.slice(), .said = cl.said.slice(), .err = cl.err, .look = cl.look.slice(), .pane_name = cl.pane_name.slice(), .pane_text = cl.pane_text, .exec = cl.exec.slice(), .selected = cl.selected, .rows = cl.rows, .prefix = cl.prefix, .where = at, .jobs = cl.jobs, .cancels = cl.cancels }});
if (o.where) |w| cl.slot.where_text.set(w);
// Run here, it came out otherwise than the session's: it broke its
// promise (PA_PLAIN), and the client joins again without it.
- if (cl.slot.ops != null and cl.slot.plain != null and tape.replaying() and o.state != state) {
+ if (cl.slot.ops != null and cl.slot.plain != null and t.replaying() and o.state != state) {
if (cl.p) |p| if (p.opts.distrusted) |d| d.add(cl.slot.nameOf());
- var why: Buf(160) = .{};
- tape.diverged(why.print("addon {s}: its state after {s} is not the session's (it breaks PA_PLAIN): the session's alone now", .{ cl.slot.nameOf(), cl.name }));
+ if (t.replay) t.diverge("addon {s}: its state after {s} is not the session's (it breaks PA_PLAIN): the session's alone now", .{ cl.slot.nameOf(), cl.name });
}
cl.slot.state = o.state;
// Its last job's token the session's, on a core whose kind asked
@@ -1120,7 +1120,7 @@ pub const api: c.pa_api = .{
const asked = std.mem.indexOfScalar(u32, &cl.jobs, 0) orelse return 0;
// A client's (a plain kind's code here) runs none: its token
// alone, as the session's; the answer comes on the tape.
- const free = if (tape.replaying()) null else for (&s.jobs) |*j| {
+ const free = if (cl.p.?.tape.replaying()) null else for (&s.jobs) |*j| {
if (j.* == null) break j;
} else return 0;
const copy = if (free != null) s.gpa.dupe(u8, if (in) |b| @as([*]const u8, @ptrCast(b))[0..n] else "") catch return 0 else "";
@@ -1314,7 +1314,7 @@ pub const test_kind = struct {
pub fn of(p: *Pardes) u8 {
if (p.kinds.byName("test")) |k| return k;
var words: [64]LoadedWord = undefined;
- _ = p.kinds.take(loadedOf(&ops, "", @splat(0), &words), "");
+ _ = p.kinds.take(p.tape, loadedOf(&ops, "", @splat(0), &words), "");
return p.kinds.n - 1;
}
};
@@ -1353,10 +1353,10 @@ test "a kind's head is checked before a core takes it, and a core's kinds are it
var a: Registry = .{};
var b: Registry = .{};
var words: [64]LoadedWord = undefined;
- try std.testing.expect(a.take(loadedOf(&ops, "", @splat(1), &words), "") == null);
+ try std.testing.expect(a.take(&pardes.tape.none, loadedOf(&ops, "", @splat(1), &words), "") == null);
try std.testing.expect(a.byName("zzzab") != null);
try std.testing.expect(b.byName("zzzab") == null);
- try std.testing.expectEqualStrings("refused: kind zzzab is here already", a.take(loadedOf(&ops, "", @splat(1), &words), "").?);
+ try std.testing.expectEqualStrings("refused: kind zzzab is here already", a.take(&pardes.tape.none, loadedOf(&ops, "", @splat(1), &words), "").?);
a.drop(a.byName("zzzab").?);
try std.testing.expect(a.byName("zzzab") == null);
}
diff --git a/core/dump.zig b/core/dump.zig
index 4775ad63..31496674 100644
--- a/core/dump.zig
+++ b/core/dump.zig
@@ -572,7 +572,7 @@ fn loadAndRevive(gpa: std.mem.Allocator, opts: Options, bytes: []const u8, previ
errdefer p.deinit();
// Its kinds are this process's, not the dump's: the session's it
// replaces, or what the scan found (a dump of another session's).
- p.kinds = if (previous) |old| old.kinds else .started(opts.addons);
+ p.kinds = if (previous) |old| old.kinds else .started(p.tape, opts.addons);
for (p.panes, on_disk, 0..) |slot, was_on_disk, i| if (slot) |pane| {
if (kept) |k| if (k[i] and pane.terminal != null) continue;
revivePane(p, i, pane, was_on_disk);
diff --git a/core/tape.zig b/core/tape.zig
index a2cd1e3d..e0bc95e7 100644
--- a/core/tape.zig
+++ b/core/tape.zig
@@ -491,7 +491,9 @@ pub const Tape = struct {
return bytes;
}
- fn diverge(t: *Tape, comptime why: []const u8, args: anytype) void {
+ /// A replay came to another state than the authority's (`why`, the
+ /// first said): its replica joins again.
+ pub fn diverge(t: *Tape, comptime why: []const u8, args: anytype) void {
if (t.diverged != null) return;
t.diverged = std.fmt.allocPrint(t.gpa, why ++ " (tape byte {d}, in {s})", args ++ .{ t.in.at, t.applying }) catch why;
}