fix(pcap): name the host tool to configure in capability refusals (#2507)
* fix(pcap): name the host tool to configure in capability refusals Missing or misconfigured tshark/capinfos, the unsupported macOS capture boundary and an unusable Linux prlimit were projected with the generic "unavailable for the current target; choose another target" advice, even for inspect_pcap_client, which has no target. Route tool refusals through one pcapToolUnavailable owner that names REA_TSHARK_COMMAND and REA_CAPINFOS_COMMAND, give host-boundary refusals their own reason, and keep the private workspace refusal's retryable flag like WABT and source maps do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(pcap): cover the Linux prlimit refusal guidance Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1991542e59
commit
bb96afdbe3
@@ -246,12 +246,37 @@ it("reports relative configuration and missing capinfos as capability gaps", asy
|
||||
input: {},
|
||||
});
|
||||
if (result.ok) throw new Error("expected unavailable tools");
|
||||
expect(projectAnalysisError(result.error).code).toBe(
|
||||
"capability_unavailable",
|
||||
const projected = projectAnalysisError(result.error);
|
||||
expect(projected.code).toBe("capability_unavailable");
|
||||
expect(projected.message).toContain(
|
||||
"Supply Wireshark 4.x tshark and capinfos",
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it("names the prlimit selection when the Linux limiter is unusable", async () => {
|
||||
const root = await createTestTempDirectory("rea-pcap-prlimit-");
|
||||
const tools = await writeStubTools(root);
|
||||
const provider = new PcapProvider({
|
||||
environment: {
|
||||
REA_TSHARK_COMMAND: tools.tshark,
|
||||
REA_CAPINFOS_COMMAND: tools.capinfos,
|
||||
REA_TSHARK_PRLIMIT_COMMAND: "relative/prlimit",
|
||||
},
|
||||
});
|
||||
onTestFinished(() => provider.close());
|
||||
const result = await provider.execute({
|
||||
operation: "inspect_pcap_capture",
|
||||
input: { path: "/not-opened/capture.pcap" },
|
||||
});
|
||||
if (result.ok) throw new Error("expected an unusable limiter");
|
||||
const projected = projectAnalysisError(result.error);
|
||||
expect(projected.code).toBe("capability_unavailable");
|
||||
expect(projected.message).toContain(
|
||||
"(REA_TSHARK_PRLIMIT_COMMAND must be absolute.) Check that REA_TSHARK_PRLIMIT_COMMAND",
|
||||
);
|
||||
});
|
||||
|
||||
const nodeTool = async (
|
||||
root: string,
|
||||
name: string,
|
||||
|
||||
@@ -141,9 +141,13 @@ it.runIf(!hasNativeBound)(
|
||||
input: { path: "/not-opened/capture.pcap" },
|
||||
});
|
||||
expect(result.ok).toBe(false);
|
||||
if (!result.ok)
|
||||
expect(projectAnalysisError(result.error)).toMatchObject({
|
||||
code: "capability_unavailable",
|
||||
});
|
||||
if (result.ok) return;
|
||||
const projected = projectAnalysisError(result.error);
|
||||
expect(projected.code).toBe("capability_unavailable");
|
||||
// The refusal concerns this host, so it must not suggest another target.
|
||||
expect(projected.message).toContain(
|
||||
"Linux with util-linux prlimit, or Windows with owned Job Objects",
|
||||
);
|
||||
expect(projected.remediation.action).toBe(projected.message);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user