fix(windows): preserve transient runtime admission failures (#2467)
Fixes #2257. Thanks to @chqcjq for the native self-test retry diagnosis in #2266. Preserve retry disposition through analysis workflows. Native warm admission requires exact sharing/lock codes and affirmative pre-allocation evidence; cleanup ownership takes precedence. No automatic retry or new analysis cache. Verified with real Windows 11 CLI, same-connection SDK MCP normal/conflict/recovery, the Windows native verifier, 99 focused tests and static/docs gates. Official npm 11.16.0 launcher sources were the application input. No IDA or Ghidra engine was used for this change. Win32 5 was not reproduced; no resolution claim for #1701/#2196. Performance measurements and limits are recorded in experiments/analysis-efficiency/windows-runtime-retry.md.
This commit is contained in:
@@ -3,12 +3,11 @@ import { join } from "node:path";
|
||||
import { expect, it } from "vitest";
|
||||
import { createTestTempDirectory } from "../../tests/fixtures/temporaryDirectory.js";
|
||||
import { WabtArtifactProvider } from "./WabtArtifactProvider.js";
|
||||
import {
|
||||
PrivateRuntimeRoot,
|
||||
PrivateRuntimeRootUnavailableError,
|
||||
} from "../process/PrivateRuntimeRoot.js";
|
||||
import { PrivateRuntimeRoot } from "../process/PrivateRuntimeRoot.js";
|
||||
import { PrivateRuntimeRootUnavailableError } from "../process/PrivateRuntimeRootUnavailableError.js";
|
||||
import { spawnOwnedProviderProcess } from "../process/ProviderProcess.js";
|
||||
import { OwnedCommandFailure } from "../process/OwnedCommand.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
|
||||
const failureTags: Readonly<Record<string, string>> = {
|
||||
invalid: "AnalysisInputError",
|
||||
@@ -40,40 +39,51 @@ it("returns actionable unavailable without creating a workspace when tools are a
|
||||
});
|
||||
});
|
||||
|
||||
it("reports an unavailable private runtime root without a misleading WABT remediation", async () => {
|
||||
const toolRoot = await createTestTempDirectory("rea-wabt-tool-root-");
|
||||
for (const tool of ["wasm-validate", "wasm-objdump", "wasm2wat"])
|
||||
await writeFile(
|
||||
join(toolRoot, tool + (process.platform === "win32" ? ".exe" : "")),
|
||||
"source-owned executable seam",
|
||||
{ mode: 0o700 },
|
||||
);
|
||||
const provider = new WabtArtifactProvider(
|
||||
{ REA_WABT_BIN_DIRECTORY: toolRoot },
|
||||
undefined,
|
||||
() => {
|
||||
throw new PrivateRuntimeRootUnavailableError(
|
||||
"REA Windows native controls are unavailable: probe failure",
|
||||
it.each([false, true])(
|
||||
"reports an unavailable private runtime root with retryable=%s without a misleading WABT remediation",
|
||||
async (retryable) => {
|
||||
const toolRoot = await createTestTempDirectory("rea-wabt-tool-root-");
|
||||
for (const tool of ["wasm-validate", "wasm-objdump", "wasm2wat"])
|
||||
await writeFile(
|
||||
join(toolRoot, tool + (process.platform === "win32" ? ".exe" : "")),
|
||||
"source-owned executable seam",
|
||||
{ mode: 0o700 },
|
||||
);
|
||||
},
|
||||
);
|
||||
expect(
|
||||
await provider.inspect({
|
||||
const provider = new WabtArtifactProvider(
|
||||
{ REA_WABT_BIN_DIRECTORY: toolRoot },
|
||||
undefined,
|
||||
() => {
|
||||
throw new PrivateRuntimeRootUnavailableError(
|
||||
"REA Windows native controls are unavailable: probe failure",
|
||||
{ retryable },
|
||||
);
|
||||
},
|
||||
);
|
||||
const result = await provider.inspect({
|
||||
path: "/module.wasm",
|
||||
glue_paths: [],
|
||||
candidate_paths: [],
|
||||
}),
|
||||
).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "AnalysisCapabilityUnavailableError",
|
||||
userMessage: undefined,
|
||||
message: expect.stringContaining(
|
||||
"REA Windows native controls are unavailable",
|
||||
),
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "AnalysisCapabilityUnavailableError",
|
||||
retryable,
|
||||
userMessage: undefined,
|
||||
message: expect.stringContaining(
|
||||
"REA Windows native controls are unavailable",
|
||||
),
|
||||
},
|
||||
});
|
||||
if (result.ok)
|
||||
throw new Error("Unavailable runtime must refuse inspection");
|
||||
expect(projectAnalysisError(result.error)).toMatchObject({
|
||||
code: "capability_unavailable",
|
||||
retryable,
|
||||
category: retryable ? "unavailable" : "unsupported_provider",
|
||||
});
|
||||
},
|
||||
);
|
||||
it.each([
|
||||
"success",
|
||||
"invalid",
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
} from "../domain/analysisErrorCore.js";
|
||||
import { ProviderCleanupError } from "../domain/providerCleanupError.js";
|
||||
import { OwnedCommandFailure } from "../process/OwnedCommand.js";
|
||||
import { PrivateRuntimeRootUnavailableError } from "../process/PrivateRuntimeRoot.js";
|
||||
import { PrivateRuntimeRootUnavailableError } from "../process/PrivateRuntimeRootUnavailableError.js";
|
||||
import { WABT_LIMITS, WABT_PROVIDER_IDENTITY } from "./WabtRelease.js";
|
||||
/** Preserve lifecycle failures and diagnostic bytes instead of returning partial success. */
|
||||
export const wabtFailure = (
|
||||
@@ -76,7 +76,7 @@ export const wabtFailure = (
|
||||
WABT_PROVIDER_IDENTITY.id,
|
||||
"inspect_wasm_artifact",
|
||||
reason,
|
||||
{ cause },
|
||||
{ cause, retryable: cause.retryable },
|
||||
);
|
||||
if (phase === "configuration")
|
||||
return new AnalysisCapabilityUnavailableError(
|
||||
|
||||
Reference in New Issue
Block a user