// pardes-snap: drive a pardes binary with a scripted input trace in a pty and // capture the rendered grid at named sync points. The same script run against // the prototype and the rewrite must produce byte-identical captures — this is // the old-vs-new parity oracle for the rewrite. // // zig build snap run all snapshots/*.snap, diff goldens // zig build snap -- --update regenerate goldens serially // zig build snap -- snapshots/boot.snap one script // zig build snap -- --jobs=1 serial (default: 1.25 per cpu) // zig build snap -- --trace-stable show what every `stable` waited on // // Scripts run one per forked child, in parallel; each child's report is held // in a temp file and printed in script order at the end. The runner takes its // own lockfile, so `zig build snap` never needs an `flock` wrapper: a second // run waits for the first instead of trampling the fixed /tmp paths that the // goldens record verbatim. A script that fails in the parallel pass is re-run // alone before it counts as a failure. // // `stable` no longer burns its wall-clock window: it returns as soon as the // app is provably done — screen unchanged, pty empty, and every process it // forked asleep (see waitStable). That, the fan-out, and building the vendored // C optimized (build.zig's c_optimize: 90% of a Debug startup used to be // tree-sitter's query analyser at -O0) took the suite from 7m54s to ~4s. The // app now reaches first paint in ~25ms, so what is left is mostly real work: // bash spawns, their output, and the 40 `settle`s after `key esc`. // // Script commands (line-oriented, # comments): // file create file in the script's cwd (before start) // lines [tail] create file with n numbered lines, tail on each // dirmk create a subdirectory // run run a command in the script's cwd (NOT in a pane) // start [arg] fork the app in a pty (optional extra CLI arg) // wait pump until needle appears on the grid (fails hard) // settle pump for a fixed duration // stable pump until the grid stops changing // text send literal bytes // send send with \e \r \n \t \\ \xNN escapes // key enter esc tab bs space up down left right home end // pgup pgdn c- a- (after esc: settle, or // vaxis reads the next byte in the same batch and // parses it as alt-. The scripts said 700ms and // it cost the suite 28s; there is no timer in vaxis // to outlast — 20ms passes, they use 100ms) // press|release <[ctrl-]left|middle|right> SGR mouse, 1-based // drag motion with button held // motion button-less motion (hover) // wheel // resize // snap