refactor(verify): give the javascript verifiers' roots to VerifierFixture (#11068)

* refactor(verify): give the javascript verifiers' roots to VerifierFixture

VerifierFixture.retain(reason) keeps a root that an owned command whose
cleanup is incomplete may still use, replacing each verifier's local
retain flag and cleanup closure.

* refactor(verify): give the Ghidra COM, DOS, 6502, NativeAOT and raw verifiers' workspaces to VerifierFixture (#11070)

* refactor(verify): give the Ghidra COM, DOS, 6502, NativeAOT and raw verifiers' workspaces to VerifierFixture

* refactor(verify): keep the Ghidra decompiler-failure, decompile-timeout and no-return workspaces through VerifierFixture until owned cleanup is verified (#11077)
This commit is contained in:
morluto authored and GitHub committed 2026-11-15 19:52:38 +08:00
1 parent ecab89f3e6
commit 47d14d0fb8
17 files changed
+329 -295

No files matched your search

+10 -18
View File
@@ -11,7 +11,7 @@ import { Client } from "@modelcontextprotocol/client";
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
import { artifactCliEvidence } from "../../lib/artifact-e2e.mjs";
import { withVerifierCleanup } from "../../lib/verifier-cleanup.mjs";
import { PrivateRuntimeRoot } from "../../../dist/process/PrivateRuntimeRoot.js";
import { VerifierFixture } from "../../lib/verifier-fixture.mjs";
import {
OwnedCommandFailure,
runOwnedCommand,
@@ -82,7 +82,6 @@ const normalize = (rows) =>
),
}));
let temporary;
let retainTemporary = false;
await withVerifierCleanup(async () => {
await client.connect(transport);
transport.stderr?.resume();
@@ -266,7 +265,7 @@ await withVerifierCleanup(async () => {
}
let cliParity = null;
if (values["cli-parity"]) {
temporary = await PrivateRuntimeRoot.create({
temporary = await VerifierFixture.open({
prefix: "rea-module-reference-verifier-",
});
const bundlePath = join(temporary.path, "bundle.json");
@@ -312,7 +311,7 @@ await withVerifierCleanup(async () => {
}
let tokenCosts = null;
if (values["tokenizer-python"]) {
temporary ??= await PrivateRuntimeRoot.create({
temporary ??= await VerifierFixture.open({
prefix: "rea-module-reference-verifier-",
});
const input = join(temporary.path, "token-input.json");
@@ -357,9 +356,13 @@ print(json.dumps(dict(tokenizer='cl100k_base',tiktoken_version=tiktoken.__versio
// An incomplete cleanup carries its supervisor and identity resources in
// the error. Preserve its private files for that owner instead of erasing
// recovery data while a command may still be using it.
retainTemporary =
if (
cause instanceof OwnedCommandFailure &&
cause.cleanupOwner !== undefined;
cause.cleanupOwner !== undefined
)
temporary.retain(
`Command cleanup is incomplete; retaining its private input/Evidence files at ${temporary.path}.`,
);
throw new Error(
"Token accounting failed; inspect the owned-command outcome and cleanup status.",
{ cause },
@@ -392,15 +395,4 @@ print(json.dumps(dict(tokenizer='cl100k_base',tiktoken_version=tiktoken.__versio
"First query is after shared artifact analysis; subsequent queries share one MCP session. Legacy item reads are serial; a concurrent legacy baseline is unmeasured. Filesystem/build warmness uncontrolled. Token costs count one post-change catalog, preparation request/summary and each request/structured reply once; client rendering, replay, reasoning, final answer and model latency are unmeasured. Preparation and parity/tokenization overhead are outside per-query elapsed times; external family-resource receipts include the complete verifier and children.",
})}\n`,
);
}, [
() => client.close(),
() => transport.close(),
async () => {
if (temporary === undefined) return;
if (retainTemporary)
throw new Error(
`Command cleanup is incomplete; retaining its private input/Evidence files at ${temporary.path}.`,
);
await temporary.close();
},
]);
}, [() => client.close(), () => transport.close(), () => temporary?.release()]);