Merge pull request #1224 from morluto/fix/adapter-host-refusal-messages
fix: name host and tool requirements in optional adapter refusals
This commit is contained in:
@@ -591,12 +591,18 @@ it.runIf(!unsupportedHost)(
|
||||
it.runIf(unsupportedHost)(
|
||||
"reports unverified host coverage before acquiring a provider",
|
||||
async () => {
|
||||
expect(
|
||||
await new PwntoolsLayoutProvider({}).inspect({ path: "/selected.elf" }),
|
||||
).toMatchObject({
|
||||
const result = await new PwntoolsLayoutProvider({}).inspect({
|
||||
path: "/selected.elf",
|
||||
});
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: { _tag: "AnalysisCapabilityUnavailableError" },
|
||||
});
|
||||
// Another target cannot satisfy a host requirement, so name it.
|
||||
if (result.ok) throw new Error("Expected a host refusal");
|
||||
const projected = projectAnalysisError(result.error);
|
||||
expect(projected.message).toContain("Linux x64");
|
||||
expect(projected.remediation.action).toContain("Linux x64");
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ it("keeps malformed JSON separate from absent external mitmproxy capability", as
|
||||
expect(missing.ok).toBe(false);
|
||||
expect(JSON.parse(missing.stdout)).toMatchObject({
|
||||
category: "unsupported_provider",
|
||||
message: expect.stringContaining("REA_MITMDUMP_COMMAND"),
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -29,6 +29,21 @@ const fixture = async () => {
|
||||
return { path, root: workspace.root };
|
||||
};
|
||||
|
||||
it.runIf(unsupportedHost)(
|
||||
"names the host requirement instead of asking for another target",
|
||||
async () => {
|
||||
const result = await new EvmoleInterfaceProvider({}).inspect({
|
||||
path: "/selected.hex",
|
||||
encoding: "hex",
|
||||
});
|
||||
if (result.ok) throw new Error("Expected a host refusal");
|
||||
const projected = projectAnalysisError(result.error);
|
||||
expect(projected).toMatchObject({ code: "capability_unavailable" });
|
||||
expect(projected.message).toContain("Linux x64");
|
||||
expect(projected.remediation.action).toContain("Linux x64");
|
||||
},
|
||||
);
|
||||
|
||||
it.runIf(!unsupportedHost).each(["SIGXCPU", "SIGXFSZ", "EFBIG"])(
|
||||
"preserves %s with configured limits distinct from unknown effective limits",
|
||||
async (failure) => {
|
||||
|
||||
@@ -10,7 +10,8 @@ import { projectAnalysisError } from "../../../../src/domain/analysisErrorProjec
|
||||
import { nativeCallObservationInputSchema } from "../../../../src/domain/native/nativeCallObservation.js";
|
||||
import type { NativeCallTracer } from "../../../../src/native/LldbCallTracer.js";
|
||||
import { LldbCallTracer } from "../../../../src/native/LldbCallTracer.js";
|
||||
import { ok } from "../../../../src/domain/result.js";
|
||||
import { err, ok } from "../../../../src/domain/result.js";
|
||||
import { NativeCommandFailure } from "../../../../src/native/CommandRunner.js";
|
||||
|
||||
const EVENT = {
|
||||
sequence: 0,
|
||||
@@ -106,6 +107,19 @@ const fixtureTracer = (
|
||||
};
|
||||
|
||||
describe("LLDB failure retention through the production tracer", () => {
|
||||
it("names the missing LLDB requirement instead of asking for another target", async () => {
|
||||
const tracer = new LldbCallTracer(
|
||||
() => Promise.reject(new Error("LLDB must not launch")),
|
||||
async (tool) => err(new NativeCommandFailure(tool, "unavailable")),
|
||||
);
|
||||
const result = await tracer.trace(request);
|
||||
if (result.ok) throw new Error("expected an unavailable LLDB");
|
||||
expect(projectAnalysisError(result.error)).toMatchObject({
|
||||
code: "capability_unavailable",
|
||||
message: "LLDB from Xcode or the Command Line Tools is not available",
|
||||
});
|
||||
});
|
||||
|
||||
it("preserves cancellation and journal/output evidence after runtime cleanup", async () => {
|
||||
const fixture = fixtureTracer("cancelled");
|
||||
const result = await fixture.tracer.trace(request);
|
||||
|
||||
@@ -657,6 +657,10 @@ describe("native macOS provider failures and parsing", () => {
|
||||
expect(!unavailableResult.ok && unavailableResult.error._tag).toBe(
|
||||
"AnalysisCapabilityUnavailableError",
|
||||
);
|
||||
if (unavailableResult.ok) throw new Error("Expected an unavailable tool");
|
||||
expect(projectAnalysisError(unavailableResult.error).message).toBe(
|
||||
"lipo is unavailable through xcrun.",
|
||||
);
|
||||
|
||||
const malformed = new NativeMacOSProvider(
|
||||
new FixtureRunner({ lipo: "malformed" }),
|
||||
|
||||
Reference in New Issue
Block a user