fix: improve sentinel observer evidence

This commit is contained in:
Codex
2026-07-06 23:48:33 +00:00
parent 51058f4635
commit e0199e5515
6 changed files with 171 additions and 15 deletions
@@ -43,6 +43,35 @@ test("quick verify cleanup downgrades abandoned graceful stop when force stop co
assert.equal(findings[0]?.severity, "warning");
});
test("quick verify cleanup reads force-stop evidence from top-level CLI payload", () => {
const step = {
phase: "observe-stop-after-terminal",
ok: false,
payload: {
ok: true,
command: "web-probe-observe force-stop",
forced: true,
reason: "graceful-stop-not-consumed",
aliveBefore: true,
aliveAfter: false,
termSent: true,
killSent: true,
pendingAbandoned: 1,
processingAbandoned: 0,
valuesRedacted: true,
},
valuesRedacted: true,
};
const cleanup = classifyQuickVerifyCleanupStep(step);
const findings = quickVerifyCleanupFindings(step);
assert.equal(cleanup.cleanupClass, "bounded-force-stop");
assert.equal(cleanup.forceStopOk, true);
assert.equal(cleanup.aliveAfter, false);
assert.deepEqual(cleanup.evidenceSources, ["payload"]);
assert.equal(findings[0]?.id, "observer-graceful-stop-timeout-force-stop-succeeded");
});
test("quick verify cleanup emits process-alive code when force stop leaves observer alive", () => {
const step = forceStopStep({
aliveBefore: true,
@@ -76,6 +105,8 @@ test("quick verify cleanup emits evidence-gap code when stopped state cannot be
const findings = quickVerifyCleanupFindings(step);
assert.equal(cleanup.cleanupClass, "observer-stop-failed");
assert.equal(cleanup.aliveAfter, null);
assert.deepEqual(cleanup.missingEvidenceFields, ["aliveAfter"]);
assert.equal(findings.length, 1);
assert.equal(findings[0]?.id, "observer-cleanup-evidence-missing");
assert.match(String(findings[0]?.evidenceSummary), /missing=aliveAfter/u);
});