What changed before this? on every incident, ranked

- A card on the incident page, and GET /api/incidents/:id/before and /api/v1/incidents/:id/before: what the app knows happened in the 30 min to 24 h before an alert began (audit log, maintenance windows, update runs and patch plans, other alerts, a step in the server's own figures), scored by how related, what kind and how close
- A host going down is shown once; Likely, Possible and Background; at most ten
- Docs and roles updated

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-21 20:25:45 +02:00
1 parent c2e76262ca
commit 0277126add
12 files changed
+887

No files matched your search

+3
View File
@@ -218,6 +218,9 @@ describe("what a token can read", () => {
const incidents = (await (await api("/incidents?status=resolved", secret)).json()) as any;
assert.equal(incidents.incidents.length, 1);
assert.equal(((await (await api(`/incidents/${incidents.incidents[0].id}`, secret)).json()) as any).incident?.id ?? incidents.incidents[0].id, incidents.incidents[0].id);
const before = (await (await api(`/incidents/${incidents.incidents[0].id}/before?minutes=30`, secret)).json()) as any;
assert.deepEqual([before.incidentId, before.windowMinutes, Array.isArray(before.suspects)], [incidents.incidents[0].id, 30, true], "what changed before it, over the same token");
assert.equal((await api("/incidents/999999/before", secret)).status, 404);
const open = ((await (await api("/incidents?status=open", secret)).json()) as any).incidents;
assert.deepEqual(open.map((i: any) => i.alertKey), [`offline:offline:server:${ids.db}`], "the quiet server's alert is an incident that is still open");