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
+7 -20
View File
@@ -34,7 +34,7 @@ export const planWebScriptExport = (
};
const candidate = candidates[index];
const reason = conflicts.has(index)
? "Captured paths collide by content version, case, or file/directory prefix."
? "Captured paths collide by content version or file/directory prefix."
: (candidate?.reason ?? null);
const path = reason === null ? candidate?.path : undefined;
return {
@@ -103,40 +103,27 @@ const candidatePath = (script: CapturedWebScript): CandidatePath => {
};
};
// Register every prefix so case collisions in parent directories and a file
// conflicting with a directory isolate all affected sources, not just the last.
// Register every exact prefix so a repeated path, or a file that is also a
// directory prefix, isolates every affected source. Case-distinct spellings
// stay distinct until the destination filesystem reports a collision.
const conflictingPaths = (
candidates: readonly CandidatePath[],
): Set<number> => {
const prefixes = new Map<
string,
{
spellings: Set<string>;
indices: number[];
files: number[];
}
>();
const prefixes = new Map<string, { indices: number[]; files: number[] }>();
candidates.forEach(({ path }, index) => {
if (path === undefined) return;
const parts = path.split("/");
parts.forEach((_, position) => {
const spelling = parts.slice(0, position + 1).join("/");
const key = spelling.toLowerCase();
const entry = prefixes.get(key) ?? {
spellings: new Set<string>(),
indices: [],
files: [],
};
entry.spellings.add(spelling);
const entry = prefixes.get(spelling) ?? { indices: [], files: [] };
entry.indices.push(index);
if (position === parts.length - 1) entry.files.push(index);
prefixes.set(key, entry);
prefixes.set(spelling, entry);
});
});
const conflicts = new Set<number>();
for (const entry of prefixes.values())
if (
entry.spellings.size > 1 ||
entry.files.length > 1 ||
(entry.files.length > 0 && entry.indices.length > entry.files.length)
)