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
+19 -5
View File
@@ -44,7 +44,7 @@ export class WindowsPrivateRuntime {
authority.call("runtime_create", [parent, prefix]),
);
const runtime = new WindowsPrivateRuntime(observation, authority);
runtimes.set(observation.path.toLowerCase(), runtime);
runtimes.set(windowsRuntimeIdentityKey(observation), runtime);
return runtime;
}
@@ -142,16 +142,30 @@ export class WindowsPrivateRuntime {
await this.#pending?.catch(() => undefined);
this.authority.call("runtime_close", [this.observation.handle]);
this.#closed = true;
runtimes.delete(this.observation.path.toLowerCase());
runtimes.delete(windowsRuntimeIdentityKey(this.observation));
}
}
/** Select an already-owned runtime; an arbitrary pathname cannot grant authority. */
/** File id returned by the OS. Path spelling is not part of the lease key. */
const windowsRuntimeIdentityKey = (identity: {
readonly volumeSerial: string;
readonly fileId: string;
}): string => `${identity.volumeSerial}:${identity.fileId}`;
/**
* Select an already-owned runtime. Only the observed `path` or `finalPath`
* matches, character for character. A case variant fails closed.
*/
export const windowsPrivateRuntime = (
rootPath: string,
): WindowsPrivateRuntime => {
const runtime = runtimes.get(rootPath.toLowerCase());
if (runtime === undefined)
const matches = [...runtimes.values()].filter(
(runtime) =>
runtime.observation.finalPath === rootPath ||
runtime.observation.path === rootPath,
);
const runtime = matches[0];
if (matches.length !== 1 || runtime === undefined)
throw new Error(`No native private runtime owns ${rootPath}`);
return runtime;
};