Artifact 2559e637674d2f21728827444de140a3c73789e749536aaec0d27c984e56abb2:
- File
src/rfc_vectors.zig
— part of check-in
[32ef56aaf4]
at
2026-08-25 21:09:31
on branch rfc-vector-guard
— rfc vectors: keep them inert on disk
An unguarded vector parses as a real artifact, so Fossil crosslinks it into every clone -- two check-ins, a technote, twelve sub-manifest slices and a phantom pair that sync chases forever. Each vector now carries a leading # block; rfc_vectors.zig strips it at comptime so callers still see the exact RFC bytes.
Background and the cleanup that follows: see wiki page 'rfc-vector-ledger'. (user: dmestas, size: 6680) [annotate] [blame] [check-ins using] [more...]
//! RFC test vectors, byte-exact. //! //! Fossil treats any blob that parses as an artifact as a real one, so an //! unguarded vector materializes in the timeline of every clone -- as a //! check-in, a technote, and a pair of phantoms it will chase on every sync. //! Each file on disk therefore carries a leading `#` block that keeps it //! inert. Stripping happens here, once, so callers see the exact RFC bytes. /// Strip the leading `#` guard block. Comptime-only: the result is the /// artifact text itself, usable in `++` and fixed-length assertions. fn vector(comptime raw: []const u8) []const u8 { comptime { var i: usize = 0; while (i < raw.len and raw[i] == '#') { while (i < raw.len and raw[i] != '\n') i += 1; if (i < raw.len) i += 1; } return raw[i..]; } } pub const artifact_a1_1_sha1_manifest = vector(@embedFile("rfc_vectors/artifact_a1_1_sha1_manifest.txt")); pub const artifact_a1_2_sha3_technote = vector(@embedFile("rfc_vectors/artifact_a1_2_sha3_technote.txt")); pub const artifact_a3_rcard_manifest = vector(@embedFile("rfc_vectors/artifact_a3_rcard_manifest.txt")); pub const submanifest_a2_1_leaf = vector(@embedFile("rfc_vectors/submanifest_a2_1_leaf.txt")); pub const submanifest_a2_2_leaf = vector(@embedFile("rfc_vectors/submanifest_a2_2_leaf.txt")); pub const submanifest_a3_tree_manifest = vector(@embedFile("rfc_vectors/submanifest_a3_tree_manifest.txt")); pub const submanifest_a4_1_leaf = vector(@embedFile("rfc_vectors/submanifest_a4_1_leaf.txt")); pub const submanifest_a4_2_leaf = vector(@embedFile("rfc_vectors/submanifest_a4_2_leaf.txt")); pub const submanifest_a4_3_leaf = vector(@embedFile("rfc_vectors/submanifest_a4_3_leaf.txt")); pub const submanifest_a4_tree_manifest = vector(@embedFile("rfc_vectors/submanifest_a4_tree_manifest.txt")); pub const submanifest_a5_delta_manifest = vector(@embedFile("rfc_vectors/submanifest_a5_delta_manifest.txt")); pub const submanifest_a5_encoding_leaf_1 = vector(@embedFile("rfc_vectors/submanifest_a5_encoding_leaf_1.txt")); pub const submanifest_a5_encoding_leaf_2 = vector(@embedFile("rfc_vectors/submanifest_a5_encoding_leaf_2.txt")); pub const submanifest_a5_encoding_leaf_3 = vector(@embedFile("rfc_vectors/submanifest_a5_encoding_leaf_3.txt")); pub const submanifest_a5_encoding_manifest = vector(@embedFile("rfc_vectors/submanifest_a5_encoding_manifest.txt")); pub const submanifest_a5_merge_leaf_1 = vector(@embedFile("rfc_vectors/submanifest_a5_merge_leaf_1.txt")); pub const submanifest_a5_merge_leaf_2 = vector(@embedFile("rfc_vectors/submanifest_a5_merge_leaf_2.txt")); pub const submanifest_a5_merge_manifest = vector(@embedFile("rfc_vectors/submanifest_a5_merge_manifest.txt")); pub const submanifest_a5_three_level_interior_1 = vector(@embedFile("rfc_vectors/submanifest_a5_three_level_interior_1.txt")); pub const submanifest_a5_three_level_interior_2 = vector(@embedFile("rfc_vectors/submanifest_a5_three_level_interior_2.txt")); pub const submanifest_a5_three_level_manifest = vector(@embedFile("rfc_vectors/submanifest_a5_three_level_manifest.txt")); pub const sync_a1_round1_reply = vector(@embedFile("rfc_vectors/sync_a1_round1_reply.txt")); pub const sync_a1_round2_file_cards = vector(@embedFile("rfc_vectors/sync_a1_round2_file_cards.txt")); pub const sync_a1_round2_reply = vector(@embedFile("rfc_vectors/sync_a1_round2_reply.txt")); pub const sync_a2_reply = vector(@embedFile("rfc_vectors/sync_a2_reply.txt")); /// Every vector exactly as it sits on disk, guard block included. /// `artifact_test.zig` asserts each one fails the Section 4.1 framing /// gates, which is what keeps Fossil from crosslinking it. pub const guarded = [_]struct { name: []const u8, raw: []const u8 }{ .{ .name = "artifact_a1_1_sha1_manifest.txt", .raw = @embedFile("rfc_vectors/artifact_a1_1_sha1_manifest.txt") }, .{ .name = "artifact_a1_2_sha3_technote.txt", .raw = @embedFile("rfc_vectors/artifact_a1_2_sha3_technote.txt") }, .{ .name = "artifact_a3_rcard_manifest.txt", .raw = @embedFile("rfc_vectors/artifact_a3_rcard_manifest.txt") }, .{ .name = "submanifest_a2_1_leaf.txt", .raw = @embedFile("rfc_vectors/submanifest_a2_1_leaf.txt") }, .{ .name = "submanifest_a2_2_leaf.txt", .raw = @embedFile("rfc_vectors/submanifest_a2_2_leaf.txt") }, .{ .name = "submanifest_a3_tree_manifest.txt", .raw = @embedFile("rfc_vectors/submanifest_a3_tree_manifest.txt") }, .{ .name = "submanifest_a4_1_leaf.txt", .raw = @embedFile("rfc_vectors/submanifest_a4_1_leaf.txt") }, .{ .name = "submanifest_a4_2_leaf.txt", .raw = @embedFile("rfc_vectors/submanifest_a4_2_leaf.txt") }, .{ .name = "submanifest_a4_3_leaf.txt", .raw = @embedFile("rfc_vectors/submanifest_a4_3_leaf.txt") }, .{ .name = "submanifest_a4_tree_manifest.txt", .raw = @embedFile("rfc_vectors/submanifest_a4_tree_manifest.txt") }, .{ .name = "submanifest_a5_delta_manifest.txt", .raw = @embedFile("rfc_vectors/submanifest_a5_delta_manifest.txt") }, .{ .name = "submanifest_a5_encoding_leaf_1.txt", .raw = @embedFile("rfc_vectors/submanifest_a5_encoding_leaf_1.txt") }, .{ .name = "submanifest_a5_encoding_leaf_2.txt", .raw = @embedFile("rfc_vectors/submanifest_a5_encoding_leaf_2.txt") }, .{ .name = "submanifest_a5_encoding_leaf_3.txt", .raw = @embedFile("rfc_vectors/submanifest_a5_encoding_leaf_3.txt") }, .{ .name = "submanifest_a5_encoding_manifest.txt", .raw = @embedFile("rfc_vectors/submanifest_a5_encoding_manifest.txt") }, .{ .name = "submanifest_a5_merge_leaf_1.txt", .raw = @embedFile("rfc_vectors/submanifest_a5_merge_leaf_1.txt") }, .{ .name = "submanifest_a5_merge_leaf_2.txt", .raw = @embedFile("rfc_vectors/submanifest_a5_merge_leaf_2.txt") }, .{ .name = "submanifest_a5_merge_manifest.txt", .raw = @embedFile("rfc_vectors/submanifest_a5_merge_manifest.txt") }, .{ .name = "submanifest_a5_three_level_interior_1.txt", .raw = @embedFile("rfc_vectors/submanifest_a5_three_level_interior_1.txt") }, .{ .name = "submanifest_a5_three_level_interior_2.txt", .raw = @embedFile("rfc_vectors/submanifest_a5_three_level_interior_2.txt") }, .{ .name = "submanifest_a5_three_level_manifest.txt", .raw = @embedFile("rfc_vectors/submanifest_a5_three_level_manifest.txt") }, .{ .name = "sync_a1_round1_reply.txt", .raw = @embedFile("rfc_vectors/sync_a1_round1_reply.txt") }, .{ .name = "sync_a1_round2_file_cards.txt", .raw = @embedFile("rfc_vectors/sync_a1_round2_file_cards.txt") }, .{ .name = "sync_a1_round2_reply.txt", .raw = @embedFile("rfc_vectors/sync_a1_round2_reply.txt") }, .{ .name = "sync_a2_reply.txt", .raw = @embedFile("rfc_vectors/sync_a2_reply.txt") }, };