fix(artifacts): trace .app-named files standalone and flag empty FAT tables

- Treat the target as a bundle only when it was opened from an app bundle
  directory (it carries the bundle's Info.plist); a regular Mach-O file whose
  name ends in .app is traced from its parent directory.
- Classify a FAT header with zero architecture records as malformed, so it
  stays visible in unclassified roots and coverage.
- State that dylib compatibility versions are not compared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-07 12:25:37 +00:00
co-authored by Claude Opus 5.5
parent 19f01e2610
commit ef245c0bd0
5 changed files with 60 additions and 8 deletions
@@ -123,3 +123,39 @@ it("rejects targets that are not Mach-O", async () => {
expect(JSON.stringify(called.structuredContent)).toContain("unavailable");
});
});
it("traces a standalone Mach-O file whose name ends in .app", async () => {
const directory = await createTestTempDirectory("rea-dylib-mcp-file-");
await writeFile(
join(directory, "Tool.app"),
machoImage({
commands: [dylibCommand(LC.LOAD_DYLIB, "@loader_path/libcore.dylib")],
}),
);
await writeFile(
join(directory, "libcore.dylib"),
machoImage({ fileType: FILE_TYPE.dylib }),
);
await withClient(async (client) => {
const opened = await client.callTool({
name: "open_binary",
arguments: { path: join(directory, "Tool.app") },
});
expect(opened.isError, JSON.stringify(opened)).not.toBe(true);
const called = await client.callTool({
name: "trace_dylib_resolution",
arguments: {},
});
expect(called.isError, JSON.stringify(called.structuredContent)).not.toBe(
true,
);
const trace = dylibResolutionResultSchema.parse(
structuredResult(called.structuredContent),
);
expect(trace.edges).toEqual([
expect.objectContaining({
resolution: { status: "resolved", image: "libcore.dylib" },
}),
]);
});
});