diff --git a/build.zig.zon b/build.zig.zon index c0047fc..9796015 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -25,8 +25,8 @@ .hash = "rocksdb-9.7.4-z_CUTvbbAAD2p1ScTnhTREoFY8lzJh9-EMLnYjZA1MZd", }, .otel = .{ - .url = "git+https://github.com/zzstoatzz/otel-zig.git#0339b99d358a230e2468b4a28e5e9d82f6f30f6c", - .hash = "otel-0.0.1-9q9ZWu27FAAQFjhWND9nXirEt5_mdQiVDEB2-e7oQClw", + .url = "git+https://github.com/zzstoatzz/otel-zig.git?ref=v0.1.0-alpha.1#5541f03fbabaffeeccbe977e0ebbca38d1b40ffc", + .hash = "otel-0.1.0-alpha.1-9q9ZWqfaFACSliUEu468pmnpahWjNbDWNF5h_I7pJ9PW", }, }, .paths = .{ diff --git a/src/internal/ingest/convert.zig b/src/internal/ingest/convert.zig index a19c5af..fe5a64d 100644 --- a/src/internal/ingest/convert.zig +++ b/src/internal/ingest/convert.zig @@ -323,6 +323,38 @@ test "unencodable record is isolated instead of failing the live batch" { try testing.expectEqual(frames.items[0].seq + 1, frames.items[1].seq); } +// Mirrors upstream: the live consumer archives the raw record block without +// decoding it (internal/ingest/live/events.go), and the float is only rejected +// when the subscribe encoder renders JSON (internal/subscribe/handler.go). +test "live float record keeps its row and is skipped on the wire" { + var arena_t = std.heap.ArenaAllocator.init(testing.allocator); + defer arena_t.deinit(); + const float_record = try zat.cbor.decodeAll(arena_t.allocator(), "\xa1\x61x\xfb\x3f\xf0\x00\x00\x00\x00\x00\x00"); + const cid = try zat.cbor.Cid.forDagCbor(testing.allocator, "rec"); + defer testing.allocator.free(cid.raw); + + const ops = [_]firehose.RepoOp{ + .{ .action = .create, .collection = "app.bsky.feed.like", .rkey = "3l3qo2vuowo2b", .cid = cid, .record = float_record }, + }; + const event: firehose.Event = .{ .commit = .{ + .seq = 1, + .repo = "did:plc:abc", + .rev = "3l3qo2vutsw2b", + .time = "2024-09-09T19:46:02.102Z", + .ops = &ops, + } }; + + var frames: std.ArrayList(Frame) = .empty; + var drops: Drops = .initFill(0); + try convert(arena_t.allocator(), event, 99, 10, &frames, &drops); + + try testing.expectEqual(@as(usize, 1), frames.items.len); + try testing.expectEqual(@as(u64, 0), drops.get(.missing_block)); + try testing.expectEqual(@as(u64, 1), drops.get(.unencodable_record)); + try testing.expectEqual(@as(usize, 0), frames.items[0].json.len); + try testing.expectEqual(@as(usize, 0), frames.items[0].json_v2.len); +} + test "commit fans out per op, drops invalid ops" { const record: zat.cbor.Value = .{ .map = &.{ .{ .key = "$type", .value = .{ .text = "app.bsky.feed.like" } },