╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭─────────────────────────────────────────────────────────────────────────────╮ │11 pub const Issue = @import("event/Issue.zig"); │ │12 │ │13 pub const event_id_size: usize = 32; │ │14 + │ │15 +// the most bytes an event's serialized form may hold │ │16 +pub const max_event_size: usize = 100 * 1024; │ │17 │ │18 // the branch haxy events are committed to before being consumed │ │19 pub const events_ref: rf.Ref = .{ .kind = .head, .name = "haxy/events" };│ ╰─────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │209 for (events) |event| { │ │210 json.clearRetainingCapacity(); │ │211 try std.json.Stringify.value(event, .{ .whitespace = .indent_2 }, &json.writer); │ │212 + if (json.written().len > max_event_size) return error.EventTooLarge; │ │213 _ = try obj.writeCommit(repo_kind, repo_opts, state, io, allocator, .{ .author = "haxy <user@haxy>", .message = json.written(), .timestamp = event.timestamp, .parent_oids = parent_oids }, null, ref);│ │214 // later events parent on the ref's new tip │ │215 parent_oids = null; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │572 │ │573 // read the message from the commit │ │574 var message: std.ArrayList(u8) = .empty; │ │571 - try commit_object.readMessage(arena.allocator(), &message, .unlimited); │ │575 + try commit_object.readMessage(arena.allocator(), &message, .limited(max_event_size));│ │576 │ │577 const event_with_id = try EventWithId.fromString(&arena, message.items); │ │578 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯