╭ changed ─────────────╮ │src/ui/Repo/Issues.zig│ ╰──────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────╮ │59 comptime repo_opts: rp.RepoOpts(repo_kind),│ │60 arena: *std.heap.ArenaAllocator, │ │61 repo: *rp.Repo(repo_kind, repo_opts), │ │62 + io: std.Io, │ │63 identity: []const u8, │ │64 tag: []const u8, │ │65 selected_id: []const u8, │ ╰───────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │66 ) !Self { │ │67 const empty = try emptyResult(arena.allocator(), identity, tag, selected_id);│ │67 - if (repo_kind == .git) return empty; │ │68 │ │69 const aa = arena.allocator(); │ │70 - const DB = rp.Repo(repo_kind, repo_opts).DB; │ │70 + const DB = evt.EventDB(repo_opts.hash); │ │71 const rooted = empty.selected_id.len != 0; │ │72 const tagged = empty.tag.len != 0; │ │73 // an explicitly named issue or tag that doesn't exist is a bad url │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │74 // (NotFound -> 404); the bare route falls through to an empty listing. │ │75 const strict = rooted or tagged; │ │76 │ │77 - // a repo with no consumed events has no moment yet. │ │78 - const haxy_moment = evt.currentMoment(repo_opts, repo) catch { │ │79 - if (strict) return error.NotFound; │ │80 - return empty; │ │77 + // a local repo's events live in the event db next to it (consumed from the │ │78 + // events branch at startup); a server repo has them consumed into its own │ │79 + // db. a repo with no consumed events has no moment yet. │ │80 + const gpa = arena.child_allocator; │ │81 + var event_db_maybe = try evt.LocalEventDB(repo_opts.hash).open(io, gpa, repo.core.repo_dir); │ │82 + defer if (event_db_maybe) |*event_db| event_db.deinit(io, gpa); │ │83 + const haxy_moment = blk: { │ │84 + if (event_db_maybe) |*event_db| break :blk evt.currentMomentFromDb(repo_opts.hash, event_db.db) catch {│ │85 + if (strict) return error.NotFound; │ │86 + return empty; │ │87 + }; │ │88 + if (repo_kind == .git) return empty; │ │89 + break :blk evt.currentMoment(repo_opts, repo) catch { │ │90 + if (strict) return error.NotFound; │ │91 + return empty; │ │92 + }; │ │93 }; │ │94 │ │95 // the ordered set to window: the tag's issue set when filtered, else the │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯