summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 09:14:40 -0300
committerGabriel Schneider <[email protected]>2026-11-20 10:37:54 -0300
commit6cf477bd75d242c7f7fea653d5f433872f7ca66f (patch)
tree648c807305c0c5f969dd3283aafd5097a88a3a13 /core
parentff183922e78f04eee85043d29f1bd5e5ba43a6cd (diff)
downloadpardes-6cf477bd75d242c7f7fea653d5f433872f7ca66f.tar.gz
pardes-6cf477bd75d242c7f7fea653d5f433872f7ca66f.zip
tape: the idle rule checked beside the global, step 9b-0 (reports/pardes-handle-69-design.md section 3.4): in a safe build every entry computes the rule 9b reads the field by (tapeOf: the core's tape, or for a session not made yet its options' or create's; records: not the tape nobody records, nor a replica's between its steps) and panics where it and tape.on disagree; run first printing every disagreement through all the suites and both soaks (logs under reorg/pardes-handle-7/logs/9b0x), it found two kinds, both the rule's to keep and excepted by name in the check: a client's core freed (Replica.deinit inside a Stepping scope: today a deinit record into a buffer let go at once, the rule records nothing; every client of every suite and soak), and tests that drive an authority's core outside a Stepping scope (today unrecorded, the rule records them as a real session's every entry: test/panes.zig's jobs() and renders at :3749, :3809, :3824, :3899, :3913, core/replica.zig :5094's shows(a.core, ..)); no other; the tape's bytes do not move (semantics df1f0502317ed362, cross_replay both ways against step 7 agree); with the print: tui core-test, shell-test, pane-test, term-test 17/17, kitty-test 45/45, behaviour-test 275/275, process-test --replay 0 of 102 failed, process-test 1 of 144 (msg, at a load of 22; passes alone), both soaks diverged 0 unequal 0 corpus 22 of 22 (bytes: the base's one now stop at 30 ms; the plain soak's three rtts are also 9a's soak again, which another agent's kill cut short); as committed (the panic): core-test 857/1008 (151 skipped), shell-test 1048/1051, pane-test 183/184, behaviour-test 275/275 and --replay 275/275
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core')
-rw-r--r--core/tape.zig30
1 files changed, 30 insertions, 0 deletions
diff --git a/core/tape.zig b/core/tape.zig
index c32c4453..ddfaa4b1 100644
--- a/core/tape.zig
+++ b/core/tape.zig
@@ -1041,10 +1041,40 @@ pub inline fn enter(p: ?*Pardes, input: Input) Entered {
// fails when it does.
if (std.debug.runtime_safety) if (p) |core| if (if (on) |t| core.tape != t else core.tape.stepping())
@panic("tape: a core's field is not the tape being stepped (tape.on)");
+ // The rule the field is read by next (9b), checked beside `on` first.
+ // Where they disagree (9b-0's list, both the rule's to keep): a
+ // client's core freed (Replica.deinit, inside a Stepping scope: `on`
+ // records its `deinit` into a buffer let go at once; the rule records
+ // nothing), and a test that drives an authority's core outside a
+ // Stepping scope (no `on`: unrecorded; the rule records it, as a real
+ // session's every entry is).
+ if (std.debug.runtime_safety) {
+ const t = tapeOf(p, &input);
+ const listed = if (on != null) input == .deinit and t.replica else !t.replica;
+ if (records(t) != (on != null) and !listed) @panic("tape: the idle rule and tape.on disagree");
+ }
const t = on orelse return .{};
return t.enterInput(p, &input);
}
+/// The tape an entry steps: its core's; for a session not made yet, the one
+/// its options name, or the one `Pardes.create` takes.
+fn tapeOf(p: ?*Pardes, input: *const Input) *Tape {
+ if (p) |core| return core.tape;
+ const opts = switch (input.*) {
+ .init => |o| o,
+ .init_from_dump => |d| d.opts,
+ else => return &none,
+ };
+ return opts.tape orelse on orelse &none;
+}
+
+/// Whether an entry on `t` is recorded: not on the tape nobody records, nor
+/// on a replica's between its steps (a client's frame drawn, its core freed).
+fn records(t: *const Tape) bool {
+ return !(t.through or (t.replica and !t.replaying()));
+}
+
pub inline fn leave(p: ?*Pardes, e: Entered) void {
if (e.outer) on.?.leaveInput(p);
}