refactor(tools): remove redundant limits and acknowledgements
This commit is contained in:
@@ -10,7 +10,7 @@ import { analyzeJavaScriptApplicationInputSchema } from "../../../src/domain/jav
|
||||
import { writeElectronBoundaryFixture } from "../../fixtures/electronBoundaryApplication.js";
|
||||
|
||||
describe("static Electron application analysis", () => {
|
||||
it("accepts a caller path and caller-selected analysis bounds", () => {
|
||||
it("accepts an absolute caller path without caller-selected analysis bounds", () => {
|
||||
expect(
|
||||
analyzeJavaScriptApplicationInputSchema.safeParse({
|
||||
input_path: "relative/app.asar",
|
||||
@@ -24,20 +24,14 @@ describe("static Electron application analysis", () => {
|
||||
expect(
|
||||
analyzeJavaScriptApplicationInputSchema.safeParse({
|
||||
input_path: "/tmp/app.asar",
|
||||
limits: {
|
||||
max_entries: 100_000,
|
||||
max_findings: 200_000,
|
||||
},
|
||||
limits: { max_findings: 200_000 },
|
||||
}).success,
|
||||
).toBe(true);
|
||||
).toBe(false);
|
||||
expect(
|
||||
analyzeJavaScriptApplicationInputSchema.parse({
|
||||
input_path: "/tmp/app.asar",
|
||||
}),
|
||||
).toMatchObject({
|
||||
format: "auto",
|
||||
limits: { max_findings: 8_000 },
|
||||
});
|
||||
).toEqual({ input_path: "/tmp/app.asar", format: "auto" });
|
||||
});
|
||||
|
||||
it("maps windows, preload, contextBridge, IPC, validations, utility, and native boundaries without execution", async () => {
|
||||
|
||||
@@ -148,31 +148,40 @@ describe("CommonJS and ESM module relationships", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("CommonJS and ESM relationship limits", () => {
|
||||
it("retains exact semantic omissions when the relationship budget truncates", async () => {
|
||||
const root = await createTestTempDirectory("rea-module-limit-");
|
||||
await writeFile(
|
||||
join(root, "exports.mjs"),
|
||||
"export const first = 1; export const second = 2; export const third = 3;",
|
||||
describe("complete static application projections", () => {
|
||||
it("retains exports and JSON keys beyond the former projection prefix", async () => {
|
||||
const root = await moduleFixture();
|
||||
const exportNames = Array.from(
|
||||
{ length: 140 },
|
||||
(_, index) =>
|
||||
`export const retained_${String(index).padStart(3, "0")} = ${index};`,
|
||||
);
|
||||
const result = await reconstructJavaScriptArtifact({
|
||||
input_path: root,
|
||||
limits: { max_findings: 1 },
|
||||
});
|
||||
const jsonKeys = Object.fromEntries(
|
||||
Array.from({ length: 140 }, (_, index) => [`key_${index}`, index]),
|
||||
);
|
||||
await Promise.all([
|
||||
writeFile(join(root, "many-exports.mjs"), exportNames.join("\n")),
|
||||
writeFile(join(root, "many.json"), JSON.stringify(jsonKeys)),
|
||||
]);
|
||||
|
||||
expect(result.statistics.truncated_scopes).toBeGreaterThan(0);
|
||||
expect(
|
||||
result.graph.nodes.filter((node) =>
|
||||
node.observations.some(
|
||||
({ properties }) => properties.semantic_role === "export-binding",
|
||||
),
|
||||
const { graph } = await reconstructJavaScriptArtifact({ input_path: root });
|
||||
const module = sourceModule(graph, "many-exports.mjs");
|
||||
const exportObservation = module?.observations.find(
|
||||
({ properties }) => properties.semantic_role === "source-module",
|
||||
);
|
||||
const json = graph.nodes.find((node) =>
|
||||
node.observations.some(
|
||||
({ properties }) => properties.path === "many.json",
|
||||
),
|
||||
).toHaveLength(1);
|
||||
expect(result.graph.coverage).toMatchObject({
|
||||
status: "partial",
|
||||
truncated: true,
|
||||
omitted_count: 2,
|
||||
});
|
||||
);
|
||||
const jsonObservation = json?.observations.find(
|
||||
({ properties }) => properties.path === "many.json",
|
||||
);
|
||||
|
||||
expect(exportObservation?.properties.export_names).toHaveLength(140);
|
||||
expect(exportObservation?.properties.omitted_export_names).toBe(0);
|
||||
expect(jsonObservation?.properties.json_top_level_keys).toHaveLength(140);
|
||||
expect(jsonObservation?.properties.omitted_json_top_level_keys).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -178,7 +178,6 @@ it("reconciles active Electron as a partial target-only runtime capture", async
|
||||
application_path: applicationPath,
|
||||
application_root: fixture,
|
||||
actions: [],
|
||||
approved: true,
|
||||
});
|
||||
const runtimeEvidence = createElectronActiveEvidence(
|
||||
input,
|
||||
@@ -220,7 +219,6 @@ it("hashes the retained Electron scenario projection, not raw selectors or secre
|
||||
application_root: fixture,
|
||||
args: ["--token", secret],
|
||||
actions: [{ step_id: "click", kind: "click", selector }],
|
||||
approved: true,
|
||||
});
|
||||
const provider = {
|
||||
id: "rea-playwright-electron-active",
|
||||
@@ -342,22 +340,20 @@ const electronRuntimeEvidence = (
|
||||
readonly scriptFile?: string;
|
||||
readonly includeWorker?: boolean;
|
||||
readonly targetId?: string;
|
||||
readonly sourceCaptureApproved?: boolean;
|
||||
readonly sourceIncluded?: boolean;
|
||||
readonly workersUnavailable?: boolean;
|
||||
} = {},
|
||||
) => {
|
||||
const scriptFile = options.scriptFile ?? "app.js";
|
||||
const includeWorker = options.includeWorker ?? true;
|
||||
const targetId = options.targetId ?? "target-main";
|
||||
const sourceCaptureApproved = options.sourceCaptureApproved ?? true;
|
||||
const sourceIncluded = options.sourceIncluded ?? true;
|
||||
const input = inspectElectronPageInputSchema.parse({
|
||||
cdp_endpoint: "http://127.0.0.1:9223",
|
||||
allowed_file_roots: [root],
|
||||
target_id: targetId,
|
||||
approved: true as const,
|
||||
observation_ms: 100,
|
||||
include_script_sources: sourceCaptureApproved,
|
||||
source_capture_approved: sourceCaptureApproved,
|
||||
include_script_sources: sourceIncluded,
|
||||
limits: {
|
||||
max_frames: 200,
|
||||
max_dom_nodes: 2_000,
|
||||
|
||||
Reference in New Issue
Block a user