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

opened this

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

  • Merged. scout/18403-sentinel-backup-was-degraded-14-minutes was merged into main as 24f4503.

Review

Sign in to review this change.
3 files changed +7 −27
src/snapshot/drill_job.ts −16
@@ -108,22 +108,6 @@ export function sweepDrills(
108108 return { cut, removed };
109109 }
110110
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
127111 /**
128112 * The red result of a drill whose process gave none: the cause is the reason, and its cost is kept.
129113 */
src/snapshot/service.ts +4 −3
@@ -35,7 +35,7 @@ import { watchBucket } from "./bucket.ts";
3535 import { makeKit, recordOutside, runOutsideDrill, type Kit, type OutsideDrill } from "./kit.ts";
3636 import { readDeclaredLanes } from "./lanes.ts";
3737 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";
3939 import { lastMirror, mirrorOffThread, mirrorTarget, MIRROR_EVERY_MS, recordMirror, type MirrorState } from "./mirror.ts";
4040 import { isOffBox } from "./off_box.ts";
4141 import { failureCause } from "./cause.ts";
@@ -672,8 +672,9 @@ export function startSnapshots(
672672 const swept = sweepDrills(app.config.dataDir);
673673 if (swept.cut !== undefined) {
674674 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 });

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.

677678 }
678679 if (swept.removed > 0) log.info("restore drill scratch swept", { directories: swept.removed });
679680 } catch (error) {
test/drill-job.test.ts +3 −8
@@ -7,7 +7,7 @@ import { createApp } from "../src/app.ts";
77 import { judge, type LaneRead } from "../src/snapshot/bucket.ts";
88 import type { DrillResult } from "../src/snapshot/drill.ts";
99 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";
1111 import { costFacts, costLine, LIMIT_RULE } from "../src/snapshot/drill_cost.ts";
1212 import { lastDrill, parseCost, recordDrill } from "../src/snapshot/drills.ts";
1313 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"
2828 expect(swept.cut).toEqual({ id: "drill-1", at: "2026-11-14T09:10:00.000Z" });
2929 expect(existsSync(join(root, "drill", "restore-abc"))).toBe(false);
3030 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");
3431 expect(sweepDrills(root)).toEqual({ cut: undefined, removed: 0 });
3532 });
3633
@@ -217,15 +214,13 @@ test("the status says the proof's age and goes amber when the drill is days behi
217214 expect(fresh.unknowns.join(" ")).not.toContain("not been proved");
218215 });
219216
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 () => {
221218 mkdirSync(join(root, "drill", "restore-x", "data"), { recursive: true });
222219 writeFileSync(join(root, "drill", "running.json"), JSON.stringify({ id: "drill-9", at: "2026-11-14T09:10:00.000Z" }));
223220 const app = createApp({ dataDir: root, port: 0 });
224221 const svc = startSnapshots(app, dirStore(join(root, "store")), { version: "t", nightly: false });
225222 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();
229224 expect(existsSync(join(root, "drill", "restore-x"))).toBe(false);
230225 expect(markerLeft(root)).toBe(false);
231226 } finally {

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs