refactor(tools): remove redundant limits and acknowledgements
This commit is contained in:
@@ -156,7 +156,6 @@ async function executeReplayScenario(
|
||||
arguments: {
|
||||
...input,
|
||||
mode: "execute",
|
||||
approved: true,
|
||||
plan_digest: digest,
|
||||
},
|
||||
});
|
||||
@@ -180,7 +179,6 @@ async function createCharacterizationInput(root: string) {
|
||||
const factoryBytes = await readFile(factoryPath);
|
||||
const factorySha256 = createHash("sha256").update(factoryBytes).digest("hex");
|
||||
return {
|
||||
preparation_approved: true,
|
||||
selected_alias: "bundle",
|
||||
expected_effect: "pure",
|
||||
instrumentation: {
|
||||
@@ -230,7 +228,6 @@ async function executeCharacterizationScenario(
|
||||
const characterized = await client.callTool({
|
||||
name: "execute_node_characterization",
|
||||
arguments: {
|
||||
execution_approved: true,
|
||||
approved_plan_sha256: approvedPlan.plan_sha256,
|
||||
preparation: input,
|
||||
},
|
||||
|
||||
@@ -8,7 +8,6 @@ import { afterEach, describe, expect, it } from "vitest";
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
|
||||
import {
|
||||
JAVASCRIPT_APPLICATION_VERSION_COMPARISON_EXAMPLE,
|
||||
JAVASCRIPT_FEATURE_TRACE_FULL_EVIDENCE_EXAMPLE,
|
||||
JAVASCRIPT_FEATURE_TRACE_EXAMPLE,
|
||||
JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE,
|
||||
@@ -160,7 +159,6 @@ describe("application workflow CLI Evidence resolution", () => {
|
||||
[
|
||||
"compare-application-versions",
|
||||
JSON.stringify({
|
||||
...JAVASCRIPT_APPLICATION_VERSION_COMPARISON_EXAMPLE,
|
||||
left_evidence_id:
|
||||
JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE.left
|
||||
.evidence_id,
|
||||
|
||||
@@ -4,6 +4,7 @@ import { afterEach, describe, expect, it } from "vitest";
|
||||
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
|
||||
import { compareApplicationVersionsRequestSchema } from "../../../src/contracts/applicationWorkflowInputContracts.js";
|
||||
import { analyzeJavaScriptApplication } from "../../../src/application/JavaScriptApplicationService.js";
|
||||
import { compareApplicationVersionsEvidence } from "../../../src/application/JavaScriptApplicationWorkflowService.js";
|
||||
import { createEvidence } from "../../../src/domain/evidence.js";
|
||||
@@ -132,6 +133,41 @@ describe("JavaScript application workflows", () => {
|
||||
});
|
||||
|
||||
describe("JavaScript application comparison workflows", () => {
|
||||
it("accepts complete native evidence arrays and rejects comparison limit bags", () => {
|
||||
const native = Array.from({ length: 65 }, (_, index) =>
|
||||
createEvidence(
|
||||
{
|
||||
path: `/tmp/native-${index}.node`,
|
||||
sha256: index.toString(16).padStart(64, "0"),
|
||||
format: "elf",
|
||||
architecture: "x86_64",
|
||||
},
|
||||
{ id: "ghidra", name: "Ghidra", version: "fixture" },
|
||||
{
|
||||
operation: "analyze_function",
|
||||
parameters: { address: `0x${index.toString(16)}` },
|
||||
result: { address: `0x${index.toString(16)}` },
|
||||
},
|
||||
),
|
||||
);
|
||||
const input = {
|
||||
left: `ev_${"a".repeat(64)}`,
|
||||
right: `ev_${"b".repeat(64)}`,
|
||||
left_native_observations: native,
|
||||
};
|
||||
expect(
|
||||
compareApplicationVersionsRequestSchema.safeParse(input).success,
|
||||
).toBe(true);
|
||||
expect(
|
||||
compareApplicationVersionsRequestSchema.safeParse({
|
||||
...input,
|
||||
limits: { max_comparison_items: 1 },
|
||||
}).success,
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("complete comparison projections", () => {
|
||||
it("matches rechunked modules by exact source and minified modules by structural fingerprint", async () => {
|
||||
const root = await createTestTempDirectory("rea-application-versions-");
|
||||
temporary.push(root);
|
||||
@@ -145,6 +181,7 @@ describe("JavaScript application comparison workflows", () => {
|
||||
const result = applicationVersionComparisonResultSchema.parse(
|
||||
compared.value.normalized_result,
|
||||
);
|
||||
expectFullComparisonResultSchema(result);
|
||||
const modules = result.items.filter(
|
||||
({ node_kind: kind }) => kind === "javascript-module",
|
||||
);
|
||||
@@ -174,6 +211,9 @@ describe("JavaScript application comparison workflows", () => {
|
||||
);
|
||||
expect(result.summary.added).toBeGreaterThan(0);
|
||||
expect(result.summary.removed).toBeGreaterThan(0);
|
||||
expect(result.coverage).not.toHaveProperty("omitted_graph_nodes");
|
||||
expect(result.coverage).not.toHaveProperty("omitted_graph_edges");
|
||||
expect(result.coverage).not.toHaveProperty("omitted_graph_observations");
|
||||
expect(result.graph.edges).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
@@ -216,7 +256,7 @@ describe("JavaScript application comparison workflows", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps incomplete one-sided absence unknown and reports output truncation", () => {
|
||||
it("keeps incomplete one-sided absence unknown and reports source omissions", () => {
|
||||
const complete = buildSyntheticJavaScriptApplicationGraph();
|
||||
const rootNode = complete.nodes.find(({ node_id: id }) =>
|
||||
complete.root_node_ids.includes(id),
|
||||
@@ -248,12 +288,6 @@ describe("JavaScript application comparison workflows", () => {
|
||||
},
|
||||
leftNativeEvidence: [],
|
||||
rightNativeEvidence: [],
|
||||
limits: {
|
||||
max_comparison_items: 1,
|
||||
max_candidate_nodes: 1,
|
||||
max_graph_nodes: 20,
|
||||
max_graph_edges: 20,
|
||||
},
|
||||
};
|
||||
|
||||
const first = compareJavaScriptApplicationVersions(input);
|
||||
@@ -262,8 +296,8 @@ describe("JavaScript application comparison workflows", () => {
|
||||
expect(first.coverage).toMatchObject({
|
||||
status: "truncated",
|
||||
right_graph_status: "partial",
|
||||
right_graph_omitted_count: complete.nodes.length - 1,
|
||||
});
|
||||
expect(first.coverage.omitted_comparison_items).toBeGreaterThan(0);
|
||||
expect(first.summary.removed).toBe(0);
|
||||
expect(first.summary.unknown).toBeGreaterThan(0);
|
||||
});
|
||||
@@ -310,8 +344,40 @@ const expectComparisonItemAlgebra = (
|
||||
coverage: {
|
||||
...result.coverage,
|
||||
status: "complete-within-inputs",
|
||||
omitted_comparison_items: 1,
|
||||
left_graph_status: "partial",
|
||||
},
|
||||
}).success,
|
||||
).toBe(false);
|
||||
};
|
||||
|
||||
const expectFullComparisonResultSchema = (
|
||||
result: ApplicationVersionComparisonResult,
|
||||
): void => {
|
||||
const candidateNodeIds = Array.from(
|
||||
{ length: 1_001 },
|
||||
(_, index) => `jag_node_${index.toString(16).padStart(64, "0")}`,
|
||||
);
|
||||
const expanded = {
|
||||
...result,
|
||||
evidence_links: Array.from(
|
||||
{ length: 131 },
|
||||
(_, index) => `ev_${index.toString(16).padStart(64, "0")}`,
|
||||
),
|
||||
items: result.items.map((item) =>
|
||||
item.match.status === "ambiguous"
|
||||
? {
|
||||
...item,
|
||||
match: {
|
||||
...item.match,
|
||||
...(item.match.candidate_left_node_ids.length === 0
|
||||
? { candidate_right_node_ids: candidateNodeIds }
|
||||
: { candidate_left_node_ids: candidateNodeIds }),
|
||||
},
|
||||
}
|
||||
: item,
|
||||
),
|
||||
};
|
||||
expect(
|
||||
applicationVersionComparisonResultSchema.safeParse(expanded).success,
|
||||
).toBe(true);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user