╭ changed ─────────╮ │src/test/event.zig│ ╰──────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │692 const conflicts = try Repo.DB.SortedMap(.read_only).init(conflicts_cursor); │ │693 try std.testing.expectEqual(1, try conflicts.count()); │ │694 │ │695 - const order_key = evt.orderKeyDesc(issue.created_ts, &issue_id); │ │695 + const order_key = evt.orderKeyDesc(issue.created_order, &issue_id); │ │696 const conflict_cursor = try conflicts.getCursor(&order_key) orelse return error.NotFound;│ │697 const conflict = try Repo.DB.HashMap(.read_only).init(conflict_cursor); │ │698 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────╮ │1172 │ │1173 try std.testing.expectEqual(1, try user_repos.count()); │ │1174 │ │1175 - // the set is keyed by orderKeyDesc([created-ts][event-id]) │ │1176 - const order_key = evt.orderKeyDesc(repo_event.created_ts, &repo_event_id); │ │1175 + // the set is keyed by orderKeyDesc([created-order][event-id]) │ │1176 + const order_key = evt.orderKeyDesc(repo_event.created_order, &repo_event_id);│ │1177 try std.testing.expect(try user_repos.contains(&order_key)); │ │1178 } │ │1179 │ ╰───────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1324 try std.testing.expectEqual(expected.len, try set.count()); │ │1325 for (expected, 0..) |id, i| { │ │1326 const kv = (try set.getIndexKeyValuePair(@intCast(i))) orelse return error.NotFound; │ │1327 - // the key is orderKeyDesc ([timestamp][event-id]); its trailing bytes are the id │ │1327 + // the key is orderKeyDesc ([created-order][event-id]); its trailing bytes are the id│ │1328 var order_key: [@sizeOf(u64) + evt.event_id_size]u8 = undefined; │ │1329 _ = try kv.key_cursor.readBytes(&order_key); │ │1330 try std.testing.expectEqualSlices(u8, id, order_key[@sizeOf(u64)..]); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1332 } │ │1333 }; │ │1334 │ │1335 - // one user, then four repos, each with its own creation timestamp (user@100, │ │1336 - // repos@101..104) │ │1335 + // one user, then four repos in creation order with deliberately skewed │ │1336 + // timestamps │ │1337 const events = [_]evt.EventWithId{ │ │1338 .{ .id = std.fmt.bytesToHex(user_id, .lower), .author = author, .timestamp = 100, .event = .{ .user = .{ .name = "alice", .email = "alice@example.test", .password_hash = pw } } },│ │1339 - .{ .id = std.fmt.bytesToHex(repo_ids[0], .lower), .author = author, .timestamp = 101, .event = .{ .repo = .{ .user_id = &user_id, .name = "repo0", .description = "d0" } } }, │ │1340 - .{ .id = std.fmt.bytesToHex(repo_ids[1], .lower), .author = author, .timestamp = 102, .event = .{ .repo = .{ .user_id = &user_id, .name = "repo1", .description = "d1" } } }, │ │1341 - .{ .id = std.fmt.bytesToHex(repo_ids[2], .lower), .author = author, .timestamp = 103, .event = .{ .repo = .{ .user_id = &user_id, .name = "repo2", .description = "d2" } } }, │ │1342 - .{ .id = std.fmt.bytesToHex(repo_ids[3], .lower), .author = author, .timestamp = 104, .event = .{ .repo = .{ .user_id = &user_id, .name = "repo3", .description = "d3" } } }, │ │1339 + .{ .id = std.fmt.bytesToHex(repo_ids[0], .lower), .author = author, .timestamp = 10_000, .event = .{ .repo = .{ .user_id = &user_id, .name = "repo0", .description = "d0" } } }, │ │1340 + .{ .id = std.fmt.bytesToHex(repo_ids[1], .lower), .author = author, .timestamp = 10, .event = .{ .repo = .{ .user_id = &user_id, .name = "repo1", .description = "d1" } } }, │ │1341 + .{ .id = std.fmt.bytesToHex(repo_ids[2], .lower), .author = author, .timestamp = 5_000, .event = .{ .repo = .{ .user_id = &user_id, .name = "repo2", .description = "d2" } } }, │ │1342 + .{ .id = std.fmt.bytesToHex(repo_ids[3], .lower), .author = author, .timestamp = 20, .event = .{ .repo = .{ .user_id = &user_id, .name = "repo3", .description = "d3" } } }, │ │1343 }; │ │1344 try evt.consume(.xit, repo_opts, io, allocator, &repo, evt.events_ref, &events); │ │1345 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯