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
+33 -2
View File
@@ -149,13 +149,37 @@ describe("pointer fixup tables", () => {
data.writeUInt16LE(99, 46);
const fixups = parsePointerFixups(
data,
{ chained: { offset: 0, size: data.length }, binds: [], dylibs: [] },
{
chained: { offset: 0, size: data.length },
binds: [],
rebases: [],
dylibs: [],
},
SEGMENTS,
BASE,
);
expect(fixups.failures).toContain("Unsupported chained pointer format 99");
});
it("keeps unread LC_DYLD_INFO rebase bytes when chained fixups are present", () => {
const data = chainedData(1);
const fixups = parsePointerFixups(
data,
{
chained: { offset: 0, size: data.length },
binds: [],
rebases: [{ offset: 8, size: 12 }],
dylibs: [],
},
SEGMENTS,
BASE,
);
expect(fixups).toMatchObject({
kind: "chained",
unreadRebaseBytes: 12,
});
});
it("does not decode unreferenced imports while constructing fixup facts", () => {
const data = chainedData(1);
// The second import is outside the table bytes; only the first is needed
@@ -164,7 +188,12 @@ describe("pointer fixup tables", () => {
expect(() =>
parsePointerFixups(
data,
{ chained: { offset: 0, size: data.length }, binds: [], dylibs: [] },
{
chained: { offset: 0, size: data.length },
binds: [],
rebases: [],
dylibs: [],
},
SEGMENTS,
BASE,
),
@@ -179,6 +208,7 @@ describe("pointer fixup tables", () => {
{
chained: { offset: 0, size: data.length },
binds: [],
rebases: [],
dylibs: ["/usr/lib/libobjc.A.dylib", "/usr/lib/libSystem.B.dylib"],
},
SEGMENTS,
@@ -241,6 +271,7 @@ describe("pointer fixup tables", () => {
{ offset: 0, size: opcodes.length, stream: "bind" },
{ offset: opcodes.length, size: lazy.length, stream: "lazy" },
],
rebases: [],
dylibs: ["/usr/lib/libobjc.A.dylib", "/usr/lib/libSystem.B.dylib"],
},
SEGMENTS,