patchwork-os 1.2.0-beta.3.canary.929 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/dist/maintenance/cronHaltGate.d.ts +93 -0
- package/dist/maintenance/cronHaltGate.js +185 -0
- package/dist/maintenance/cronHaltGate.js.map +1 -0
- package/dist/maintenance/sweepCollect.d.ts +13 -1
- package/dist/maintenance/sweepCollect.js +25 -1
- package/dist/maintenance/sweepCollect.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4433,8 +4433,10 @@ if (process.argv[2] === "sweep") {
|
|
|
4433
4433
|
"What MOVED since the last sweep. Composes doctor, workers validate,\n" +
|
|
4434
4434
|
"evidence, privacy undeclared and pr-outcomes into one reading, appends it\n" +
|
|
4435
4435
|
"to sweep_snapshots.jsonl, and diffs it against the previous one.\n\n" +
|
|
4436
|
-
"
|
|
4437
|
-
"freshness
|
|
4436
|
+
"Three of the readings are GATES and can fail this command: deployment\n" +
|
|
4437
|
+
"freshness, worker-manifest validity, and a cron recipe that ran done for\n" +
|
|
4438
|
+
"7+ days and whose latest 6+ runs are all error (a flip also writes one\n" +
|
|
4439
|
+
"inbox note naming the recipe). Everything else is drift and is\n" +
|
|
4438
4440
|
"reported without failing — the evidence ratios fall by construction as\n" +
|
|
4439
4441
|
"ledgers accrue rows, and an undeclared agent step is ADR-0021's documented\n" +
|
|
4440
4442
|
"default. Wiring those to an exit code would make sweep permanently red,\n" +
|
|
@@ -4453,7 +4455,8 @@ if (process.argv[2] === "sweep") {
|
|
|
4453
4455
|
}
|
|
4454
4456
|
(async () => {
|
|
4455
4457
|
try {
|
|
4456
|
-
const { collectSweep } = await import("./maintenance/sweepCollect.js");
|
|
4458
|
+
const { collectCronHalts, collectSweep } = await import("./maintenance/sweepCollect.js");
|
|
4459
|
+
const { noteCronHaltFlip } = await import("./maintenance/cronHaltGate.js");
|
|
4457
4460
|
const { appendSnapshot, diffReadings, formatSweep, readLastSnapshot } = await import("./maintenance/sweep.js");
|
|
4458
4461
|
const { patchworkHome } = await import("./patchworkHome.js");
|
|
4459
4462
|
const dirIdx = args.indexOf("--dir");
|
|
@@ -4472,14 +4475,31 @@ if (process.argv[2] === "sweep") {
|
|
|
4472
4475
|
// Read the previous snapshot BEFORE appending this one, or the diff
|
|
4473
4476
|
// compares the reading against itself and every sweep reports nothing.
|
|
4474
4477
|
const previous = readLastSnapshot(dir);
|
|
4478
|
+
const now = Date.now();
|
|
4479
|
+
const cronHalts = collectCronHalts(dir, now);
|
|
4475
4480
|
const reading = collectSweep({
|
|
4476
4481
|
dir: dir,
|
|
4482
|
+
now,
|
|
4483
|
+
...(cronHalts !== undefined ? { cronHalts } : {}),
|
|
4477
4484
|
...(expectRunning !== undefined ? { expectRunning } : {}),
|
|
4478
4485
|
});
|
|
4479
4486
|
const delta = diffReadings(previous, reading);
|
|
4480
4487
|
const wrote = !args.includes("--no-write");
|
|
4481
4488
|
if (wrote)
|
|
4482
4489
|
appendSnapshot(dir, reading);
|
|
4490
|
+
// The recipe name lives in the inbox note, never in the snapshot. One
|
|
4491
|
+
// note per FLIP: a gate that stays unhealthy produces no delta.
|
|
4492
|
+
const note = cronHalts !== undefined
|
|
4493
|
+
? noteCronHaltFlip({
|
|
4494
|
+
delta,
|
|
4495
|
+
assessment: cronHalts,
|
|
4496
|
+
inbox: path.join(dir, "inbox"),
|
|
4497
|
+
now,
|
|
4498
|
+
})
|
|
4499
|
+
: undefined;
|
|
4500
|
+
if (note && !args.includes("--json")) {
|
|
4501
|
+
process.stderr.write(`[sweep] inbox note written: ${note}\n`);
|
|
4502
|
+
}
|
|
4483
4503
|
process.stdout.write(args.includes("--json")
|
|
4484
4504
|
? `${JSON.stringify({ reading, delta }, null, 2)}\n`
|
|
4485
4505
|
: formatSweep(reading, delta, { wrote }));
|