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:
@@ -0,0 +1,38 @@
|
||||
/** Path-segment conventions. These are inferences, not observations of runtime behavior. */
|
||||
|
||||
export type NativeRuntimeConvention = "react-native" | "flutter" | "unity";
|
||||
|
||||
const foldSegment = (segment: string): string =>
|
||||
segment.toLocaleLowerCase("en-US");
|
||||
|
||||
const REACT_NATIVE_SEGMENTS = new Set([
|
||||
"react.framework",
|
||||
"libhermes.so",
|
||||
"hermes.framework",
|
||||
]);
|
||||
const FLUTTER_SEGMENTS = new Set(["libflutter.so", "flutter.framework"]);
|
||||
const UNITY_SEGMENTS = new Set(["libunity.so", "unityframework.framework"]);
|
||||
|
||||
/**
|
||||
* A runtime family named by one filename or directory segment.
|
||||
* `reactnative` may occur inside a segment (`libreactnativejni.so`).
|
||||
* The other names match the whole segment.
|
||||
*/
|
||||
export const nativeRuntimeConvention = (
|
||||
path: string,
|
||||
): NativeRuntimeConvention | null => {
|
||||
for (const segment of path.split("/")) {
|
||||
const folded = foldSegment(segment);
|
||||
if (folded.includes("reactnative") || REACT_NATIVE_SEGMENTS.has(folded))
|
||||
return "react-native";
|
||||
if (FLUTTER_SEGMENTS.has(folded)) return "flutter";
|
||||
if (UNITY_SEGMENTS.has(folded)) return "unity";
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/** Swift runtime libraries are `libswift*.dylib` segments, not every dynamic library. */
|
||||
export const isSwiftRuntimeLibrary = (path: string): boolean =>
|
||||
path
|
||||
.split("/")
|
||||
.some((segment) => /^libswift.+\.dylib$/u.test(foldSegment(segment)));
|
||||
Reference in New Issue
Block a user