fix: bind identity and coverage to the producing rule (#1513)

* fix: bind identity and coverage to the producing rule

Logical paths, container families, examined bytes, path-segment conventions, destination collisions, file-id leases, Mach-O CPU selection, and firmware cleanup now follow the observation that owns each rule.

* fix: fail unmatched Mach-O slices and keep firmware roots independent

A fat target whose architecture lipo did not list now stops before slice tools run. Chained fixups still count unread LC_DYLD_INFO rebase bytes, and a firmware cleanup failure no longer blocks the next workspace.

* test: cover path identity and runtime families at the projection boundary

NFC joins and segment conventions are now asserted by the path resolver, the Apple projection, and a real APK inventory instead of helper unit tests.

* test: expect unread dyld rebase bytes in the Apple dispatch fixture

The legacy LC_DYLD_INFO fixture keeps a rebase range this reader does not decode, so the public CLI and MCP check now requires that partial coverage beside the bind opcodes.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
morluto
2026-10-10 17:14:47 +08:00
committed by GitHub
co-authored by Cursor Agent
parent 7a56fe6260
commit b4db35f092
48 changed files with 1251 additions and 266 deletions
+77
View File
@@ -572,3 +572,80 @@ describe("Apple application bridge candidates", () => {
});
});
});
describe("Apple path conventions", () => {
it("recognizes anatomy names by English case and reports the archive spelling", () => {
const result = project(
inventoryEvidence("directory", "Fixture.app", [
{ path: "contents/info.plist" },
macho("contents/macos/Fixture"),
{ path: "contents/_codesignature/coderesources" },
]),
);
expect(result.bundles[0]).toMatchObject({
layout: "macos-deep",
info_plist_path: "contents/info.plist",
executable_candidates: ["contents/macos/Fixture"],
signing_paths: ["contents/_codesignature/coderesources"],
});
expect(result.components.bundle_metadata.map(({ path }) => path)).toEqual([
"contents/info.plist",
]);
expect(result.components.signing.map(({ path }) => path)).toEqual([
"contents/_codesignature/coderesources",
]);
});
it("limits runtime families and bridge bases to path segments", () => {
const result = project(
inventoryEvidence("ipa", "Fixture.ipa", [
{ path: "Payload/Fixture.app/Info.plist" },
macho("Payload/Fixture.app/Fixture"),
macho("Payload/Fixture.app/Frameworks/libfoo.dylib"),
macho("SwiftSupport/libswiftCore.dylib"),
macho("Payload/Fixture.app/Frameworks/MyApp.framework/MyApp"),
macho("Payload/Fixture.app/community/libcommunity.so"),
{
path: "Payload/Fixture.app/main.js",
format: "javascript-bundle",
},
]),
);
expect(result.runtime_families).toEqual(
expect.arrayContaining(["javascript", "native", "swift-objective-c"]),
);
expect(result.runtime_families).not.toContain("flutter");
expect(result.runtime_families).not.toContain("unity");
expect(result.runtime_families).not.toContain("react-native");
expect(
result.bridge_candidates.every(
({ basis }) => basis === "javascript-and-native-content",
),
).toBe(true);
expect(result.limitations).toEqual(
expect.arrayContaining([
"Runtime families are inferred from inventory formats and paths.",
"A bridge basis is inferred from the native path and is repeated for every managed component.",
]),
);
});
it("recognizes framework segments and does not treat a bare dylib as Swift", () => {
const result = project(
inventoryEvidence("ipa", "Fixture.ipa", [
{ path: "Payload/Fixture.app/Info.plist" },
macho("Payload/Fixture.app/Fixture"),
macho("Payload/Fixture.app/Frameworks/Flutter.framework/Flutter"),
macho(
"Payload/Fixture.app/Frameworks/UnityFramework.framework/UnityFramework",
),
macho("Payload/Fixture.app/Frameworks/hermes.framework/hermes"),
macho("Payload/Fixture.app/Frameworks/libfoo.dylib"),
]),
);
expect(result.runtime_families).toEqual(
expect.arrayContaining(["flutter", "unity", "react-native", "native"]),
);
expect(result.runtime_families).not.toContain("swift-objective-c");
});
});