Event log: show only the events with a failed or a pending delivery (closes #390)
check / check (push) Failing after 1m6s

The event log gains three links above the list: All, Failed (N) and Pending (N), carried in a `show` query parameter (`failed`, `pending`); any other value shows every event. Failed lists the events with at least one failed delivery, Pending those with one pending or retrying, under the same 50-row limit and newest-first order as the full list. Events are picked by their deliveries' status through `idx_deliveries_status`; each count is the number of distinct matching events, read from the deliveries alone, and can exceed the 50 shown. An empty filtered list says that no event matches. The README and the comments that name the query parameters the service reads now include `show`.

Model: opus-5-5
This commit is contained in:
2026-10-03 01:57:20 +00:00
parent ea8384f4a2
commit 8afe923332
10 changed files with 337 additions and 33 deletions
@@ -92,6 +92,8 @@ func TestEventTierQueriesUseTheirIndexes(t *testing.T) {
var (
deliveries []database.Delivery
results []database.DeliveryResult
events []database.Event
count int64
depths []struct{ Depth int }
removed []database.TargetTotals
)
@@ -123,6 +125,23 @@ func TestEventTierQueriesUseTheirIndexes(t *testing.T) {
Order("attempt_num ASC").Find(&results),
"idx_delivery_results_delivery_id (delivery_id=? AND deleted_at=?)")
// The event log's Failed and Pending lists, of the events with a
// delivery in given statuses, and their counts (eventsWithStatus,
// countEventsWithStatus).
pending := []database.DeliveryStatus{
database.DeliveryStatusPending,
database.DeliveryStatusRetrying,
}
assertPlanUses(t, db, dry.Model(&database.Event{}).
Where("webhook_id = ?", ids[0]).
Where("id IN (?)", dry.Model(&database.Delivery{}).
Select("event_id").Where("status IN ?", pending)).
Order("created_at DESC").Limit(50).Find(&events), byStatus)
assertPlanUses(t, db, dry.Model(&database.Delivery{}).
Distinct("event_id").Where("status IN ?", pending).Count(&count),
byStatus)
// Retention (reapExpired, deleteEvents): one batch of expired
// events, then their attempts, deliveries and the events.
var expired []string