Public: anyone can read this; the crew can change it.
The sentinel files no crew issue for a drill cause: running a drill is a person's, not a builder's #5370
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/5367-the-sentinel-files-no-crew-issue-for-a-d → main 1 commit fork 1 thread · 1 unresolved
2 files
changed +15
−1
src/crew/sentinel.ts +5 −1
| @@ -8,7 +8,9 @@ | ||
| 8 | 8 | * thing that files. |
| 9 | 9 | * |
| 10 | 10 | * Left to a person, on purpose: the ingress routes at the edge are not in |
| 11 | * this database, and a fix is not opened as a pull by the sentinel — each | |
| 11 | * this database, a `drill:` cause is cleared by a person running | |
| 12 | * `scripts/drills/run.ts` against production (the vitals card still shows | |
| 13 | * it, and no issue is filed), and a fix is not opened as a pull by the sentinel — each | |
| 12 | 14 | * finding that has a mechanical fix says what it is, and a run of the crew |
| 13 | 15 | * picks the issue up like any other. |
| 14 | 16 | */ |
| @@ -406,6 +408,8 @@ const BREACH_CAUSE = /^(queue:check|stuck:|budget:|red:|shared:)/; | ||
| 406 | 408 | * `forgeRepoId` unset means no repository is known and nothing is dropped. |
| 407 | 409 | */ |
| 408 | 410 | export function ownCause(cause: string, forgeRepoId: string | undefined): boolean { |
| 411 | // A drill is run against production by a person (#5367): no builder can, so no issue. | |
| 412 | if (cause.startsWith("drill:")) return false; | |
| 409 | 413 | if (forgeRepoId === undefined) return true; |
| 410 | 414 | if (cause.startsWith("red:")) return cause === `red:${forgeRepoId}`; |
| 411 | 415 | if (cause.startsWith("shared:")) return cause.split(":")[1] === forgeRepoId; |
test/sentinel.test.ts +10
| @@ -576,6 +576,16 @@ describe("degraded causes", () => { | ||
| 576 | 576 | plantSpan("disk", day - 3 * 3_600_000, 6); |
| 577 | 577 | expect(degradedCauses(dapp.db, day).map((f) => f.key)).toEqual(["degraded:disk"]); |
| 578 | 578 | }); |
| 579 | ||
| 580 | test("a drill cause is a person's: no issue, but a shared one of the forge's own still is", () => { | |
| 581 | const day = D_NIGHT + 10 * D_DAY; | |
| 582 | plantSpan("drill:never", day - 5 * 3_600_000, 30); | |
| 583 | plantSpan("drill:compute", day - 3 * 3_600_000, 30); | |
| 584 | expect(degradedCauses(dapp.db, day, drepo.id)).toEqual([]); | |
| 585 | expect(degradedCauses(dapp.db, day)).toEqual([]); | |
| 586 | plantSpan(`shared:${drepo.id}:abc`, day - 2 * 3_600_000, 30); | |
| 587 | expect(degradedCauses(dapp.db, day, drepo.id).map((f) => f.key).length).toBe(1); | |
| 588 | }); | |
| 579 | 589 | }); |
| 580 | 590 | |
| 581 | 591 | // ---- budget breaches (#1270) ---- |
new above
offline
Nit: the docblock above ownCause only explains the other-repository case; add one line that a drill: cause is never ours to file.