diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-29 11:14:38 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-29 15:57:34 -0300 |
| commit | a4b85cb7689c111c9f06891164e765a1b49f63c8 (patch) | |
| tree | 7204b7978312e398ece4312c0ced0776c3296f68 /build/snap.zig | |
| parent | 044da0f75ab5fb5be0213e512741860d95dad8e5 (diff) | |
| download | pardes-a4b85cb7689c111c9f06891164e765a1b49f63c8.tar.gz pardes-a4b85cb7689c111c9f06891164e765a1b49f63c8.zip | |
replay gate: pardes-snap --tape and pardes-monkey --tape record every session's tape and fail a script whose tapes do not replay; `zig build replay`
pardes-snap --tape=DIR sets PARDES_RECORD for each script (each session, a nested pardes's too, writes DIR/<stem>-<pid>.tape) and, once the script has run and its goldens compared, replays every tape with the same build (PARDES_REPLAY): a divergence, or no tape at all, fails the script as DIVERGED with the replay's words. pardes-monkey --tape=DIR passes it on and counts a divergence as a hit. `zig build replay -Dplatform=tty [-Dreplay-seeds=N]` runs every snapshot script, then N monkey seeds of 70 steps (default 20), tapes under .zig-cache/tapes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'build/snap.zig')
| -rw-r--r-- | build/snap.zig | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/build/snap.zig b/build/snap.zig index 35a246ad..6982379c 100644 --- a/build/snap.zig +++ b/build/snap.zig @@ -66,6 +66,27 @@ 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. + const tapes = ".zig-cache/tapes"; + const run_replay = b.addRunArtifact(snap); + run_replay.addArtifactArg(opts.exe); + run_replay.addPrefixedFileArg("--lspmock=", lspmock.getEmittedBin()); + run_replay.addArg("--tape=" ++ tapes); + 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", "--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); + b.step("replay", "record every snapshot script's and -Dreplay-seeds monkey seeds' tapes and require each to replay without diverging").dependOn(&run_monkey_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); |
