Public: anyone can read this; the crew can change it.
Sentinel: backup was degraded 14 minutes today: The last restore drill 2026-12-06 failed at restore. The backup check last ran 2026-12-06T09:25:52.363Z (1 min ago); 39… #18407
Merged 2h 18m ago, live in production
scout/forge:scout/18403-sentinel-backup-was-degraded-14-minutes → main 0 commits fork 1 thread · 1 unresolved
3 files
changed +7
−27
src/snapshot/drill_job.ts −16
| @@ -108,22 +108,6 @@ export function sweepDrills( | ||
| 108 | 108 | return { cut, removed }; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | /** The record of a drill a restart cut: red, and saying so. */ | |
| 112 | export function cutDrill(cut: { id: string; at: string }): DrillResult { | |
| 113 | return { | |
| 114 | at: cut.at || new Date().toISOString(), | |
| 115 | snapshotId: null, | |
| 116 | ms: 0, | |
| 117 | counts: { repositories: 0, issues: 0, users: 0, pulls: 0, apps: 0 }, | |
| 118 | health: "unreached", | |
| 119 | verdict: "red", | |
| 120 | failedStep: "restore", | |
| 121 | phases: [], | |
| 122 | budgetMs: 0, | |
| 123 | reason: `drill ${cut.id} was cut by a restart; it is started again`, | |
| 124 | }; | |
| 125 | } | |
| 126 | ||
| 127 | 111 | /** |
| 128 | 112 | * The red result of a drill whose process gave none: the cause is the reason, and its cost is kept. |
| 129 | 113 | */ |
src/snapshot/service.ts +4 −3
| @@ -35,7 +35,7 @@ import { watchBucket } from "./bucket.ts"; | ||
| 35 | 35 | import { makeKit, recordOutside, runOutsideDrill, type Kit, type OutsideDrill } from "./kit.ts"; |
| 36 | 36 | import { readDeclaredLanes } from "./lanes.ts"; |
| 37 | 37 | import { lastDrill, recordDrill } from "./drills.ts"; |
| 38 | import { cutDrill, runDrillInChild, sweepDrills, type DrillState } from "./drill_job.ts"; | |
| 38 | import { runDrillInChild, sweepDrills, type DrillState } from "./drill_job.ts"; | |
| 39 | 39 | import { lastMirror, mirrorOffThread, mirrorTarget, MIRROR_EVERY_MS, recordMirror, type MirrorState } from "./mirror.ts"; |
| 40 | 40 | import { isOffBox } from "./off_box.ts"; |
| 41 | 41 | import { failureCause } from "./cause.ts"; |
| @@ -672,8 +672,9 @@ export function startSnapshots( | ||
| 672 | 672 | const swept = sweepDrills(app.config.dataDir); |
| 673 | 673 | if (swept.cut !== undefined) { |
| 674 | 674 | cutAtBoot = true; |
| 675 | recordDrill(app.db, cutDrill(swept.cut)); | |
| 676 | log.warn("restore drill was cut by a restart; recorded, and started again", { id: swept.cut.id }); | |
| 675 | // Not recorded: a deploy cutting a drill says nothing of the backup, and a red row would | |
| 676 | // hold it degraded until the drill started again (#18403). The last real verdict stands. | |
| 677 | log.warn("restore drill was cut by a restart; started again", { id: swept.cut.id }); | |
| 677 | 678 | } |
| 678 | 679 | if (swept.removed > 0) log.info("restore drill scratch swept", { directories: swept.removed }); |
| 679 | 680 | } catch (error) { |
test/drill-job.test.ts +3 −8
| @@ -7,7 +7,7 @@ import { createApp } from "../src/app.ts"; | ||
| 7 | 7 | import { judge, type LaneRead } from "../src/snapshot/bucket.ts"; |
| 8 | 8 | import type { DrillResult } from "../src/snapshot/drill.ts"; |
| 9 | 9 | import type { DrillLine } from "../src/snapshot/drill_child.ts"; |
| 10 | import { cutDrill, drillMemoryLimit, markerLeft, residentBytes, runDrillInChild, scrubbed, sweepDrills } from "../src/snapshot/drill_job.ts"; | |
| 10 | import { drillMemoryLimit, markerLeft, residentBytes, runDrillInChild, scrubbed, sweepDrills } from "../src/snapshot/drill_job.ts"; | |
| 11 | 11 | import { costFacts, costLine, LIMIT_RULE } from "../src/snapshot/drill_cost.ts"; |
| 12 | 12 | import { lastDrill, parseCost, recordDrill } from "../src/snapshot/drills.ts"; |
| 13 | 13 | import { startSnapshots } from "../src/snapshot/service.ts"; |
| @@ -28,9 +28,6 @@ test("a boot sweeps every scratch directory and reports a drill the restart cut" | ||
| 28 | 28 | expect(swept.cut).toEqual({ id: "drill-1", at: "2026-11-14T09:10:00.000Z" }); |
| 29 | 29 | expect(existsSync(join(root, "drill", "restore-abc"))).toBe(false); |
| 30 | 30 | expect(markerLeft(root)).toBe(false); |
| 31 | const rec = cutDrill(swept.cut!); | |
| 32 | expect(rec.verdict).toBe("red"); | |
| 33 | expect(rec.reason).toContain("cut by a restart"); | |
| 34 | 31 | expect(sweepDrills(root)).toEqual({ cut: undefined, removed: 0 }); |
| 35 | 32 | }); |
| 36 | 33 | |
| @@ -217,15 +214,13 @@ test("the status says the proof's age and goes amber when the drill is days behi | ||
| 217 | 214 | expect(fresh.unknowns.join(" ")).not.toContain("not been proved"); |
| 218 | 215 | }); |
| 219 | 216 | |
| 220 | test("a restart mid-drill leaves a recorded outcome and no directory", async () => { | |
| 217 | test("a restart mid-drill leaves the last real verdict standing and no directory (#18403)", async () => { | |
| 221 | 218 | mkdirSync(join(root, "drill", "restore-x", "data"), { recursive: true }); |
| 222 | 219 | writeFileSync(join(root, "drill", "running.json"), JSON.stringify({ id: "drill-9", at: "2026-11-14T09:10:00.000Z" })); |
| 223 | 220 | const app = createApp({ dataDir: root, port: 0 }); |
| 224 | 221 | const svc = startSnapshots(app, dirStore(join(root, "store")), { version: "t", nightly: false }); |
| 225 | 222 | try { |
| 226 | const d = lastDrill(app.db); | |
| 227 | expect(d?.verdict).toBe("red"); | |
| 228 | expect(d?.reason).toContain("drill-9 was cut by a restart"); | |
| 223 | expect(lastDrill(app.db)).toBeUndefined(); | |
| 229 | 224 | expect(existsSync(join(root, "drill", "restore-x"))).toBe(false); |
| 230 | 225 | expect(markerLeft(root)).toBe(false); |
| 231 | 226 | } finally { |
new above
offline
Good: the cut is only logged. Next: a test that cutAtBoot makes the boot run drill() directly, so the last verdict is not left stale if this branch is ever changed.