feat(native): add inspection primitives, dispatch traces and approved UI observation (#500)
* fix(hopper): normalize string-backed addresses and update verification * feat(native): add inspection primitives, dispatch traces and approved UI observation * test: prioritize real artifact E2E and captured golden regressions * fix(process): queue observed output before reactive rendering actions * test: prune redundant cases and strengthen boundary assertions * fix(cli): route native value tracing through shared workflows * test: replace synthetic success with real workflows and captured data * fix(catalog): separate portable metadata from native host availability
This commit is contained in:
@@ -115,6 +115,7 @@ describe("client configuration filesystem lifecycle", () => {
|
||||
`[mcp_servers.rea]\ncommand = "rea"\nargs = ["mcp"]\nstartup_timeout_sec = 30\n\n[mcp_servers.rea.env]\nJAVA_HOME = "/opt/jdk-21"\nHOPPER_LAUNCHER_PATH = "/Hopper Path"\nGHIDRA_INSTALL_DIR = "/opt/ghidra"\n`,
|
||||
);
|
||||
|
||||
const original = await readFile(configPath, "utf8");
|
||||
expect(
|
||||
await configureTomlClient(
|
||||
{ name: "codex", configPath, format: "toml" },
|
||||
@@ -126,6 +127,7 @@ describe("client configuration filesystem lifecycle", () => {
|
||||
["rea", "mcp"],
|
||||
),
|
||||
).toEqual({ status: "unchanged" });
|
||||
expect(await readFile(configPath, "utf8")).toBe(original);
|
||||
await expect(
|
||||
readFile(`${configPath}.rea.backup`, "utf8"),
|
||||
).rejects.toThrow();
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { decodeKeyedArchiveBytes } from "../../../src/artifacts/KeyedArchiveReader.js";
|
||||
import {
|
||||
parseAppleAssetCatalogRecords,
|
||||
projectAppleAssetCatalogPage,
|
||||
} from "../../../src/domain/appleAssetCatalog.js";
|
||||
|
||||
const golden = (path: string) =>
|
||||
new URL(`../../fixtures/golden/${path}`, import.meta.url);
|
||||
|
||||
describe("captured Apple artifact goldens", () => {
|
||||
it("matches the complete Foundation object graph without instantiating its classes", async () => {
|
||||
const expected: unknown = JSON.parse(
|
||||
await readFile(golden("keyed-archive/graph.json"), "utf8"),
|
||||
);
|
||||
expect(
|
||||
decodeKeyedArchiveBytes(
|
||||
await readFile(golden("keyed-archive/foundation.xml")),
|
||||
{ offset: 0, limit: 20000 },
|
||||
),
|
||||
).toEqual(expected);
|
||||
});
|
||||
|
||||
it("preserves every field from captured assetutil output", async () => {
|
||||
const captured: unknown = JSON.parse(
|
||||
await readFile(golden("assetutil.json"), "utf8"),
|
||||
);
|
||||
const records = parseAppleAssetCatalogRecords(captured);
|
||||
const page = projectAppleAssetCatalogPage({
|
||||
targetSha256: "c".repeat(64),
|
||||
catalogs: [
|
||||
{
|
||||
path: "Contents/Resources/Assets.car",
|
||||
sha256: "a".repeat(64),
|
||||
records,
|
||||
},
|
||||
],
|
||||
offset: 0,
|
||||
limit: records.length,
|
||||
});
|
||||
expect(page.records.map(({ metadata }) => metadata)).toEqual(captured);
|
||||
expect(page.records).toContainEqual(
|
||||
expect.objectContaining({
|
||||
kind: "rendition",
|
||||
asset_name: "FixtureColor",
|
||||
metadata: expect.objectContaining({
|
||||
AssetType: "Color",
|
||||
"Color components": [0.125, 0.5, 0.875, 1],
|
||||
}),
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,39 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { expect, it } from "vitest";
|
||||
import { parse } from "yaml";
|
||||
import { z } from "zod";
|
||||
|
||||
// Publishing is irreversible. Keep the release authority invariant as a static
|
||||
// boundary check; it is not proof that package installation or publishing works.
|
||||
it("requires package verification before publishing and retains the registry canary", async () => {
|
||||
const workflow = z
|
||||
.object({
|
||||
jobs: z.object({
|
||||
publish: z.object({
|
||||
steps: z.array(z.object({ run: z.string().optional() })),
|
||||
}),
|
||||
}),
|
||||
})
|
||||
.parse(
|
||||
parse(
|
||||
await readFile(
|
||||
new URL("../../../.github/workflows/release.yml", import.meta.url),
|
||||
"utf8",
|
||||
),
|
||||
),
|
||||
);
|
||||
const commands = workflow.jobs.publish.steps.map(({ run }) => run ?? "");
|
||||
const verify = commands.findIndex((command) =>
|
||||
command.includes("npm run verify:package"),
|
||||
);
|
||||
const publish = commands.findIndex((command) =>
|
||||
command.includes("npm publish"),
|
||||
);
|
||||
expect(verify).toBeGreaterThanOrEqual(0);
|
||||
expect(publish).toBeGreaterThan(verify);
|
||||
expect(
|
||||
commands
|
||||
.slice(publish + 1)
|
||||
.some((command) => command.includes("verify-published-package.mjs")),
|
||||
).toBe(true);
|
||||
});
|
||||
Reference in New Issue
Block a user