* fix(comparisons)!: preserve unknowns across partial observations Share absence and digest semantics, keep unobserved managed bodies unknown, and match unique managed type/name/signatures before structural fallback. BREAKING CHANGE: Managed comparison metadata adds exact-signature matching and its count, and name_matching now reports exact-signature-fallback. * fix(javascript): preserve projected result binding semantics Share syntax-aware property reads and assigned-result resolution. Retain destructuring paths and downgrade downstream whole-result relationships instead of resolving nested or wrapped calls as aliases. * fix(native)!: admit complete parser values and preserve typed failures Decode Mach headers by named columns, validate complete slice keys and lipo alignment, and preserve codesign runtime flags and tagged parser errors. Rename the Ghidra test dossier fixture and connect fake-backed suites to real verification lanes. BREAKING CHANGE: Native load-command results no longer contain the unused, always-null file_offset field. * fix(process): preserve host identity and actionable boundary failures Thread selected platform and environment through process and Doctor seams, stamp observed producer identity in Evidence, and retain PTY, filesystem, lease and lazy-provider failure causes. Drain cancelled lazy loads and omit exited descendants from verified lineage. * fix(browser): preserve cleanup and document-transition evidence Make V8 and Playwright teardown cancellation-aware, expose primary failures alongside incomplete cleanup, share frame-tree and navigation rules, and clear stale WebMCP registrations without pruning unrelated child frames. * fix(adapters): align managed targets and typed CLI outcomes Inspect managed PE/CLI targets independently of native provider selection, reuse successful managed selections, and keep evidence bound to the actual inspected target. Classify canonical CLI error envelopes and exhaustive setup/update/uninstall outcomes, audit registered CLI coverage, and assert platform-specific runtime results. * docs: refresh boundary contracts and shipped roadmap behavior
99 lines
3.7 KiB
TypeScript
99 lines
3.7 KiB
TypeScript
import { writeFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { createTestTempDirectory } from "../../../fixtures/temporaryDirectory.js";
|
|
|
|
import { MachOSliceArtifactReader } from "../../../../src/artifacts/MachOSliceArtifactReader.js";
|
|
import { ok } from "../../../../src/domain/result.js";
|
|
import type { NativeCommandRunner } from "../../../../src/native/CommandRunner.js";
|
|
|
|
describe("artifact Mach-O slices", () => {
|
|
it("rejects lipo slice sizes that exceed the observed artifact bytes", async () => {
|
|
const root = await createTestTempDirectory("rea-slices-short-");
|
|
const binary = join(root, "fat");
|
|
await writeFile(binary, Buffer.from("0123456789"));
|
|
const runner: NativeCommandRunner = {
|
|
run: () =>
|
|
Promise.resolve(
|
|
ok({
|
|
tool: "lipo",
|
|
executable: "/usr/bin/lipo",
|
|
executableSha256: "1".repeat(64),
|
|
toolVersion: null,
|
|
versionReason: "fixture",
|
|
arguments: ["-detailed_info", binary],
|
|
stdout:
|
|
"architecture arm64\n cputype 16777228\n cpusubtype 0\n offset 0\n size 100\n align 2^2\n",
|
|
stderr: "",
|
|
stdoutBytes: 1,
|
|
stderrBytes: 0,
|
|
exitCode: 0,
|
|
signal: null,
|
|
}),
|
|
),
|
|
};
|
|
const reader = new MachOSliceArtifactReader(binary, runner);
|
|
const enumerate = async (): Promise<void> => {
|
|
for await (const _entry of reader.entries()) {
|
|
// Enumeration must reject out-of-bounds lipo metadata before yielding.
|
|
}
|
|
};
|
|
await expect(enumerate()).rejects.toMatchObject({ reason: "integrity" });
|
|
});
|
|
|
|
it("uses lipo metadata to read universal slice ranges", async () => {
|
|
const root = await createTestTempDirectory("rea-slices-");
|
|
const binary = join(root, "fat");
|
|
await writeFile(binary, Buffer.from("0123456789abcdef"));
|
|
const runner: NativeCommandRunner = {
|
|
run: () =>
|
|
Promise.resolve(
|
|
ok({
|
|
tool: "lipo",
|
|
executable: "/usr/bin/lipo",
|
|
executableSha256: "1".repeat(64),
|
|
toolVersion: null,
|
|
versionReason: "fixture",
|
|
arguments: ["-detailed_info", binary],
|
|
stdout:
|
|
"architecture x86_64\n cputype 16777223\n cpusubtype 3\n offset 0\n size 8\n align 2^2\narchitecture arm64\n cputype 16777228\n cpusubtype 0\n offset 8\n size 8\n align 2^2\n",
|
|
stderr: "",
|
|
stdoutBytes: 1,
|
|
stderrBytes: 0,
|
|
exitCode: 0,
|
|
signal: null,
|
|
}),
|
|
),
|
|
};
|
|
const reader = new MachOSliceArtifactReader(binary, runner);
|
|
const entries = [];
|
|
for await (const entry of reader.entries()) entries.push(entry);
|
|
expect(entries).toHaveLength(2);
|
|
const secondEntry = entries[1];
|
|
expect(secondEntry).toBeDefined();
|
|
if (secondEntry === undefined) return;
|
|
expect(secondEntry).toMatchObject({
|
|
path: "slices/arm64",
|
|
byteOffset: 8,
|
|
declaredSize: 8,
|
|
});
|
|
for (const adapterKey of ["0x8:8", "1e3:8", " 8 :8"])
|
|
await expect(
|
|
reader.open({ ...secondEntry, adapterKey }),
|
|
).rejects.toMatchObject({ reason: "integrity" });
|
|
const chunks: Buffer[] = [];
|
|
const stream = await reader.open(secondEntry);
|
|
for await (const chunk of stream) chunks.push(Buffer.from(chunk));
|
|
expect(Buffer.concat(chunks).toString()).toBe("89abcdef");
|
|
expect(reader.provenance()).toEqual([
|
|
expect.objectContaining({ tool: "lipo", effects: ["read"] }),
|
|
]);
|
|
const provenance = reader.provenance();
|
|
if (provenance[0] !== undefined)
|
|
Reflect.set(provenance[0], "tool", "forged");
|
|
expect(reader.provenance()[0]?.tool).toBe("lipo");
|
|
});
|
|
});
|