summaryrefslogtreecommitdiff
path: root/build/core.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-22 18:11:38 -0300
committerGabriel Schneider <[email protected]>2026-11-22 19:48:03 -0300
commitc607dc14502a6956bdfa3575bc7363514a7abeb4 (patch)
tree309b6954e2e53c43f47ef6ab902745957b05b60d /build/core.zig
parent8e850e6c923dcd84b7a5483f73377bd192b94a2b (diff)
downloadpardes-c607dc14502a6956bdfa3575bc7363514a7abeb4.tar.gz
pardes-c607dc14502a6956bdfa3575bc7363514a7abeb4.zip
wire: a replica's semantics hash takes what pardes changes in its dependencies (pardes-term-join-10, item 2; the note's "what cannot be made impossible"): `wire.semantics` hashed every dependency's pin but not build/patches.zig's edits nor the files they append nor uucode_config.zig, which an unstamped build has no commit to stand for, and which change how a core steps for the same bytes (ghostty's page size, so how many rows its history drops at once; a kitty medium's read; mvzr's budget; the Unicode tables ghostty measures widths by): build/core.zig `patchesHash` reads them at configure time (each file's name and text, xor-ed: no order) into `build_info.patches`, which `semantics` formats in; the failing run first: on the base, a comment appended to build/patches/mvzr_budget.zig left `pardes --version`'s semantics at f5f5b4aa40343313 both ways; with this change c5df65c0a926efab became 39ea20fc4149cc6b (logs/item2.sum); still not in the hash, on purpose: ghostty's optimize mode (build/core.zig:518, Debug builds it safe; Debug and ReleaseSafe sides of one session stay allowed, the upgrade rows between the two builds are that guard) and its SIMD (:517, off for a Darwin target built elsewhere: a scalar and a vector path must agree, ghostty's own tests); and pardes's own terminal module (its history cap, kitty limits) stands only in a stamped commit (the ponytail above `semantics`)
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'build/core.zig')
-rw-r--r--build/core.zig33
1 files changed, 29 insertions, 4 deletions
diff --git a/build/core.zig b/build/core.zig
index 63b4a5e9..e8150843 100644
--- a/build/core.zig
+++ b/build/core.zig
@@ -94,18 +94,43 @@ pub fn options(b: *std.Build, cfg: ShellConfig, c: Core, pdf: bool) *std.Build.S
}
/// `build_info`: the version, and the commit, change and time a stamped
-/// build was made from (see `stamp_commit`, read at configure time), and
-/// every dependency's hash.
-pub fn buildInfo(b: *std.Build, cfg: ShellConfig) *std.Build.Step.Options {
+/// build was made from (see `stamp_commit`, read at configure time), every
+/// dependency's hash, and what pardes changes in them (`patchesHash`).
+pub fn buildInfo(b: *std.Build, io: std.Io, cfg: ShellConfig) *std.Build.Step.Options {
const o = b.addOptions();
o.addOption([]const u8, "version", display_version);
o.addOption(?[]const u8, "commit", cfg.commit);
o.addOption(?[]const u8, "change", cfg.change);
o.addOption(?[]const u8, "built", cfg.built);
o.addOption([]const u8, "deps", deps_text);
+ o.addOption(u64, "patches", patchesHash(b, io));
return o;
}
+/// The text of every edit pardes makes to a fetched dependency
+/// (build/patches.zig's tables and the files they append, build/patches/)
+/// and of the Unicode tables' configuration (uucode_config.zig), hashed: a
+/// dependency's pin is in `deps`, but what pardes changes in it is this
+/// tree's, which an unstamped build has no commit to stand for, and it
+/// changes how a core steps (ghostty's page size: how many rows its
+/// history drops at once; a kitty medium's read; a regex's budget), so it
+/// is a replica's semantics too (abi/wire.zig `semantics`).
+fn patchesHash(b: *std.Build, io: std.Io) u64 {
+ var h: u64 = 0;
+ for ([_][]const u8{ "build/patches.zig", "uucode_config.zig" }) |sub|
+ h ^= std.hash.Wyhash.hash(0, configureRead(b, io, b.root, sub, 1 << 20) catch @panic(sub));
+ var dir = b.root.root_dir.handle.openDir(io, "build/patches", .{ .iterate = true }) catch @panic("open build/patches");
+ defer dir.close(io);
+ var it = dir.iterate();
+ // Each file by its name and text, in whatever order the directory
+ // lists them: an xor of each one's hash.
+ while (it.next(io) catch @panic("read build/patches")) |e| {
+ const sub = b.pathJoin(&.{ "build/patches", e.name });
+ h ^= std.hash.Wyhash.hash(std.hash.Wyhash.hash(0, e.name), configureRead(b, io, b.root, sub, 1 << 20) catch @panic(sub));
+ }
+ return h;
+}
+
fn vendoredThemes(b: *std.Build, io: std.Io) []const []const u8 {
var names: std.ArrayList([]const u8) = .empty;
var dir = b.root.root_dir.handle.openDir(io, "vendor/themes", .{ .iterate = true }) catch @panic("open vendor/themes");
@@ -593,7 +618,7 @@ pub fn assemble(b: *std.Build, c: struct {
.optimize = optimize,
.cloud9 = cloud9,
.cfg = c.shell_cfg,
- .info = buildInfo(b, c.shell_cfg),
+ .info = buildInfo(b, io, c.shell_cfg),
.zstd = zstd,
.image = image_addon.root_module,
.pdf = pdf_built.module,