fix(verify): reconcile PR-212/215/228 package E2E expectations
- Restore Linux hopper guards in scripts/verify-package.mjs so the packaged E2E handles the unsupported_hopper_build response on Linux. - Keep the config symlink lifecycle check from PR-225 by preserving the pre-existing `existing` key when the failure-recovery test rewrites the cursor symlink target. - Guard the packaged search command behind process.platform !== "linux". - Adapt MCP current/batch verification to the Linux "not supported for unattended Linux analysis" rejection.
This commit is contained in:
+127
-98
@@ -180,72 +180,88 @@ try {
|
|||||||
throw new Error("packaged artifact inventory CLI failed");
|
throw new Error("packaged artifact inventory CLI failed");
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
const investigationReplay = await verifyPackagedInvestigation({ cli, workspace, evidenceRoot, artifactArchive, environment });
|
const investigationReplay = await verifyPackagedInvestigation({ cli, workspace, evidenceRoot, artifactArchive, environment });
|
||||||
const overview = json(
|
if (process.platform === "linux") {
|
||||||
await run(cli, ["analyze", process.execPath, "--json"], environment),
|
const unsupportedExecution = await runWithStatus(
|
||||||
);
|
cli,
|
||||||
if (
|
["analyze", process.execPath, "--json"],
|
||||||
overview.operation !== "binary_overview" ||
|
environment,
|
||||||
overview.normalized_result?.procedure_count < 1
|
|
||||||
)
|
|
||||||
throw new Error(
|
|
||||||
`packaged Hopper-backed analyze CLI failed: ${JSON.stringify(overview)}`,
|
|
||||||
);
|
);
|
||||||
const inspected = json(
|
const unsupported = json(unsupportedExecution.stdout);
|
||||||
await run(
|
if (
|
||||||
cli,
|
unsupportedExecution.status !== 1 ||
|
||||||
[
|
unsupported.details?.failure_code !== "unsupported_hopper_build"
|
||||||
"inspect",
|
)
|
||||||
process.execPath,
|
throw new Error(
|
||||||
"--detail",
|
`packaged Linux Hopper verification did not fail closed: ${JSON.stringify(unsupported)}`,
|
||||||
"detailed",
|
);
|
||||||
"--limit",
|
} else {
|
||||||
"1",
|
const overview = json(
|
||||||
"--json",
|
await run(cli, ["analyze", process.execPath, "--json"], environment),
|
||||||
],
|
|
||||||
environment,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
if (
|
|
||||||
inspected.operation !== "binary_overview" ||
|
|
||||||
inspected.normalized_result?.detail !== "detailed"
|
|
||||||
)
|
|
||||||
throw new Error("packaged inspect CLI failed");
|
|
||||||
const functionResult = json(
|
|
||||||
await run(
|
|
||||||
cli,
|
|
||||||
["function", process.execPath, "0x1000", "--json"],
|
|
||||||
environment,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
if (
|
|
||||||
functionResult.operation !== "analyze_function" ||
|
|
||||||
functionResult.provider?.id !== "hopper" ||
|
|
||||||
functionResult.normalized_result?.procedure?.address !== "0x1000"
|
|
||||||
)
|
|
||||||
throw new Error(
|
|
||||||
`packaged function CLI failed: ${JSON.stringify(functionResult)}`,
|
|
||||||
);
|
);
|
||||||
const xrefs = json(
|
if (
|
||||||
await run(
|
overview.operation !== "binary_overview" ||
|
||||||
cli,
|
overview.normalized_result?.procedure_count < 1
|
||||||
["xrefs", process.execPath, "0x1000", "--json"],
|
)
|
||||||
environment,
|
throw new Error(
|
||||||
),
|
`packaged Hopper-backed analyze CLI failed: ${JSON.stringify(overview)}`,
|
||||||
);
|
);
|
||||||
if (
|
const inspected = json(
|
||||||
xrefs.operation !== "xrefs" ||
|
await run(
|
||||||
JSON.stringify(xrefs.normalized_result) !== JSON.stringify(["0x1000"])
|
cli,
|
||||||
)
|
[
|
||||||
throw new Error(`packaged xrefs CLI failed: ${JSON.stringify(xrefs)}`);
|
"inspect",
|
||||||
const trace = json(
|
process.execPath,
|
||||||
await run(
|
"--detail",
|
||||||
cli,
|
"detailed",
|
||||||
["trace", process.execPath, "fixture", "--json"],
|
"--limit",
|
||||||
environment,
|
"1",
|
||||||
),
|
"--json",
|
||||||
);
|
],
|
||||||
if (trace.operation !== "trace_feature")
|
environment,
|
||||||
throw new Error(`packaged trace CLI failed: ${JSON.stringify(trace)}`);
|
),
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
inspected.operation !== "binary_overview" ||
|
||||||
|
inspected.normalized_result?.detail !== "detailed"
|
||||||
|
)
|
||||||
|
throw new Error("packaged inspect CLI failed");
|
||||||
|
const functionResult = json(
|
||||||
|
await run(
|
||||||
|
cli,
|
||||||
|
["function", process.execPath, "0x1000", "--json"],
|
||||||
|
environment,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
functionResult.operation !== "analyze_function" ||
|
||||||
|
functionResult.provider?.id !== "hopper" ||
|
||||||
|
functionResult.normalized_result?.procedure?.address !== "0x1000"
|
||||||
|
)
|
||||||
|
throw new Error(
|
||||||
|
`packaged function CLI failed: ${JSON.stringify(functionResult)}`,
|
||||||
|
);
|
||||||
|
const xrefs = json(
|
||||||
|
await run(
|
||||||
|
cli,
|
||||||
|
["xrefs", process.execPath, "0x1000", "--json"],
|
||||||
|
environment,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
xrefs.operation !== "xrefs" ||
|
||||||
|
JSON.stringify(xrefs.normalized_result) !== JSON.stringify(["0x1000"])
|
||||||
|
)
|
||||||
|
throw new Error(`packaged xrefs CLI failed: ${JSON.stringify(xrefs)}`);
|
||||||
|
const trace = json(
|
||||||
|
await run(
|
||||||
|
cli,
|
||||||
|
["trace", process.execPath, "fixture", "--json"],
|
||||||
|
environment,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (trace.operation !== "trace_feature")
|
||||||
|
throw new Error(`packaged trace CLI failed: ${JSON.stringify(trace)}`);
|
||||||
|
}
|
||||||
const capabilities = json(
|
const capabilities = json(
|
||||||
await run(cli, ["capabilities", "--json"], environment),
|
await run(cli, ["capabilities", "--json"], environment),
|
||||||
);
|
);
|
||||||
@@ -257,20 +273,22 @@ try {
|
|||||||
providers.providers.some(({ id }) => typeof id !== "string")
|
providers.providers.some(({ id }) => typeof id !== "string")
|
||||||
)
|
)
|
||||||
throw new Error("packaged providers CLI failed");
|
throw new Error("packaged providers CLI failed");
|
||||||
const searchResult = json(
|
if (process.platform !== "linux") {
|
||||||
await run(
|
const searchResult = json(
|
||||||
cli,
|
await run(
|
||||||
["search", process.execPath, "fixture", "--json"],
|
cli,
|
||||||
environment,
|
["search", process.execPath, "fixture", "--json"],
|
||||||
),
|
environment,
|
||||||
);
|
),
|
||||||
if (
|
|
||||||
searchResult.operation !== "search_strings" ||
|
|
||||||
searchResult.normalized_result?.items?.length !== 1
|
|
||||||
)
|
|
||||||
throw new Error(
|
|
||||||
`packaged search CLI failed: ${JSON.stringify(searchResult)}`,
|
|
||||||
);
|
);
|
||||||
|
if (
|
||||||
|
searchResult.operation !== "search_strings" ||
|
||||||
|
searchResult.normalized_result?.items?.length !== 1
|
||||||
|
)
|
||||||
|
throw new Error(
|
||||||
|
`packaged search CLI failed: ${JSON.stringify(searchResult)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
const referenceImport = json(
|
const referenceImport = json(
|
||||||
await run(
|
await run(
|
||||||
cli,
|
cli,
|
||||||
@@ -450,7 +468,7 @@ try {
|
|||||||
throw new Error("packaged stale-skill upgrade was not isolated");
|
throw new Error("packaged stale-skill upgrade was not isolated");
|
||||||
|
|
||||||
await writeFile(claudeConfig, "malformed");
|
await writeFile(claudeConfig, "malformed");
|
||||||
await writeFile(cursorConfig, "{}\n");
|
await writeFile(cursorConfig, '{"existing":true}\n');
|
||||||
const failedExecution = await runWithStatus(
|
const failedExecution = await runWithStatus(
|
||||||
cli,
|
cli,
|
||||||
["setup", "--yes", "--json"],
|
["setup", "--yes", "--json"],
|
||||||
@@ -600,30 +618,41 @@ try {
|
|||||||
);
|
);
|
||||||
if (opened.isError === true)
|
if (opened.isError === true)
|
||||||
throw new Error("packaged MCP could not open a binary");
|
throw new Error("packaged MCP could not open a binary");
|
||||||
await prompts.verifyPromptCompletion(client, mcpOptions, true);
|
await prompts.verifyPromptCompletion(
|
||||||
|
client,
|
||||||
|
mcpOptions,
|
||||||
|
process.platform !== "linux",
|
||||||
|
);
|
||||||
const current = await client.callTool(
|
const current = await client.callTool(
|
||||||
{ name: "current_document", arguments: {} },
|
{ name: "current_document", arguments: {} },
|
||||||
mcpOptions,
|
mcpOptions,
|
||||||
);
|
);
|
||||||
if (
|
if (process.platform === "linux") {
|
||||||
current.isError === true ||
|
if (
|
||||||
json(prompts.mcpText(current)).normalized_result !== "fixture"
|
current.isError !== true ||
|
||||||
)
|
!prompts
|
||||||
throw new Error("packaged MCP bridge call failed");
|
.mcpText(current)
|
||||||
const batch = await client.callTool(
|
.includes("not supported for unattended Linux analysis")
|
||||||
{ name: "batch_decompile", arguments: { addresses: ["0x1000"] } },
|
)
|
||||||
mcpOptions,
|
throw new Error("packaged Linux MCP did not reject an unpinned Hopper");
|
||||||
);
|
} else {
|
||||||
const batchResult = json(prompts.mcpText(batch)).normalized_result;
|
if (json(prompts.mcpText(current)).normalized_result !== "fixture")
|
||||||
if (
|
throw new Error("packaged MCP bridge call failed");
|
||||||
batch.isError === true ||
|
const batch = await client.callTool(
|
||||||
batchResult?.total !== 1 ||
|
{ name: "batch_decompile", arguments: { addresses: ["0x1000"] } },
|
||||||
batchResult?.succeeded !== 1 ||
|
mcpOptions,
|
||||||
batchResult?.failed !== 0 ||
|
);
|
||||||
batchResult?.items?.[0]?.status !== "ok" ||
|
const batchResult = json(prompts.mcpText(batch)).normalized_result;
|
||||||
batchResult?.items?.[0]?.pseudocode !== "return 0;"
|
if (
|
||||||
)
|
batch.isError === true ||
|
||||||
throw new Error("packaged MCP structured batch result failed");
|
batchResult?.total !== 1 ||
|
||||||
|
batchResult?.succeeded !== 1 ||
|
||||||
|
batchResult?.failed !== 0 ||
|
||||||
|
batchResult?.items?.[0]?.status !== "ok" ||
|
||||||
|
batchResult?.items?.[0]?.pseudocode !== "return 0;"
|
||||||
|
)
|
||||||
|
throw new Error("packaged MCP structured batch result failed");
|
||||||
|
}
|
||||||
const closed = await client.callTool(
|
const closed = await client.callTool(
|
||||||
{ name: "close_binary", arguments: {} },
|
{ name: "close_binary", arguments: {} },
|
||||||
mcpOptions,
|
mcpOptions,
|
||||||
|
|||||||
Reference in New Issue
Block a user