a73x

9cf16857

Restore the claims the ratchets cut from pty and upgrade

a73x   2026-08-31 14:39

Commit message
Restore the claims the ratchets cut from pty and upgrade

`upgrade.zig`'s `attaches` counter pointed at a vague "zoom and unzoom"
proof; the real one is `assert_attach_delta` in `e2e_lib.sh`, which holds
a wall of N tiles to N attaches however far the focus moves. Restores
what SUCCEEDS means and the one-closes-as-another-opens case.

`pty.zig` needed almost nothing — it was never compressed. Two lines:
"Injection's door" now says a child's env comes from nowhere else, and a
trailing flourish goes where the sentence before it already made the claim.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

src/server/pty.zig
Old New
@@ -29,8 +29,8 @@ pub const Pty = struct {
29 /// The e2e fixture uses this to keep predict stats out of the 29 /// The e2e fixture uses this to keep predict stats out of the
30 /// capture, matching the suite's `.err` sibling convention. 30 /// capture, matching the suite's `.err` sibling convention.
31 stderr_fd: ?std.posix.fd_t = null, 31 stderr_fd: ?std.posix.fd_t = null,
32 /// Set in the child between fork and exec, after TERM. Injection's 32 /// Set in the child between fork and exec, after TERM. A child's env
33 /// door: the daemon's env is the only source of a child's env. 33 /// comes from nowhere else, so this field is where injection enters.
34 env: []const EnvPair = &.{}, 34 env: []const EnvPair = &.{},
35 }; 35 };
36 36
@@ -252,8 +252,7 @@ test "Pty: deinit is bounded even when the child ignores HUP and TERM" {
252 const elapsed_ms = t.read() / std.time.ns_per_ms; 252 const elapsed_ms = t.read() / std.time.ns_per_ms;
253 253
254 // Returned at all is the headline. The bound is the assertion that can 254 // Returned at all is the headline. The bound is the assertion that can
255 // still fail fast if someone widens the grace period without meaning 255 // still fail fast if someone widens the grace period without meaning to.
256 // to — a shutdown budget is a number you compute, not a mood.
257 try std.testing.expect(elapsed_ms < 3000); 256 try std.testing.expect(elapsed_ms < 3000);
258 // Reaped, not merely abandoned: a deinit that returned while leaving a 257 // Reaped, not merely abandoned: a deinit that returned while leaving a
259 // zombie would satisfy the clock and leak the process. 258 // zombie would satisfy the clock and leak the process.
src/server/upgrade.zig
Old New
@@ -76,15 +76,17 @@ pub const Counters = struct {
76 snapshot_equiv_bytes: u64 = 0, 76 snapshot_equiv_bytes: u64 = 0,
77 /// Every `.attach` this daemon ACCEPTED, cumulative and monotonic. 77 /// Every `.attach` this daemon ACCEPTED, cumulative and monotonic.
78 /// 78 ///
79 /// A counter where `clients=` is a gauge: the gauge cannot answer "did 79 /// A counter where `clients=` is a gauge, because the gauge cannot answer
80 /// anyone attach since I last looked", because a client that attaches and 80 /// "did anyone attach since I last looked": a client that attaches and
81 /// leaves between two samples is invisible to it. The wall's in-place zoom 81 /// leaves between two samples is invisible to it, and so is one that closes
82 /// is what needs that answered — the proof is that this number did NOT move 82 /// as another opens. `assert_attach_delta` in e2e_lib.sh is what needs the
83 /// across a zoom and an unzoom. 83 /// counter — it holds a wall of N tiles to N attaches however far the focus
84 /// moves, which is a negative no gauge can witness.
84 /// 85 ///
85 /// Counted where an attach SUCCEEDS, not where the frame arrives: a refusal 86 /// Counted where an attach SUCCEEDS — a session resolved and the client
86 /// attached nobody. Both arms count, since a socket client's first attach 87 /// seated — not where the frame arrives: a refusal attached nobody. Both
87 /// promotes an observer and every later one arrives established. 88 /// arms count, since a socket client's first attach promotes an observer
89 /// and every later one, a QUIC first attach included, arrives established.
88 attaches: u64 = 0, 90 attaches: u64 = 0,
89 agent_refused_no_offer: u64 = 0, 91 agent_refused_no_offer: u64 = 0,
90 agent_refused_full: u64 = 0, 92 agent_refused_full: u64 = 0,