fix(artifacts): report keyed-archive selection mistakes as invalid input

inspect_keyed_archive reported caller selection failures as artifact
faults. A missing named root became "Artifact is invalid or has changed.
Get a fresh copy" and lost its reason, and a missing, non-canonical, or
directory archive path became "unsafe or conflicting internal path ...
correct the artifact".

Report these as invalid_request issues on `path` or `root`, listing the
available $top roots or the active plist basename. Decode failures keep
the decoder's reason, and a compiled NIBArchive points to
decode_interface_builder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-08 13:43:30 +00:00
co-authored by Claude Opus 5.5
parent bfbfc7330a
commit 25fb6d32a3
6 changed files with 195 additions and 17 deletions
@@ -62,6 +62,40 @@ it("inspects a standalone keyed archive through MCP with original object identit
arguments: { path: "other.plist" },
});
expect(rejected.isError).toBe(true);
expect(rejected.structuredContent).toMatchObject({
error: {
code: "invalid_request",
details: {
issues: [
{
path: ["path"],
reason: "invalid_value",
expected: "archive.plist",
},
],
},
},
});
const missingRoot = await client.callTool({
name: "inspect_keyed_archive",
arguments: { root: "missing" },
});
expect(missingRoot.isError).toBe(true);
expect(missingRoot.structuredContent).toMatchObject({
error: {
code: "invalid_request",
details: {
issues: [
{
path: ["root"],
reason: "invalid_value",
message: expect.stringContaining("missing"),
expected: Object.keys(graph.roots),
},
],
},
},
});
} finally {
await client.close();
await server.close();