fix(artifacts): report wrong target kinds as unsupported targets
decode_interface_builder, inspect_asset_catalog, inspect_keyed_archive and trace_dylib_resolution refused a target of the wrong kind (for example a plain Mach-O for the asset catalog, or a plist for dyld tracing) as an `unavailable` artifact failure: "Artifact processing is unavailable for the current target or host. Check artifact support and required tools." Nothing was missing on the host; the operation does not support that kind of target. Raise AnalysisUnsupportedTargetError for these checks and let translateFailure keep it. The result is now `unsupported_target`, naming the operation, the target path and the requirement, with advice to pick a supported target or another operation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b620e2a2bd
commit
637bcb5e41
@@ -126,7 +126,35 @@ it("rejects targets that are not Mach-O", async () => {
|
||||
arguments: {},
|
||||
});
|
||||
expect(called.isError).toBe(true);
|
||||
expect(JSON.stringify(called.structuredContent)).toContain("unavailable");
|
||||
expect(called.structuredContent).toMatchObject({
|
||||
error: { code: "unsupported_target", category: "unsupported_target" },
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("reports target kinds that artifact operations cannot inspect as unsupported", async () => {
|
||||
const directory = await createTestTempDirectory("rea-artifact-target-");
|
||||
const plist = join(directory, "Info.plist");
|
||||
await writeFile(plist, "<plist><dict/></plist>");
|
||||
const tool = join(directory, "tool");
|
||||
await writeFile(tool, machoImage({ commands: [buildVersionCommand(1)] }));
|
||||
await withClient(async (client) => {
|
||||
for (const [path, operation, requirement] of [
|
||||
[plist, "decode_interface_builder", "requires an active .app bundle"],
|
||||
[plist, "inspect_asset_catalog", "requires an active .app bundle"],
|
||||
[tool, "inspect_keyed_archive", "requires an active plist or .app"],
|
||||
] as const) {
|
||||
const open = { name: "open_binary", arguments: { path } };
|
||||
expect((await client.callTool(open)).isError, path).not.toBe(true);
|
||||
const called = await client.callTool({ name: operation, arguments: {} });
|
||||
expect(called.structuredContent, operation).toMatchObject({
|
||||
error: {
|
||||
code: "unsupported_target",
|
||||
message: expect.stringContaining(`${operation} at ${path}`),
|
||||
details: { reason: expect.stringContaining(requirement) },
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user