summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:51:06 -0300
committerGabriel Schneider <[email protected]>2026-11-05 09:54:56 -0300
commit07856e29b62cd4d526e62ad62ee2a364fee509ab (patch)
tree2cbbb900cb279738f676983bcac8cc485374e671 /src
parent0d12ef0cc421fededd38681a60e89dae593dee60 (diff)
downloadpardes-07856e29b62cd4d526e62ad62ee2a364fee509ab.tar.gz
pardes-07856e29b62cd4d526e62ad62ee2a364fee509ab.zip
wire.zig: comments that told of server.zig, client.zig, a hello's cols and rows and six deleted tags go, and the tag-byte test no longer claims 0x1e free (it is focus)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src')
-rw-r--r--src/wire.zig31
1 files changed, 6 insertions, 25 deletions
diff --git a/src/wire.zig b/src/wire.zig
index d572d469..c8c4459a 100644
--- a/src/wire.zig
+++ b/src/wire.zig
@@ -250,18 +250,9 @@ pub fn encodeServer(out: []u8, msg: ServerMsg) Error![]const u8 {
return w.buffered();
}
-/// `Hello.version` alone, read out of the still-undecoded payload.
-///
-/// Separate from `decodeClient` because of the guarantee the fixed offset above
-/// exists to give: a decoder that validates `cols` and `rows` and then refuses
-/// trailing bytes can never deliver it. A v2 hello with one more field would be
-/// closed as a malformed message, and the `Refusal.version` byte a frontend
-/// needs in order to say something true would never be sent — which is exactly
-/// the case the field was put at offset zero for. So the version is asked for
-/// first, on its own, before any of the layout that may have moved.
-///
-/// An error rather than a zero on a payload shorter than two bytes, so a
-/// truncated hello stays diagnosable too instead of reading as version 0.
+/// `Hello.version` alone, read before the rest of the hello, whose layout
+/// may have moved: a mismatch is said in words, and a payload shorter than
+/// two bytes is an error, not version 0.
pub fn helloVersion(payload: []const u8) Error!u16 {
var r: std.Io.Reader = .fixed(payload);
return r.takeInt(u16, .little);
@@ -338,7 +329,7 @@ fn getPane(r: *std.Io.Reader) Error!u8 {
/// A grid the core can render into. Zero is refused rather than clamped: a
/// frontend that has not been sized yet must not be allowed to collapse a
-/// shared session to nothing (see server.zig `geometry`).
+/// shared session to nothing.
fn getCols(r: *std.Io.Reader) Error!u16 {
const v = try r.takeInt(u16, .little);
if (v == 0 or v > max_cols) return error.BadValue;
@@ -764,13 +755,7 @@ test "detached wire: every Event variant round-trips" {
}
test "detached wire: a session is never told to do a frontend's remembering" {
- // The mirror of the test above, and of client.zig's "a frontend is never
- // asked to fork, write, or watch". That one pins what may reach a FRONTEND;
- // this one pins what may reach the SESSION, and until the six tags below it
- // names were deleted the protocol was asymmetric: server -> client carried
- // only what a display can do, while client -> server still carried the
- // machine-local host's own reports, which server.zig's `apply` hands
- // straight to `core.update`.
+ // What may reach the SESSION from a client.
//
// Adding a name here is meant to be an ARGUMENT, not a formality, and the
// bar is one sentence: A HUMAN DID IT. A keystroke, a click, a
@@ -810,11 +795,7 @@ test "detached wire: a session is never told to do a frontend's remembering" {
try testing.expectEqual(allowed.len, std.enums.values(ClientTag).len);
// Two: and no tag BYTE outside them decodes either — the check above is
- // about this build's enum, this one is about the bytes on the socket. The
- // six deleted numbers (0x13..0x17, 0x1e) are in the ones that must answer
- // `BadTag`, so a frontend built before this change cannot forge a pane's
- // output into a session built after it (as are 0x1b and 0x1c, once a
- // pinch and a touch scroll).
+ // about this build's enum, this one is about the bytes on the socket.
var accepted: usize = 0;
for (0..256) |i| {
const tag: u8 = @intCast(i);