From 579763e3aaca684ef638d621fe1b427ae96743df Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 20 Nov 2026 12:01:49 -0300 Subject: tape: a session's tape is handed in by whoever starts it, step 9c (reports/pardes-handle-69-design.md section 3.4, P33's lean 5): PARDES_RECORD is read by the starter (tape.fromEnv, the old startFromEnv returning the tape: runtime/session.zig's start, one line, and the Mac's, one line) and handed in Options.tape, so Pardes.init and dump.initFromDump no longer start a tape and Pardes.create takes its options' tape or none, never the global; current, forget and adopt are the field's (deinit and restoreInner call p.tape's; the three free ones are deleted); restoreInner loads the replacement on the session's own tape and does not leave it in the replacement's kept options (a session with clients has its tape from no options, and Peers.stop puts the options' back); Authority.init hands its tape in the options; the in-process runner (test/session.zig) keeps the tape recordTape starts and hands it to each session it makes; the global is still set beside a recording tape (fromEnv, recordTape, Stepping, Peers) while the terminal's questions read it: after this change those are its only readers, 18 calls in 12 functions (core/panes.zig scrollBy, feedOutput, followRows, the positions value, feedLost, followOutput, resizeGrid x4, reloadTerminals x3, emulatorGpa; core/term Term.digest, Term.media; core/edit.zig shellRows; core/ninep/pty.zig finish's prompt value), besides Stepping, Peers and enter's safe-build check; the tape's bytes do not move (semantics df1f0502317ed362, cross_replay both ways against step 7 agree); a real session still records from its first call (process-test --replay 0 of 102 failed, behaviour-test --replay 275/275); tui core-test 857/1008 (151 skipped), shell-test 1048/1051, pane-test 183/184, term-test 17/17, kitty-test 45/45, behaviour-test 275/275, process-test 1 of 144 (delask, passes alone), both soaks diverged 0 unequal 0 corpus 22 of 22 (bytes: the base's one now stop at 30 ms), daemon.py plain, --far (the Find: 0 mispredicted), --games, --window-clients, --restore (a Restore with a client attached), --upgrade both ways against merge31 (both failed once at the Adopt race in the chain and pass alone), addon-test 5/5; the macOS library (x86_64, aarch64) and FreeBSD build; gui unit-test 1645/1649 (the perf check's BaselineHarnessMismatch) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/dump.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core/dump.zig') diff --git a/core/dump.zig b/core/dump.zig index eb0ef263..3d248010 100644 --- a/core/dump.zig +++ b/core/dump.zig @@ -532,17 +532,20 @@ fn restoreInner(p: *Pardes, bytes: []const u8, from: []const u8) !*Pardes { var opts = p.opts; opts.cols = p.view().screen_w; opts.rows = p.view().screen_h; + // Loaded on the session's tape (one with clients has it from no + // options), which the replacement's options do not keep. + opts.tape = p.tape; const replacement = try loadAndRevive(p.gpa, opts, bytes, p, null); + replacement.opts.tape = p.opts.tape; replacement.pointRestoreAt(from); // The tape follows the replacement from here (it is the session). - pardes.tape.adopt(replacement); + p.tape.adopt(replacement); pardes.ctlfs.events.notePath(replacement, "restore", from); return replacement; } pub fn initFromDump(gpa: std.mem.Allocator, opts: Options, bytes: []const u8) !*Pardes { // By hand, not `taped`: no core yet to enter on, as `Pardes.init`. - pardes.tape.startFromEnv(); const taped = pardes.tape.enter(null, .{ .init_from_dump = .{ .opts = opts, .bytes = bytes } }); // The tape adopts the core made, none on a failure. var made: ?*Pardes = null; -- cgit v1.3