chore: merge main and preserve plist and AppKit regressions
This commit is contained in:
@@ -8,6 +8,7 @@ import { workspaceCliTest } from "../../support/cli/workspaceCliFixture.js";
|
||||
|
||||
import {
|
||||
renderCliOutputArgumentError,
|
||||
renderEmptyFilteredCliOutput,
|
||||
sanitizeCliOutput,
|
||||
validateCliOutputArguments,
|
||||
} from "../../../src/cliOutput.js";
|
||||
@@ -140,9 +141,85 @@ describe("CLI output argument and sanitization boundary", () => {
|
||||
meta: { command: "analyze" },
|
||||
});
|
||||
});
|
||||
|
||||
it("renders an explicit empty projection for structured filtered output", () => {
|
||||
for (const format of ["json", "jsonl", "yaml"])
|
||||
expect(
|
||||
renderEmptyFilteredCliOutput([
|
||||
"providers",
|
||||
"--format",
|
||||
format,
|
||||
"--filter-output",
|
||||
"missing",
|
||||
]),
|
||||
).toBe("{}\n");
|
||||
expect(
|
||||
renderEmptyFilteredCliOutput(["providers", "--filter-output", "missing"]),
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
renderEmptyFilteredCliOutput(["providers", "--format", "json"]),
|
||||
).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("compiled CLI output boundary", () => {
|
||||
workspaceCliTest(
|
||||
"emits valid JSON when an output filter misses the top-level result",
|
||||
async ({ cli }) => {
|
||||
const result = await cli.run({
|
||||
arguments: [
|
||||
"analyze-javascript-application",
|
||||
"tests/conformance/readiness/javascript-cli",
|
||||
"--format",
|
||||
"json",
|
||||
"--filter-output",
|
||||
"summary",
|
||||
],
|
||||
});
|
||||
expect(result).toMatchObject({
|
||||
exitCode: 0,
|
||||
stdout: "{}\n",
|
||||
stderr: "",
|
||||
json: {},
|
||||
});
|
||||
const nested = await cli.run({
|
||||
arguments: [
|
||||
"analyze-javascript-application",
|
||||
"tests/conformance/readiness/javascript-cli",
|
||||
"--format",
|
||||
"json",
|
||||
"--filter-output",
|
||||
"normalized_result.not_a_field",
|
||||
],
|
||||
});
|
||||
expect(nested).toMatchObject({
|
||||
exitCode: 0,
|
||||
stderr: "",
|
||||
json: { normalized_result: {} },
|
||||
});
|
||||
const selected = await cli.run({
|
||||
arguments: [
|
||||
"analyze-javascript-application",
|
||||
"tests/conformance/readiness/javascript-cli",
|
||||
"--format",
|
||||
"json",
|
||||
"--filter-output",
|
||||
"normalized_result.summary",
|
||||
],
|
||||
});
|
||||
expect(selected).toMatchObject({
|
||||
exitCode: 0,
|
||||
stderr: "",
|
||||
json: {
|
||||
normalized_result: {
|
||||
summary: expect.objectContaining({ browser_windows: 0 }),
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
CLI_INTEGRATION_TIMEOUT_MS,
|
||||
);
|
||||
|
||||
workspaceCliTest(
|
||||
"sanitizes a real missing-argument dispatcher failure",
|
||||
async ({ cli }) => {
|
||||
|
||||
@@ -27,7 +27,7 @@ describe("executable dispatcher", () => {
|
||||
),
|
||||
workspace.write(
|
||||
"dist/cliOutput.js",
|
||||
"export const sanitizeCliOutput = (output) => output; export const validateCliOutputArguments = () => ({ ok: true }); export const renderCliOutputArgumentError = () => '';\n",
|
||||
"export const sanitizeCliOutput = (output) => output; export const validateCliOutputArguments = () => ({ ok: true }); export const renderCliOutputArgumentError = () => ''; export const renderEmptyFilteredCliOutput = () => undefined;\n",
|
||||
),
|
||||
workspace.write(
|
||||
"dist/mcpDoctor.js",
|
||||
|
||||
@@ -5,7 +5,7 @@ import { describe, expect, it } from "vitest";
|
||||
|
||||
import { classifyArtifactContent } from "../../../src/application/ArtifactGraphConstruction.js";
|
||||
import { classifyRoot } from "../../../src/application/ArtifactInventory/classify.js";
|
||||
import { ARTIFACT_CLASSIFICATION_PREFIX_BYTES } from "../../../src/application/ArtifactInventory/hash.js";
|
||||
import { ARTIFACT_CLASSIFICATION_PREFIX_BYTES } from "../../../src/artifacts/ArtifactHash.js";
|
||||
import { scanCanonicalArtifactInventory } from "../../../src/application/ArtifactInventory/scanCanonical.js";
|
||||
import { targetFormatSchema } from "../../../src/contracts/toolOutputSchemaPrimitives.js";
|
||||
import { artifactInventoryResultSchema } from "../../../src/domain/artifactGraph.js";
|
||||
|
||||
@@ -8,6 +8,7 @@ import { buildBinary } from "plist";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { analyzeInterfaceBuilderBundle } from "../../../src/application/InterfaceBuilderAnalysis.js";
|
||||
import { encodeNibArchiveFixture } from "../../../src/artifacts/NibArchive.fixture.js";
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
|
||||
const compile = promisify(execFile);
|
||||
@@ -71,6 +72,99 @@ describe("compiled Interface Builder bundle reader", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("projects compiled AppKit actions from the control to their target", async () => {
|
||||
const root = await createTestTempDirectory("rea-ib-test-");
|
||||
const bundle = join(root, "Example.app");
|
||||
const resources = join(bundle, "Contents", "Resources");
|
||||
await mkdir(resources, { recursive: true });
|
||||
// NSNibControlConnector archives the sending control as NSSource and its
|
||||
// target as NSDestination; a nil target is the first responder.
|
||||
await writeFile(
|
||||
join(resources, "Panel.nib"),
|
||||
encodeNibArchiveFixture({
|
||||
classes: [
|
||||
"NSNibExternalObjectPlaceholder",
|
||||
"NSButton",
|
||||
"NSNibControlConnector",
|
||||
"NSString",
|
||||
"NSMenuItem",
|
||||
],
|
||||
objects: [
|
||||
{ classIndex: 0, values: {} },
|
||||
{ classIndex: 1, values: {} },
|
||||
{
|
||||
classIndex: 2,
|
||||
values: {
|
||||
NSSource: { ref: 1 },
|
||||
NSDestination: { ref: 0 },
|
||||
NSLabel: { ref: 3 },
|
||||
},
|
||||
},
|
||||
{ classIndex: 3, values: { "NS.bytes": "doOK:" } },
|
||||
{ classIndex: 4, values: {} },
|
||||
{
|
||||
classIndex: 2,
|
||||
values: {
|
||||
NSSource: { ref: 4 },
|
||||
NSDestination: null,
|
||||
NSLabel: { ref: 6 },
|
||||
},
|
||||
},
|
||||
{ classIndex: 3, values: { "NS.bytes": "arrangeInFront:" } },
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
const analysis = await analyzeInterfaceBuilderBundle({
|
||||
bundlePath: bundle,
|
||||
targetSha256: "e".repeat(64),
|
||||
});
|
||||
const byId = new Map(analysis.graph.nodes.map((node) => [node.id, node]));
|
||||
const routes = analysis.graph.nodes
|
||||
.filter(({ kind }) => kind === "action")
|
||||
.map((action) => ({
|
||||
action: action.name,
|
||||
from: analysis.graph.edges
|
||||
.filter(
|
||||
({ relation, to }) =>
|
||||
relation === "target_action" && to === action.id,
|
||||
)
|
||||
.map(({ from }) => byId.get(from)?.name),
|
||||
to: analysis.graph.edges
|
||||
.filter(
|
||||
({ relation, from, to }) =>
|
||||
relation === "target_action" &&
|
||||
from === action.id &&
|
||||
(to === null || byId.get(to)?.kind !== "objc_selector"),
|
||||
)
|
||||
.map(({ to }) => (to === null ? null : byId.get(to)?.name)),
|
||||
}))
|
||||
.sort((left, right) => left.action.localeCompare(right.action));
|
||||
expect(routes).toEqual([
|
||||
{ action: "arrangeInFront:", from: ["NSMenuItem"], to: [null] },
|
||||
{
|
||||
action: "doOK:",
|
||||
from: ["NSButton"],
|
||||
to: ["NSNibExternalObjectPlaceholder"],
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("honors cancellation during directory traversal", async () => {
|
||||
const root = await createTestTempDirectory("rea-ib-test-");
|
||||
const controller = new AbortController();
|
||||
controller.abort();
|
||||
await expect(
|
||||
analyzeInterfaceBuilderBundle({
|
||||
bundlePath: root,
|
||||
targetSha256: "c".repeat(64),
|
||||
signal: controller.signal,
|
||||
}),
|
||||
).rejects.toMatchObject({ reason: "cancelled" });
|
||||
});
|
||||
});
|
||||
|
||||
describe("flat Interface Builder plist values", () => {
|
||||
it("decodes flat nib archives that hold data and date values", async () => {
|
||||
const root = await createTestTempDirectory("rea-ib-test-");
|
||||
const bundle = join(root, "Example.app");
|
||||
@@ -112,19 +206,6 @@ describe("compiled Interface Builder bundle reader", () => {
|
||||
);
|
||||
expect(analysis.graph.nodes.map(({ name }) => name)).toContain("Build");
|
||||
});
|
||||
|
||||
it("honors cancellation during directory traversal", async () => {
|
||||
const root = await createTestTempDirectory("rea-ib-test-");
|
||||
const controller = new AbortController();
|
||||
controller.abort();
|
||||
await expect(
|
||||
analyzeInterfaceBuilderBundle({
|
||||
bundlePath: root,
|
||||
targetSha256: "c".repeat(64),
|
||||
signal: controller.signal,
|
||||
}),
|
||||
).rejects.toMatchObject({ reason: "cancelled" });
|
||||
});
|
||||
});
|
||||
|
||||
describe("bounded Interface Builder archive decoding", () => {
|
||||
@@ -225,7 +306,18 @@ describe("bounded Interface Builder archive decoding", () => {
|
||||
analysis.graph.nodes.find(({ id }) => id === from)?.kind ===
|
||||
"control",
|
||||
);
|
||||
expect(actionSource).toBeDefined();
|
||||
const describeNode = (id: string | null) => {
|
||||
const node = analysis.graph.nodes.find((item) => item.id === id);
|
||||
return node === undefined ? String(id) : `${node.kind}:${node.name}`;
|
||||
};
|
||||
const actionRoutes = analysis.graph.edges
|
||||
.filter(
|
||||
({ relation, from, to }) =>
|
||||
relation === "target_action" &&
|
||||
(from === action?.id || to === action?.id),
|
||||
)
|
||||
.map(({ from, to }) => `${describeNode(from)} -> ${describeNode(to)}`);
|
||||
expect(actionSource, actionRoutes.join("; ")).toBeDefined();
|
||||
expect(
|
||||
analysis.graph.edges.some(
|
||||
({ from, relation, to }) =>
|
||||
|
||||
@@ -5,7 +5,7 @@ import { createPackage } from "@electron/asar";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { scanArtifactInventory } from "../../../src/application/ArtifactInventory.js";
|
||||
import { readJavaScriptArtifactFiles } from "../../../src/application/javascript/JavaScriptArtifactFiles.js";
|
||||
import { readJavaScriptArtifactFiles } from "../../../src/artifacts/javascript/JavaScriptArtifactFiles.js";
|
||||
import { AsarArtifactReader } from "../../../src/artifacts/AsarArtifactReader.js";
|
||||
import { DirectoryArtifactReader } from "../../../src/artifacts/DirectoryArtifactReader.js";
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
|
||||
@@ -6,7 +6,7 @@ import { expect, it } from "vitest";
|
||||
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
|
||||
import { readJavaScriptArtifactFiles } from "../../../src/application/javascript/JavaScriptArtifactFiles.js";
|
||||
import { readJavaScriptArtifactFiles } from "../../../src/artifacts/javascript/JavaScriptArtifactFiles.js";
|
||||
import { reconstructJavaScriptArtifact } from "../../../src/application/javascript/JavaScriptArtifactReconstruction.js";
|
||||
import { scanArtifactInventory } from "../../../src/application/ArtifactInventory.js";
|
||||
import {
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
resolveArtifactPathByContext,
|
||||
type ArtifactPathResolution,
|
||||
} from "../../../src/application/javascript/JavaScriptArtifactPathResolution.js";
|
||||
import type { JavaScriptArtifactFile } from "../../../src/application/javascript/JavaScriptArtifactFiles.js";
|
||||
import type { JavaScriptArtifactFile } from "../../../src/domain/javascript/javascriptArtifactFiles.js";
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
const execute = promisify(execFile);
|
||||
const TARGETS = [
|
||||
|
||||
@@ -18,6 +18,48 @@ describe("incremental module import boundaries", () => {
|
||||
["src/contracts/probe.ts", "../android/Provider.js", false],
|
||||
["src/contracts/probe.ts", "../cli.js", false],
|
||||
["src/contracts/probe.ts", "../composition/android.js", false],
|
||||
[
|
||||
"src/artifacts/javascript/probe.ts",
|
||||
"../../application/ArtifactInventory.js",
|
||||
false,
|
||||
],
|
||||
[
|
||||
"src/artifacts/javascript/probe.ts",
|
||||
"../../composition/android.js",
|
||||
false,
|
||||
],
|
||||
["src/artifacts/javascript/probe.ts", "../../cli.js", false],
|
||||
[
|
||||
"src/artifacts/ArtifactHash.ts",
|
||||
"../application/ArtifactInventory/hash.js",
|
||||
false,
|
||||
],
|
||||
[
|
||||
"src/artifacts/javascript/probe.ts",
|
||||
"../../domain/artifactInventorySnapshot.js",
|
||||
true,
|
||||
],
|
||||
["src/artifacts/javascript/probe.ts", "../AsarArtifactReader.js", true],
|
||||
[
|
||||
"src/application/javascript/probe.ts",
|
||||
"../../artifacts/AsarArtifactReader.js",
|
||||
false,
|
||||
],
|
||||
[
|
||||
"src/application/javascript/probe.ts",
|
||||
"../../artifacts/DirectoryArtifactReader.js",
|
||||
false,
|
||||
],
|
||||
[
|
||||
"src/application/javascript/probe.ts",
|
||||
"../../artifacts/javascript/JavaScriptArtifactReader.js",
|
||||
true,
|
||||
],
|
||||
[
|
||||
"src/application/ArtifactInventory/probe.ts",
|
||||
"../../artifacts/AsarArtifactReader.js",
|
||||
true,
|
||||
],
|
||||
["src/domain/probe.test.ts", "../composition/firmware.js", false],
|
||||
["src/application/probe.ts", "../android/JadxProvider.js", false],
|
||||
["src/application/probe.ts", "../composition/android.js", false],
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
<rect key="frame" x="120" y="400" width="150" height="44"/>
|
||||
<title key="title" string="Build"/>
|
||||
<connections>
|
||||
<action selector="buildTapped:" destination="vc1" id="action1"/>
|
||||
<action selector="buildTapped:" target="vc1" id="action1"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
|
||||
Reference in New Issue
Block a user