fix(native): bind signature observations to registered target versions (#1099)

* fix(native): bind signature observations to registered target versions

* fix(native): preserve target drift and cancellation across signature captures

* fix(native): inspect signatures from a verified byte snapshot
This commit is contained in:
morluto
2026-10-09 01:27:26 +08:00
committed by GitHub
parent acb3e0f2e5
commit c789af04b7
7 changed files with 908 additions and 36 deletions
+16 -1
View File
@@ -1,3 +1,4 @@
import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";
import type { BinaryTarget } from "../../src/domain/binaryTarget.js";
import { ok } from "../../src/domain/result.js";
@@ -96,7 +97,10 @@ const capture = (
export const nativeMachoTarget = (
path: string,
sourcePath?: string,
): BinaryTarget => ({
): BinaryTarget & {
readonly kind: "executable";
readonly format: "mach-o";
} => ({
path,
...(sourcePath === undefined ? {} : { sourcePath }),
sha256: "0".repeat(64),
@@ -106,6 +110,17 @@ export const nativeMachoTarget = (
availableArchitectures: ["x86_64", "arm64"],
});
/** Register the actual bytes of a filesystem-backed native test target. */
export const nativeMachoTargetForFile = async (
path: string,
sourcePath?: string,
): Promise<ReturnType<typeof nativeMachoTarget>> => ({
...nativeMachoTarget(path, sourcePath),
sha256: createHash("sha256")
.update(await readFile(path))
.digest("hex"),
});
/** Load one captured native tool output. */
export const nativeFixture = (name: string): Promise<string> =>
readFile(new URL(`./native-macos/${name}`, import.meta.url), "utf8");