Repository navigation
stewards: wire the evidence reader into the Job-failure triage path (BB-419) - #465
Conversation
…BB-419) The Alertmanager ops look now reads the real evidence reader for a firing KubeJobFailed alert in a pilot namespace and composes the three-heading reply (or the labelled "evidence unavailable" path). The occurrence is claimed before the read (the write-before-post record), so a duplicate delivery composes at most once. The pilot is off unless the role lists an `ops.alertmanager.evidence` namespace; the Slack post is BB-420, so this stops at composing and recording the occurrence. - roles/config: `alertmanager.evidence`, the pilot namespaces; empty is off. - store: a `triage_occurrences` table and the atomic claim. - server: `triageJobAlerts` on the Alertmanager reconcile, with the ambient kubectl behind the untouched `evidenceKubectlRefusal`. - triage: `prepareTriage`, the compose-only path `runTriage` is built on. - tests: fakes for the reader and kubectl. No Slack or hooks endpoint is called. No credential, kubeconfig, RBAC, backend.json or kploy change, and `evidenceKubectlRefusal` is untouched.
|
Independent review running in bb thread @thread:thr_pfmfbsmd8w. — from bb thread thr_3epqnnsqsn |
Review round 1 (GLM-5.3, at ec328f2)Owner review required: yes — the diff adds a key to the roles parsing ( ProductThe change turns the merged-but-uncalled triage library (#461, #464) into a live background path: each Alertmanager look now composes the three-heading reply for a firing Tested
Looks good. — from bb thread thr_pfmfbsmd8w |
|
Approved ec328f2 from the Stewards page |
|
Merged: owner-reviewed lane, reviewer approved ec328f2, checks green, approved by the owner, escalated by the reviewer to the owner. |
Implements BB-419. The Alertmanager ops look now reads the real
EvidenceReaderfor a firingKubeJobFailedalert in a pilot namespace and composes the three-heading reply (or the labelled "evidence unavailable" path). The occurrence is claimed before the read — the write-before-post record — so a duplicate delivery, a retry or two deliveries landing together compose at most once. The pilot is off unless the role listsops.alertmanager.evidence; the Slack post is BB-420, so this stops at composing and recording the occurrence.Sibling PR: none in this repo; the Slack half is BB-420 (hooks-service endpoints plus the bb-gate tag bump). The pilot's own
.bbopt-in (alertmanager.evidence) is a separate owner-reviewed change outside this repo.Classification
owner-reviewed: the change adds
evidenceto the roles parsing (plugins/stewards/roles.ts, the decide list's "roles parsing" entry,decide: user) and activates the ambient-kubectl evidence read in a live path, which the decide list's access entry ("widening what an existing one can reach") makes the owner's.bb-plugins/plugins/stewards/**is otherwise project-decided.evidenceKubectlRefusalandkubectlRefusalare untouched, and no new credential, kubeconfig, RBAC,backend.jsonor kploy change is made.What changes
config.ts/roles.ts:ops.alertmanager.evidence, the pilot namespaces whose failed-Job alerts get the reply and the only namespaces the reader may read. Empty is the off state; a role that watches Alertmanager for another namespace reads no evidence there. The legacyproject.jsonops path keeps it empty.store.ts: atriage_occurrencestable (project + occurrence key), an atomicclaimTriageOccurrence(the write-before-post record) andrecordTriageOccurrence. Append-only migration, hash appended tomigrations.snapshot.json.triage.ts:prepareTriage, the compose-only path (enabled, resolved/no-Job/no-namespace skips, the claim, the evidence read, the composer);runTriageis now this plus the Slack post. No behaviour change for the existing library.server.ts:triageJobAlertson the Alertmanager reconcile. For each firingKubeJobFailedfinding in a pilot namespace it reads the Job, its pods, Warning events, logs and the recent successful Jobs withcreateEvidenceReaderoverrunKubectl(the ambient identity, behind the strict allowlist), composes, and records the occurrence withposted_tsleft null. Nothing calls Slack or the hooks service.skills/stewards/SKILL.md: documents the new pilot field.Testing
plugins/stewards:npm run typecheckpass;npm testpass (62 files, 2616 tests; the plugin is not in the CI matrix).server.test.ts(new): aKubeJobFailedalert in a pilot namespace composes the three headings from a fake kubectl and records the occurrence once; a repeated firing reads no evidence a second time; an empty pilot list reads nothing and leaves the Alertmanager watch unchanged; a forbidden log read is labelled "could not be read" and still composes.triage.test.ts:prepareTriagecomposes without a replier and claims once; resolved and non-Job alerts skip without claiming.store.test.ts: the claim is durable (a second claim is false), the composed text andposted_tsare stored separately, and each project's occurrence is its own.config.test.ts: the pilot parses on the definition and the effective role, defaults off, and refuses a bad namespace..bbopt-in and the owner's server.