Show an event's entrypoint and request headers (closes #389)
check / check (push) Successful in 3m13s

An expanded event in the event log and the event's own page now show
the entrypoint the event arrived at (its description, "Entrypoint"
when it has none, or "deleted entrypoint"; never its URL), or for a
resubmitted copy the one its original arrived at, and the request
headers, one per line, sorted by name, whitespace kept. The event log
leaves out headers that hold more than the body's 32 KiB limit, stored
or as lines, and links to the event's page, which shows them all.
Both pages draw them through one shared template, event_request.html,
and read the webhook's entrypoints once per page.

Model: opus-5-5
This commit is contained in:
2026-10-03 02:29:51 +00:00
parent 74a96b2226
commit ce13e42eda
9 changed files with 452 additions and 18 deletions
+21 -3
View File
@@ -1231,13 +1231,16 @@ func (h *Handlers) loadEventsWithDeliveries(
result, ok := h.eventLogViews(
w, r, webhookDB, webhook.ID, rows, targetMap,
maxRenderedBodyBytes,
)
return result, totalEvents, ok
}
// eventLogViews projects loaded events for rendering, each with
// its deliveries and how many times it has been resubmitted. Like
// its deliveries, how many times it has been resubmitted and the
// entrypoint it arrived at, and with its request headers only when
// their lines hold at most maxHeaderBytes. Like
// loadEventsWithDeliveries, it reports false once it has answered
// the request with an error.
func (h *Handlers) eventLogViews(
@@ -1247,6 +1250,7 @@ func (h *Handlers) eventLogViews(
webhookID string,
rows []eventLogRow,
targetMap map[string]eventLogTarget,
maxHeaderBytes int,
) ([]EventLogView, bool) {
result := make([]EventLogView, len(rows))
eventDeliveries := make([][]database.Delivery, len(rows))
@@ -1256,7 +1260,7 @@ func (h *Handlers) eventLogViews(
eventIDs := make([]string, len(rows))
for i := range rows {
result[i] = rows[i].view(webhookID)
result[i] = rows[i].view(webhookID, maxHeaderBytes)
eventIDs[i] = rows[i].ID
webhookDB.Where(
@@ -1290,11 +1294,25 @@ func (h *Handlers) eventLogViews(
return nil, false
}
entrypoints, err := h.entrypointNames(webhookID)
if err != nil {
h.serverError(w, r, "failed to load entrypoints", err)
return nil, false
}
for i := range rows {
result[i].Deliveries = h.newDeliveryViews(
eventDeliveries[i], targetMap, attempts,
)
result[i].ResubmitCount = resubmits[rows[i].ID]
name, ok := entrypoints[rows[i].EntrypointID]
if !ok {
name = "deleted entrypoint"
}
result[i].Entrypoint = name
}
return result, true
@@ -1315,7 +1333,7 @@ func loadEventLogRows(
var rows []eventLogRow
webhookDB.Model(&database.Event{}).Select(
eventLogColumns, maxRenderedBodyBytes,
eventLogColumns, maxRenderedBodyBytes, maxRenderedBodyBytes,
).Where(
"webhook_id = ?", webhookID,
).Order("created_at DESC").Limit(recentEventLimit).Find(&rows)