╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭─────────────────────────────────────────────────────╮ │ 9 pub const User = @import("event/User.zig"); │ │10 pub const Repo = @import("event/Repo.zig"); │ │11 pub const Issue = @import("event/Issue.zig"); │ │12 +pub const Comment = @import("event/Comment.zig");│ │13 │ │14 pub const event_id_size: usize = 16; │ │15 │ ╰─────────────────────────────────────────────────────╯ ╭────────────────────────────────────────╮ │52 user, │ │53 repo, │ │54 issue, │ │55 + comment, │ │56 }; │ │57 │ │58 // a null payload deletes the record│ ╰────────────────────────────────────────╯ ╭────────────────────────────────────╮ │60 user: ?User, │ │61 repo: ?Repo, │ │62 issue: ?Issue, │ │63 + comment: ?Comment, │ │64 }; │ │65 │ │66 pub const EventWithId = struct {│ ╰────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │112 else │ │113 null, │ │114 }, │ │115 + .comment => .{ │ │116 + .comment = if (json_event.data) |value| │ │117 + try std.json.parseFromValueLeaky(Comment, arena.allocator(), value, .{ .ignore_unknown_fields = true })│ │118 + else │ │119 + null, │ │120 + }, │ │121 }, │ │122 }; │ │123 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │631 } else null; │ │632 try Issue.consume(DB, repo_opts.hash, haxy_moment, &current_event_id, record_maybe, &arena, &repo_event_oid); │ │633 }, │ │634 + .comment => |event_maybe| { │ │635 + const record_maybe: ?Comment.Record = if (event_maybe) |event| .{ │ │636 + .event = event, │ │637 + .author_email = authorEmail(commit_object.content.commit.metadata.author orelse ""), │ │638 + .created_ts = created_ts, │ │639 + } else null; │ │640 + try Comment.consume(DB, repo_opts.hash, haxy_moment, &current_event_id, record_maybe, &arena, &repo_event_oid);│ │641 + }, │ │642 } │ │643 } │ │644 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ added ──────────────╮ │src/event/Comment.zig│ ╰─────────────────────╯ ╭ changed ──╮ │src/try.zig│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │677 } │ │678 │ │679 try evt.consume(.xit, .{}, io, allocator, &template_repo, evt.events_ref, &.{}); │ │680 + │ │681 + // seed a small comment tree on the second-newest issue │ │682 + var comment_ids: [5][evt.event_id_size]u8 = undefined; │ │683 + for (&comment_ids) |*id| id.* = evt.EventWithId.randomId(prng.random()); │ │684 + │ │685 + const comment_bodies = [_][]const u8{ │ │686 + "I can take this. The compatibility scanner already reports which repositories still use the legacy format.", │ │687 + "Can we keep loading legacy plugins for one release after the warning lands? That would give downstream maintainers time to migrate.",│ │688 + "That sounds good. I'll include the scanner output in the warning so each affected plugin is named.", │ │689 + "Please include the replacement manifest path too. That should make the warning actionable without opening the migration guide.", │ │690 + "I'll add release-note text once the warning format is settled.", │ │691 + }; │ │692 + │ │693 + var comment_events: [comment_ids.len]evt.EventWithId = undefined; │ │694 + for (&comment_events, 0..) |*event, i| { │ │695 + event.* = .{ │ │696 + .id = std.fmt.bytesToHex(comment_ids[i], .lower), │ │697 + .timestamp = @intCast(200 + i), │ │698 + .author_email = user_data[(i + 1) % user_data.len].email, │ │699 + .event = .{ .comment = .{ │ │700 + .thread_id = issue_events[issue_events.len - 2].id, │ │701 + .parent_id = switch (i) { │ │702 + 0, 1 => issue_events[issue_events.len - 2].id, │ │703 + 2, 4 => std.fmt.bytesToHex(comment_ids[0], .lower), │ │704 + 3 => std.fmt.bytesToHex(comment_ids[2], .lower), │ │705 + else => unreachable, │ │706 + }, │ │707 + .body = comment_bodies[i], │ │708 + } }, │ │709 + }; │ │710 + } │ │711 + try evt.consume(.xit, .{}, io, allocator, &template_repo, evt.events_ref, &comment_events); │ │712 } │ │713 │ │714 // copy the template to each repo's on-disk location, named by its │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯