summaryrefslogtreecommitdiff
path: root/src/tape.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 22:06:33 -0300
committerGabriel Schneider <[email protected]>2026-11-17 22:23:50 -0300
commit920110be4c597b4b93fc2d38179c09b335186253 (patch)
treefb5a3eaebb48b8c52ec0e23540e5065d940995d0 /src/tape.zig
parent7d10ad68b07a7bbab23fa8565d39183e4387c478 (diff)
downloadpardes-920110be4c597b4b93fc2d38179c09b335186253.tar.gz
pardes-920110be4c597b4b93fc2d38179c09b335186253.zip
words: a session with no frontend of its own is `detached` in the code, one word for what was `headless`, `parked`, `alone_unattended`, `Term.none` and `!attached()` (PARDES.md ruling 1): main.zig's and gui.zig's `headless` (run, runNative, localSession) are `detached`, tui.zig's `Term.none` is `Term.detached`, the window's `Shell.parked` (its Gui kept while detached) is `Shell.detached`, `replica.Peers.alone_unattended` is `Peers.detached`, and the terminal's `Shell.attached()` is `Shell.detached()`, its five callers and `watched` negated to match (a test's Shell with no screen is not detached, as it was attached); the tape's `headless`, a replica core that skips `render` and the host calls inside it (set on every client), is `skips_render`, its replay run named `skips-render` ("replay X: skips-render replica: N digests agree"), and the two that read that line follow (test/tty.zig's other-build replay, test/cross_replay.py); NOT renamed, a different fact: `Core.unattended` (detached AND no client: nobody looks), a watched field on the tape by index; names only, no logic moved; tui core-test 811/950 (139 skipped), shell-test 993/996, behaviour-test 269/273 (the four addon ABI tests the base fails) and the same with --replay, process-test 2 of 144 failed (lspcomplete and lspcompletemoved, the base's), replicas pass (checked/wrong 0), daemon.py main passes; gui frame corpus 77/77 byte-identical against mbase, unit-test 1582/1590 (the base's 8 failures)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/tape.zig')
-rw-r--r--src/tape.zig26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/tape.zig b/src/tape.zig
index fd5b4b85..eaae601e 100644
--- a/src/tape.zig
+++ b/src/tape.zig
@@ -212,7 +212,7 @@ pub const Tape = struct {
arena: std.heap.ArenaAllocator,
last_ret: walk.Reader = .{ .bytes = &.{} },
mask: u64 = 0,
- headless: bool = false,
+ skips_render: bool = false,
digests: u64 = 0,
diverged: ?[]const u8 = null,
/// The input being applied, for a divergence's report.
@@ -338,7 +338,7 @@ pub const Tape = struct {
t.mask = mask;
t.vtable = .{};
inline for (host_fns, 0..) |f, i| if (mask & (@as(u64, 1) << i) != 0 or
- (t.headless and comptime std.mem.eql(u8, f, "watched")))
+ (t.skips_render and comptime std.mem.eql(u8, f, "watched")))
{
@field(t.vtable, f) = &Wrap(i).f;
};
@@ -399,7 +399,7 @@ pub const Tape = struct {
t.diverged = std.fmt.allocPrint(t.gpa, why ++ " (tape byte {d}, in {s})", args ++ .{ t.in.at, t.applying }) catch why;
}
- /// A host call the headless replica does not make (it draws no frame,
+ /// A host call a replica that skips render does not make (it draws no frame,
/// so presents none): what the host told the core inside it (what it
/// presented, `presented`) is applied all the
/// same, the host's own calls below it stepped over.
@@ -417,7 +417,7 @@ pub const Tape = struct {
}
}
- /// Over a call the replica does not make (the headless one's present),
+ /// Over a call the replica does not make (a present, in one that skips render),
/// what was applied inside it too.
fn skip(t: *Tape) void {
var depth: usize = 1;
@@ -432,7 +432,7 @@ pub const Tape = struct {
}
/// The records of an input up to its end: what was applied inside it,
- /// as it was; the headless replica steps over the host calls it did
+ /// as it was; a replica that skips render steps over the host calls it did
/// not make.
fn finishInput(t: *Tape) void {
while (t.diverged == null) {
@@ -441,7 +441,7 @@ pub const Tape = struct {
switch (kind) {
.done => return,
.set => t.applySet(&rec.payload),
- .host => if (t.headless) t.skipHost() else return t.diverge("the core did not make the host call {d} the tape has", .{std.mem.bytesToValue(u16, rec.payload.bytes[0..2])}),
+ .host => if (t.skips_render) t.skipHost() else return t.diverge("the core did not make the host call {d} the tape has", .{std.mem.bytesToValue(u16, rec.payload.bytes[0..2])}),
.input => t.apply(&rec.payload),
.digest => t.check(rec.payload.bytes),
.ret => return t.diverge("the core's input ended before the recorded one", .{}),
@@ -607,7 +607,7 @@ pub const Tape = struct {
.perform => |e| p.perform(e),
.next_effect => _ = p.nextEffect(),
.advance => |now| p.advance(now),
- .render => if (t.headless) return t.skip() else {
+ .render => if (t.skips_render) return t.skip() else {
_ = p.frame_arena.reset(.retain_capacity);
_ = p.render(p.frame_arena.allocator()) catch {};
},
@@ -809,7 +809,7 @@ fn hostCall(comptime i: usize, comptime R: type, ctx: ?*anyopaque, args: anytype
};
if (t.replay) {
// A replica that never draws is never watched: it asks no one.
- if (comptime std.mem.eql(u8, name, "watched")) if (t.headless) return false;
+ if (comptime std.mem.eql(u8, name, "watched")) if (t.skips_render) return false;
if (!t.expectHost(i, name)) return std.mem.zeroes(R);
var ret = t.last_ret;
if (R == ?[]const u8) {
@@ -1281,15 +1281,15 @@ pub fn replayMain(path: []const u8) u8 {
/// digest and dumped to its bytes again: true when none diverged. An
/// in-process session's tape too (test/session.zig's replayTape).
pub fn replayBytes(gpa: std.mem.Allocator, bytes: []const u8, path: []const u8, dump: bool) bool {
- const runs = [_]struct { name: []const u8, headless: bool }{
- .{ .name = "first", .headless = false },
+ const runs = [_]struct { name: []const u8, skips_render: bool }{
+ .{ .name = "first", .skips_render = false },
// The first replica's memory is still held: this one's lies elsewhere.
- .{ .name = "second", .headless = false },
- .{ .name = "headless", .headless = true },
+ .{ .name = "second", .skips_render = false },
+ .{ .name = "skips-render", .skips_render = true },
};
var failed = false;
for (runs) |run| {
- var t: Tape = .{ .gpa = gpa, .replay = true, .headless = run.headless, .scratch = .init(gpa), .arena = .init(gpa) };
+ var t: Tape = .{ .gpa = gpa, .replay = true, .skips_render = run.skips_render, .scratch = .init(gpa), .arena = .init(gpa) };
t.dump_check = std.mem.eql(u8, run.name, "first") and dump;
on = &t;
defer on = null;