feat(process): bound a finalization interval before forced capture timeout
Add optional finalization_ms to keep observing a captured root after SIGTERM, record the actual finalizer exit and each signal attempt, and escalate once when needed. Bind the initial root identity to captured ownership and preserve observations through cleanup uncertainty. Fixes #1253. Co-authored-by: Mykola Dementiev <16836724+nikolay-dementiev@users.noreply.github.com> Co-authored-by: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com>
This commit is contained in:
co-authored by
Mykola Dementiev
N0zoM1z0
parent
1e51c732bb
commit
c1efa6467d
@@ -9,6 +9,7 @@ import { parseEvidence } from "../../../src/domain/evidence.js";
|
||||
import { compareProcessCaptures } from "../../../src/domain/process/processComparison.js";
|
||||
import { parseProcessCapture } from "../../../src/domain/process/processCaptureParsing.js";
|
||||
import { parseProcessScenario } from "../../../src/domain/process/processScenario.js";
|
||||
import { FINALIZED_PROCESS_CAPTURE_EXAMPLE } from "../../../src/domain/process/processCaptureExample.js";
|
||||
import { createServer } from "../../../src/server/createServer.js";
|
||||
import { createTestBinarySession } from "../../fixtures/binarySession.js";
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
@@ -60,6 +61,27 @@ const captureViaMcp = async (scenario: Record<string, unknown>) => {
|
||||
return evidence;
|
||||
};
|
||||
|
||||
it("documents a finalization scenario and exit record that match the contract", async () => {
|
||||
const document = await readFile("docs/process-capture.md", "utf8");
|
||||
const blocks = [
|
||||
...(document.split("### Finalization interval")[1] ?? "").matchAll(
|
||||
/```json\n([\s\S]*?)\n```/gu,
|
||||
),
|
||||
].map((match) => match[1]);
|
||||
const [scenario, exit] = blocks;
|
||||
if (scenario === undefined || exit === undefined)
|
||||
throw new Error("Missing finalization examples");
|
||||
|
||||
expect(
|
||||
parseProcessScenario(JSON.parse(scenario)).finalization_ms,
|
||||
"the documented scenario is accepted and carries the interval",
|
||||
).toBe(1_500);
|
||||
expect(
|
||||
JSON.parse(exit),
|
||||
"the documented exit record is the canonical finalized example",
|
||||
).toEqual(FINALIZED_PROCESS_CAPTURE_EXAMPLE.exit);
|
||||
});
|
||||
|
||||
itWithCaptureCapability.each(["cli", "mcp"] as const)(
|
||||
"hashes the documented complete report despite omitted terminal output through %s",
|
||||
async (adapter) => {
|
||||
|
||||
Reference in New Issue
Block a user