Files
rea/tests/boundary/javascript/sourceMapRuntimeAvailability.test.ts
Ysopwnable 172407787f 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.
2026-10-13 11:42:54 +08:00

36 lines
1.4 KiB
TypeScript

import { expect, it } from "vitest";
import { projectAnalysisError } from "../../../src/domain/analysisErrorProjection.js";
import { runSourceMapCommand } from "../../../src/javascript/sourceMaps/SourceMapCommand.js";
import { PrivateRuntimeRootUnavailableError } from "../../../src/process/PrivateRuntimeRootUnavailableError.js";
it.each([false, true])(
"preserves private-runtime retryable=%s through the source-map operation",
async (retryable) => {
const reason = "Native runtime self-test failed with a sharing violation";
let launches = 0;
const result = await runSourceMapCommand("{}", "/selected.map", undefined, {
prepareOwnership: async () => {},
createRuntime: async () => {
throw new PrivateRuntimeRootUnavailableError(reason, { retryable });
},
launcher: async () => {
launches += 1;
throw new Error("A refused runtime must not launch a codec");
},
});
expect(launches).toBe(0);
if (result.ok) throw new Error("Unavailable runtime must refuse decoding");
expect(projectAnalysisError(result.error)).toMatchObject({
code: "capability_unavailable",
category: retryable ? "unavailable" : "unsupported_provider",
retryable,
details: {
provider_id: "source-map-decoder",
operation: "trace_web_source_location",
reason,
},
});
expect(result.error.cleanupIncomplete).toBe(false);
},
);