milestone 18: collapse duplicated infrastructure into shared listener core, crud list helper, resource shells, transport race, name and line helpers, ui modules
CI / test (push) Successful in 1m22s
CI / test-aarch64 (push) Successful in 5m6s
CI / frontend (push) Successful in 45s
CI / cross (push) Successful in 7m53s
CI / docker (push) Failing after 1h10m57s

This commit is contained in:
2026-08-07 18:20:30 +02:00
parent c50c6d285a
commit 6f67940995
82 changed files with 3167 additions and 3114 deletions
+5 -45
View File
@@ -29,7 +29,10 @@
const std = @import("std");
const http_util = @import("http_util");
const smith_encode = @import("smith_encode.zig");
const sliceInput = smith_encode.sliceInput;
const pairInput = smith_encode.pairInput;
const Smith = std.testing.Smith;
/// A target longer than this is a 414 before it reaches any parser
@@ -149,9 +152,8 @@ fn expectPrefixOf(result: []const u8, buffer: []const u8) !void {
// corpus
// ---------------------------------------------------------------------------
//
// `Smith` does not consume a corpus entry as raw parser input. It reads a byte
// stream in which a slice is a little-endian `u32` length followed by that many
// bytes, so every entry below is length-prefixed. The three targets share one
// `Smith` does not consume a corpus entry as raw parser input, so every entry
// below goes through the `smith_encode.zig` encoders. The three targets share one
// corpus: each starts with a slice, and the query target reads a second one that
// falls back to empty when an entry carries only the first.
@@ -169,31 +171,6 @@ const deep_path = "/1/2/3/4/5/6/7/8/9";
/// through, and a plus that means different things under the two rules.
const bad_escapes = "/%2/%/%zz/a+b";
/// Encodes `bytes` as a single `Smith.slice` value.
fn sliceInput(comptime bytes: []const u8) *const [4 + bytes.len]u8 {
return &struct {
const value: [4 + bytes.len]u8 = blk: {
var buf: [4 + bytes.len]u8 = undefined;
std.mem.writeInt(u32, buf[0..4], @intCast(bytes.len), .little);
buf[4..].* = bytes[0..bytes.len].*;
break :blk buf;
};
}.value;
}
/// Encodes two `Smith.slice` values back to back, which is what the query target
/// reads as its query string and its key.
fn pairInput(comptime a: []const u8, comptime b: []const u8) *const [8 + a.len + b.len]u8 {
return &struct {
const value: [8 + a.len + b.len]u8 = blk: {
var buf: [8 + a.len + b.len]u8 = undefined;
buf[0 .. 4 + a.len].* = sliceInput(a).*;
buf[4 + a.len ..].* = sliceInput(b).*;
break :blk buf;
};
}.value;
}
const corpus = [_][]const u8{
sliceInput(api_path),
sliceInput(encoded_slash),
@@ -207,20 +184,3 @@ const corpus = [_][]const u8{
pairInput("domain=" ++ "x" ** 1024, "domain"),
pairInput("domain=%zz", "domain"),
};
test "a corpus entry carries its own length" {
const encoded = sliceInput(api_path);
try std.testing.expectEqual(
@as(u32, api_path.len),
std.mem.readInt(u32, encoded[0..4], .little),
);
try std.testing.expectEqualSlices(u8, api_path, encoded[4..]);
}
test "a paired corpus entry carries both lengths" {
const encoded = pairInput("a=1", "a");
try std.testing.expectEqual(@as(u32, 3), std.mem.readInt(u32, encoded[0..4], .little));
try std.testing.expectEqualSlices(u8, "a=1", encoded[4..7]);
try std.testing.expectEqual(@as(u32, 1), std.mem.readInt(u32, encoded[7..11], .little));
try std.testing.expectEqualSlices(u8, "a", encoded[11..]);
}