From b82ae1962f8e105237bfec6ed8efa960be68f94b Mon Sep 17 00:00:00 2001 From: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Date: Mon, 19 Oct 2026 13:40:12 +0000 Subject: [PATCH] test(ci): verify decoded historical PID controls before tracing --- scripts/verify/recorded-crash/trace-client.mjs | 10 +++++++++- scripts/verify/recorded-crash/trace.mjs | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/scripts/verify/recorded-crash/trace-client.mjs b/scripts/verify/recorded-crash/trace-client.mjs index f38f1d6cf..43ae3b8f7 100644 --- a/scripts/verify/recorded-crash/trace-client.mjs +++ b/scripts/verify/recorded-crash/trace-client.mjs @@ -1,11 +1,19 @@ import { connectRecordedCrash } from "./public.mjs"; +import assert from "node:assert/strict"; const session = await connectRecordedCrash({ entrypoint: process.argv[2], environment: process.env, }); try { - await session.inspect("mcp", process.argv[3], { debuggerContext: true }); + const report = await session.inspect("mcp", process.argv[3], { + debuggerContext: true, + }); + const historicalPid = Number(process.argv[4]); + assert.ok( + report.threads.some((thread) => thread.historical_pid === historicalPid), + "MCP must decode the selected historical-PID control before its trace qualifies", + ); } finally { await session.close(); } diff --git a/scripts/verify/recorded-crash/trace.mjs b/scripts/verify/recorded-crash/trace.mjs index 87324546d..de777c3d6 100644 --- a/scripts/verify/recorded-crash/trace.mjs +++ b/scripts/verify/recorded-crash/trace.mjs @@ -3,6 +3,7 @@ import { readdir, readFile, realpath } from "node:fs/promises"; import { fileURLToPath } from "node:url"; import { isAbsolute, join, resolve } from "node:path"; import { runOwnedCommand } from "../../../dist/process/OwnedCommand.js"; +import { parseEvidence } from "../../../dist/domain/evidence.js"; import { assertHistoricalPidReads, nodeInventoryThreads, @@ -50,8 +51,9 @@ export async function verifyCoreInspectionTrace({ fileURLToPath(new URL("./trace-client.mjs", import.meta.url)), entrypoint, core, + String(historicalPid), ]; - await runOwnedCommand( + const result = await runOwnedCommand( { command: environment.REA_VERIFY_STRACE_COMMAND, arguments: [ @@ -73,6 +75,17 @@ export async function verifyCoreInspectionTrace({ }, { timeoutMs: 90_000, diagnosticBytes: 1024 * 1024 }, ); + if (mode === "cli") { + const report = parseEvidence( + JSON.parse(result.stdout.text), + ).normalized_result; + assert.ok( + report.threads.some( + (thread) => thread.historical_pid === historicalPid, + ), + "CLI must decode the selected historical-PID control before its trace qualifies", + ); + } const executions = []; const ownershipReads = []; let gdbObserved = false;