summaryrefslogtreecommitdiff
path: root/build/snap.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-31 06:28:48 -0300
committerGabriel Schneider <[email protected]>2026-10-31 06:28:48 -0300
commita479792a1ab2b593642d7f648194bfa23ce01dba (patch)
tree96ddee7d879a9084daa07db43b0b7910b072a785 /build/snap.zig
parente179cc44fe5060c76a5b00c41e53f11209f5acd9 (diff)
parent4c761893e5b3fdae422622cfa02104ab36633045 (diff)
downloadpardes-a479792a1ab2b593642d7f648194bfa23ce01dba.tar.gz
pardes-a479792a1ab2b593642d7f648194bfa23ce01dba.zip
Merge the upstream daemon and replicated client/server refactor
Diffstat (limited to 'build/snap.zig')
-rw-r--r--build/snap.zig38
1 files changed, 37 insertions, 1 deletions
diff --git a/build/snap.zig b/build/snap.zig
index 35a246ad..ad06486a 100644
--- a/build/snap.zig
+++ b/build/snap.zig
@@ -66,6 +66,42 @@ pub fn addTty(b: *std.Build, opts: struct {
run_monkey.addPassthruArgs();
run_monkey.has_side_effects = true;
b.step("monkey", "random snapshot scripts hunting panics (-- <seeds> [steps] [--from=N] [--out=DIR])").dependOn(&run_monkey.step);
+ // The replay-divergence gate (src/tape.zig, docs/next-daemon.md): every
+ // snapshot script and `replay-seeds` monkey seeds with each session's
+ // tape recorded, each replayed into two replicas at different
+ // addresses and one that never draws, every digest checked; and at each
+ // session's end its dump loaded, which must be that session, digest for
+ // digest, and dump again to the same bytes (phase 2).
+ const tapes = ".zig-cache/tapes";
+ const run_replay = b.addRunArtifact(snap);
+ run_replay.addArtifactArg(opts.exe);
+ run_replay.addPrefixedFileArg("--lspmock=", lspmock.getEmittedBin());
+ run_replay.addArgs(&.{ "--tape=" ++ tapes, "--dump" });
+ // Each script's tape replayed by another build too: a window's build
+ // replaying a terminal's sessions, as its replica of one does.
+ if (b.option([]const u8, "replay-with", "another build of pardes `zig build replay` replays every script's tape with too (a pardes-gui, say)")) |other|
+ run_replay.addArg(b.fmt("--replay-with={s}", .{other}));
+ run_replay.setCwd(b.path("."));
+ run_replay.has_side_effects = true;
+ const seeds = b.option(u32, "replay-seeds", "monkey seeds `zig build replay` records and replays (default 20)") orelse 20;
+ const run_monkey_replay = b.addRunArtifact(monkey);
+ run_monkey_replay.addArtifactArg(snap);
+ run_monkey_replay.addArtifactArg(opts.exe);
+ run_monkey_replay.addArgs(&.{ b.fmt("{d}", .{seeds}), "70", "--tape=" ++ tapes ++ "/monkey", "--dump", "--out=" ++ tapes ++ "/monkey" });
+ run_monkey_replay.setCwd(b.path("."));
+ run_monkey_replay.has_side_effects = true;
+ // One pardes-snap run at a time (its lock): the scripts, then the seeds.
+ run_monkey_replay.step.dependOn(&run_replay.step);
+ // The same seeds with three terminals on the session, each a view of
+ // it, typed into in turn (views.zig).
+ const run_views_replay = b.addRunArtifact(monkey);
+ run_views_replay.addArtifactArg(snap);
+ run_views_replay.addArtifactArg(opts.exe);
+ run_views_replay.addArgs(&.{ b.fmt("{d}", .{seeds}), "70", "--views=3", "--tape=" ++ tapes ++ "/monkey-views", "--dump", "--out=" ++ tapes ++ "/monkey-views" });
+ run_views_replay.setCwd(b.path("."));
+ run_views_replay.has_side_effects = true;
+ run_views_replay.step.dependOn(&run_monkey_replay.step);
+ b.step("replay", "record every snapshot script's and -Dreplay-seeds monkey seeds' tapes (one terminal and three) and require each to replay without diverging, and each session's dump to load to its digest").dependOn(&run_views_replay.step);
const monkey_tests = b.addTest(.{ .root_module = monkey.root_module });
b.step("monkey-test", "test the monkey's generator and panic detector").dependOn(&b.addRunArtifact(monkey_tests).step);
const run_driver_test = b.addRunArtifact(snap);
@@ -86,7 +122,7 @@ pub fn addWeb(b: *std.Build) void {
"-Dplatform=web",
"-Dtarget=wasm32-freestanding",
"-Dtree-sitter=zig",
- "-Ddump=test/web-snapshots/touch.dump.zon",
+ "-Ddump=test/web-snapshots/touch.dump",
"-p",
"zig-out/web-snap-test",
});