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:
@@ -1,4 +1,11 @@
|
||||
import { mkdtemp, rm, symlink } from "node:fs/promises";
|
||||
import {
|
||||
chmod,
|
||||
mkdir,
|
||||
mkdtemp,
|
||||
rm,
|
||||
symlink,
|
||||
writeFile,
|
||||
} from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { expect, it } from "vitest";
|
||||
@@ -21,6 +28,38 @@ it("preserves the caller-selected executable symlink for process invocation", as
|
||||
}
|
||||
});
|
||||
|
||||
it("resolves a Windows executable through the canonical PATH spelling", async () => {
|
||||
const root = await mkdtemp(join(tmpdir(), "rea-process-path-"));
|
||||
try {
|
||||
const selected = join(root, "selected");
|
||||
const ambient = join(root, "ambient");
|
||||
await mkdir(selected);
|
||||
await mkdir(ambient);
|
||||
await writeFile(join(selected, "tool.exe"), "");
|
||||
await chmod(join(selected, "tool.exe"), 0o644);
|
||||
const scenario = parseProcessScenario({
|
||||
executable: "tool.exe",
|
||||
working_directory: root,
|
||||
environment: { Path: selected },
|
||||
});
|
||||
const candidate = join(selected, "tool.exe");
|
||||
try {
|
||||
const resolved = await resolveProcessScenarioRuntimePaths(
|
||||
scenario,
|
||||
{ PATH: ambient },
|
||||
"win32",
|
||||
);
|
||||
expect(resolved.executable).toBe(candidate);
|
||||
} catch (cause: unknown) {
|
||||
const message = cause instanceof Error ? cause.message : String(cause);
|
||||
expect(message).toContain(candidate);
|
||||
expect(message).not.toContain(ambient);
|
||||
}
|
||||
} finally {
|
||||
await rm(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("retains the selected missing working directory and OS reason", async () => {
|
||||
const selected = join(tmpdir(), "rea-process-missing-cwd-unique");
|
||||
const scenario = parseProcessScenario({
|
||||
|
||||
@@ -3,6 +3,7 @@ import { constants as fsConstants } from "node:fs";
|
||||
import { delimiter, isAbsolute, join, resolve } from "node:path";
|
||||
|
||||
import type { ProcessScenario } from "../../domain/process/processScenario.js";
|
||||
import { snapshotEnvironment } from "../snapshotEnvironment.js";
|
||||
import {
|
||||
ProcessCaptureError,
|
||||
processCaptureCancelled,
|
||||
@@ -12,6 +13,7 @@ import {
|
||||
export const resolveProcessScenarioRuntimePaths = async (
|
||||
scenario: ProcessScenario,
|
||||
environment: Readonly<Record<string, string | undefined>> = process.env,
|
||||
platform: NodeJS.Platform = process.platform,
|
||||
): Promise<ProcessScenario> => {
|
||||
const selectedWorkingDirectory = resolve(scenario.working_directory);
|
||||
let workingDirectory: string;
|
||||
@@ -39,7 +41,9 @@ export const resolveProcessScenarioRuntimePaths = async (
|
||||
const executable = await resolveExecutable(
|
||||
scenario.executable,
|
||||
workingDirectory,
|
||||
scenario.environment.PATH ?? environment.PATH ?? "",
|
||||
snapshotEnvironment(scenario.environment, platform).PATH ??
|
||||
snapshotEnvironment(environment, platform).PATH ??
|
||||
"",
|
||||
);
|
||||
const observationPaths = scenario.filesystem_observation_paths.map((path) =>
|
||||
resolve(workingDirectory, path),
|
||||
|
||||
Reference in New Issue
Block a user