diff --git a/.tangled/workflows/checks.yml b/.tangled/workflows/checks.yml index 055308b..d937717 100644 --- a/.tangled/workflows/checks.yml +++ b/.tangled/workflows/checks.yml @@ -25,6 +25,6 @@ steps: - name: correctness and performance command: | set -euo pipefail - export PATH="$PWD/.ci-tools/zig-x86_64-linux-0.16.0:$PWD/.ci-tools/go/bin:$PATH" + export PATH="$PWD/.ci-tools/zig-x86_64-linux-0.17.0:$PWD/.ci-tools/go/bin:$PATH" export GOTOOLCHAIN=local checks/run ci diff --git a/.tangled/workflows/release.yml b/.tangled/workflows/release.yml index 13b7f67..353dd65 100644 --- a/.tangled/workflows/release.yml +++ b/.tangled/workflows/release.yml @@ -22,6 +22,6 @@ steps: - name: release correctness and performance command: | set -euo pipefail - export PATH="$PWD/.ci-tools/zig-x86_64-linux-0.16.0:$PWD/.ci-tools/go/bin:$PATH" + export PATH="$PWD/.ci-tools/zig-x86_64-linux-0.17.0:$PWD/.ci-tools/go/bin:$PATH" export GOTOOLCHAIN=local checks/run release diff --git a/README.md b/README.md index 7f7743b..fe13268 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ the official Go client's shape, with multi-host live failover. built on ## install -requires Zig 0.16.0. +requires Zig 0.17.0. ```sh zig fetch --save https://tangled.org/zat.dev/jetstream/archive/v0.1.5.tar.gz diff --git a/build.zig b/build.zig index da24f98..15acba7 100644 --- a/build.zig +++ b/build.zig @@ -89,7 +89,7 @@ pub fn build(b: *std.Build) void { }); b.installArtifact(example); const run_example = b.addRunArtifact(example); - if (b.args) |args| run_example.addArgs(args); + run_example.addPassthruArgs(); const example_step = b.step("example-streamplace-chat", "replay a Streamplace broadcast's chat from the archive"); example_step.dependOn(&run_example.step); @@ -107,7 +107,7 @@ pub fn build(b: *std.Build) void { }); b.installArtifact(smoke); const run_smoke = b.addRunArtifact(smoke); - if (b.args) |args| run_smoke.addArgs(args); + run_smoke.addPassthruArgs(); const smoke_step = b.step("example-failover-smoke", "live smoke: dead primary rotates to a real fallback"); smoke_step.dependOn(&run_smoke.step); @@ -139,11 +139,11 @@ pub fn build(b: *std.Build) void { }); b.installArtifact(segment_export); const run_segment_export = b.addRunArtifact(segment_export); - if (b.args) |args| run_segment_export.addArgs(args); + run_segment_export.addPassthruArgs(); const segment_export_step = b.step("segment-export", "one local jss segment -> TSV rows on stdout"); segment_export_step.dependOn(&run_segment_export.step); const run_cutover = b.addRunArtifact(cutover); - if (b.args) |args| run_cutover.addArgs(args); + run_cutover.addPassthruArgs(); const cutover_step = b.step("example-cutover-smoke", "live smoke: archive sweep -> gapless cutover -> live tail"); cutover_step.dependOn(&run_cutover.step); @@ -162,7 +162,7 @@ pub fn build(b: *std.Build) void { }); b.installArtifact(slice); const run_slice = b.addRunArtifact(slice); - if (b.args) |args| run_slice.addArgs(args); + run_slice.addPassthruArgs(); const slice_step = b.step("example-slice-sync", "replay one account's whole history from the archive slice"); slice_step.dependOn(&run_slice.step); } diff --git a/build.zig.zon b/build.zig.zon index 1264b06..d7c5355 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,7 +1,7 @@ .{ .name = .jetstream, .version = "0.1.5", - .minimum_zig_version = "0.16.0-dev.3070+b22eb176b", + .minimum_zig_version = "0.17.0", .fingerprint = 0xee435acce6d720e8, .dependencies = .{ .zstd = .{ @@ -9,12 +9,12 @@ .hash = "N-V-__8AAPZ7fwBg4JoCzM_0o2A8wxH2hsUUeiU1iuZv53L5", }, .zat = .{ - .url = "https://tangled.org/zat.dev/zat/archive/v0.5.2.tar.gz", - .hash = "zat-0.5.2-5PuC7j8iDAD9QHlZfpf-U4qgyTpHA3u2i_Ni4T34soV3", + .url = "https://tangled.org/zat.dev/zat/archive/v0.6.0-alpha.2.tar.gz", + .hash = "zat-0.6.0-alpha.2-5PuC7knODABZ9UsoxRvI94zsmsE3XQPWdBIBn6zDduW2", }, .websocket = .{ - .url = "https://tangled.org/zzstoatzz.io/websocket.zig/archive/v0.1.12.tar.gz", - .hash = "websocket-0.1.12-ZPISdTJEBQDiqWKUP5mPPK9IXJ5xscVHybOlUbPHM9Rr", + .url = "https://tangled.org/zzstoatzz.io/websocket.zig/archive/v0.2.0-alpha.2.tar.gz", + .hash = "websocket-0.2.0-alpha.2-ZPISdd9ZBQAlweSmUfRIOl4m_BrcbeAmDT_5H6kA0aXC", }, }, .paths = .{ "build.zig", "build.zig.zon", "src", "examples", "checks/client.zig" }, diff --git a/checks/install-tools.sh b/checks/install-tools.sh index 8ee4740..6cd4c0d 100755 --- a/checks/install-tools.sh +++ b/checks/install-tools.sh @@ -8,13 +8,13 @@ cd "$(dirname "$0")/.." mkdir -p .ci-tools cd .ci-tools curl --fail --silent --show-error --location --retry 3 \ - https://ziglang.org/download/0.16.0/zig-x86_64-linux-0.16.0.tar.xz -o zig.tar.xz -printf '%s %s\n' 70e49664a74374b48b51e6f3fdfbf437f6395d42509050588bd49abe52ba3d00 zig.tar.xz | sha256sum --check + https://ziglang.org/download/0.17.0/zig-x86_64-linux-0.17.0.tar.xz -o zig.tar.xz +printf '%s %s\n' 1cbe9df9f27e6b78d14ccbca43b6703a404ef79ef1c463de901d7f088d4e2026 zig.tar.xz | sha256sum --check curl --fail --silent --show-error --location --retry 3 \ https://go.dev/dl/go1.27.0.linux-amd64.tar.gz -o go.tar.gz printf '%s %s\n' 675c26c449cbb18fc24b74650de1eabbae6e16f64326fd85a283fb3b58280685 go.tar.gz | sha256sum --check tar -xJf zig.tar.xz tar -xzf go.tar.gz rm zig.tar.xz go.tar.gz -test "$(./zig-x86_64-linux-0.16.0/zig version)" = 0.16.0 +test "$(./zig-x86_64-linux-0.17.0/zig version)" = 0.17.0 ./go/bin/go version diff --git a/examples/streamplace_chat.zig b/examples/streamplace_chat.zig index 36a1358..b66a215 100644 --- a/examples/streamplace_chat.zig +++ b/examples/streamplace_chat.zig @@ -290,7 +290,7 @@ fn getLivestream( var response = try client.queryParams(method, ¶ms); defer response.deinit(); if (!response.ok()) { - std.debug.print("getRecord failed ({d}): {s}\n", .{ @intFromEnum(response.status), response.body }); + std.debug.print("getRecord failed ({d}): {s}\n", .{ @backingInt(response.status), response.body }); return error.LivestreamLookupFailed; } diff --git a/src/archive_backfill.zig b/src/archive_backfill.zig index b34dab7..3aebc1d 100644 --- a/src/archive_backfill.zig +++ b/src/archive_backfill.zig @@ -451,7 +451,7 @@ fn fetchWithRetry(io: Io, transport: *HttpTransport, url: []const u8, authorizat if (transport.fetch(.{ .url = url, .authorization = authorization })) |result| { if (result.status == .ok) return result; var discarded = result; - const code = @intFromEnum(result.status); + const code = @backingInt(result.status); hint_ns = retryHint(result.rate_limit, Io.Clock.real.now(io).toNanoseconds()); discarded.deinit(transport.allocator); const retryable = if (kind == .segment) code >= 500 or code == 429 else code == 429 or code == 500 or code == 502 or code == 503 or code == 504; @@ -552,7 +552,7 @@ fn fetchPlan(arena: Allocator, transport: *HttpTransport, options: Options, auth }); defer fetched.deinit(transport.allocator); if (fetched.status != .ok) { - log.warn("planSnapshot failed: {d} {s}", .{ @intFromEnum(fetched.status), fetched.body }); + log.warn("planSnapshot failed: {d} {s}", .{ @backingInt(fetched.status), fetched.body }); return error.PlanFailed; } return parsePlan(arena, fetched.body); @@ -1472,7 +1472,7 @@ test "deliverSegment rejects bad magic" { }; var handler = NoopHandler{}; var result: Result = .{ .planned_through_seq = 0, .sealed_tip_seq = 0 }; - const bogus = [_]u8{0} ** header_size; + const bogus: [header_size]u8 = @splat(0); try testing.expectError(error.MalformedSegment, deliverSegment( testing.allocator, &bogus, diff --git a/src/client.zig b/src/client.zig index 9201f82..2346d42 100644 --- a/src/client.zig +++ b/src/client.zig @@ -394,7 +394,7 @@ fn fetchZstdDict(io: Io, allocator: Allocator, host: []const u8) ?[]u8 { }; defer response.deinit(allocator); if (response.status != .ok) { - log.warn("getZstdDictionary returned {d}; live tail will be uncompressed", .{@intFromEnum(response.status)}); + log.warn("getZstdDictionary returned {d}; live tail will be uncompressed", .{@backingInt(response.status)}); return null; } return allocator.dupe(u8, response.body) catch null; diff --git a/src/loopback_test.zig b/src/loopback_test.zig index 848977c..9ccf7f5 100644 --- a/src/loopback_test.zig +++ b/src/loopback_test.zig @@ -307,7 +307,7 @@ const Instance = struct { return out.written(); } - const BlockRow = @typeInfo(@typeInfo(@TypeOf(archive.buildTestBlock)).@"fn".params[1].type.?).pointer.child; + const BlockRow = @typeInfo(@typeInfo(@TypeOf(archive.buildTestBlock)).@"fn".param_types[1].?).pointer.child; fn handleWebsocket(self: *Instance, request: []const u8, target: []const u8, r: *Io.Reader, w: *Io.Writer) !void { if (self.ws_sessions < self.wire_cursors.len) self.wire_cursors[self.ws_sessions] = queryCursor(target); diff --git a/src/zstd.zig b/src/zstd.zig index 6f54e36..39e1f4b 100644 --- a/src/zstd.zig +++ b/src/zstd.zig @@ -250,7 +250,10 @@ test "live dictionary decodes upstream Go streaming frame without declared size" defer decoder.deinit(); const out = try decoder.decompressAlloc(testing.allocator, &frame); defer testing.allocator.free(out); - try testing.expectEqualStrings("{\"collection\":\"app.bsky.feed.post\",\"text\":\"hello world\"}" ** 8, out); + const record = "{\"collection\":\"app.bsky.feed.post\",\"text\":\"hello world\"}"; + try testing.expectEqual(record.len * 8, out.len); + var records = std.mem.window(u8, out, record.len, record.len); + while (records.next()) |r| try testing.expectEqualStrings(record, r); decoder.max_out = 447; try testing.expectError(error.BlockOversize, decoder.decompressAlloc(testing.allocator, &frame)); }