refactor(workflows): simplify evidence reference inputs
This commit is contained in:
@@ -108,9 +108,9 @@ async function runEvidenceIdScenarios(harness: TestHarness): Promise<void> {
|
||||
const comparedById = await harness.client.callTool({
|
||||
name: "compare_application_versions",
|
||||
arguments: {
|
||||
left_evidence_id:
|
||||
JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE.left.evidence_id,
|
||||
right_evidence_id:
|
||||
left: JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE.left
|
||||
.evidence_id,
|
||||
right:
|
||||
JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE.right.evidence_id,
|
||||
},
|
||||
});
|
||||
@@ -145,15 +145,16 @@ async function runEvidenceIdScenarios(harness: TestHarness): Promise<void> {
|
||||
});
|
||||
expect(mixedRightInline.isError).not.toBe(true);
|
||||
|
||||
const mixedWithLegacyAlias = await harness.client.callTool({
|
||||
const legacyAliases = await harness.client.callTool({
|
||||
name: "compare_application_versions",
|
||||
arguments: {
|
||||
left: JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE.left,
|
||||
left_evidence_id:
|
||||
JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE.left.evidence_id,
|
||||
right_evidence_id:
|
||||
JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE.right.evidence_id,
|
||||
},
|
||||
});
|
||||
expect(mixedWithLegacyAlias.isError).not.toBe(true);
|
||||
expect(legacyAliases.isError).toBe(true);
|
||||
|
||||
const sourceComparedById = await harness.client.callTool({
|
||||
name: "compare_source_to_bundle",
|
||||
@@ -243,16 +244,16 @@ async function assertRejectedInlineEvidence(client: Client): Promise<void> {
|
||||
});
|
||||
expect(spoofed.isError).toBe(true);
|
||||
|
||||
const duplicateComparisonReference = await client.callTool({
|
||||
const legacyComparisonReferences = await client.callTool({
|
||||
name: "compare_application_versions",
|
||||
arguments: {
|
||||
left: JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE.left,
|
||||
left_evidence_id:
|
||||
JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE.left.evidence_id,
|
||||
right: JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE.right,
|
||||
right_evidence_id:
|
||||
JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE.right.evidence_id,
|
||||
},
|
||||
});
|
||||
expect(duplicateComparisonReference.isError).toBe(true);
|
||||
expect(legacyComparisonReferences.isError).toBe(true);
|
||||
}
|
||||
|
||||
describe("application workflow MCP parity", () => {
|
||||
|
||||
@@ -83,8 +83,8 @@ describe("application workflow MCP parity", () => {
|
||||
const byId = await client.callTool({
|
||||
name: "compare_javascript_export_shapes",
|
||||
arguments: {
|
||||
left_evidence_id: left.value.evidence_id,
|
||||
right_evidence_id: right.value.evidence_id,
|
||||
left: left.value.evidence_id,
|
||||
right: right.value.evidence_id,
|
||||
...selectors,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -159,10 +159,9 @@ describe("application workflow CLI Evidence resolution", () => {
|
||||
[
|
||||
"compare-application-versions",
|
||||
JSON.stringify({
|
||||
left_evidence_id:
|
||||
JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE.left
|
||||
.evidence_id,
|
||||
right_evidence_id:
|
||||
left: JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE.left
|
||||
.evidence_id,
|
||||
right:
|
||||
JAVASCRIPT_VERSION_COMPARISON_FULL_EVIDENCE_EXAMPLE.right
|
||||
.evidence_id,
|
||||
}),
|
||||
@@ -251,8 +250,8 @@ describe("application workflow CLI export Evidence", () => {
|
||||
[
|
||||
"compare-javascript-export-shapes",
|
||||
JSON.stringify({
|
||||
left_evidence_id: left.value.evidence_id,
|
||||
right_evidence_id: right.value.evidence_id,
|
||||
left: left.value.evidence_id,
|
||||
right: right.value.evidence_id,
|
||||
left_module_path: "parser.mjs",
|
||||
left_export_name: "default",
|
||||
right_module_path: "parser.mjs",
|
||||
|
||||
@@ -4,7 +4,10 @@ import { afterEach, describe, expect, it } from "vitest";
|
||||
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
|
||||
import { compareApplicationVersionsRequestSchema } from "../../../src/contracts/applicationWorkflowInputContracts.js";
|
||||
import {
|
||||
compareApplicationVersionsRequestSchema,
|
||||
compareJavaScriptExportShapesRequestSchema,
|
||||
} 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";
|
||||
@@ -164,6 +167,33 @@ describe("JavaScript application comparison workflows", () => {
|
||||
limits: { max_comparison_items: 1 },
|
||||
}).success,
|
||||
).toBe(false);
|
||||
expect(
|
||||
compareApplicationVersionsRequestSchema.safeParse({
|
||||
left_evidence_id: `ev_${"a".repeat(64)}`,
|
||||
right_evidence_id: `ev_${"b".repeat(64)}`,
|
||||
}).success,
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("uses one consistent Evidence reference shape for export comparisons", () => {
|
||||
const request = {
|
||||
left: `ev_${"a".repeat(64)}`,
|
||||
right: `ev_${"b".repeat(64)}`,
|
||||
left_module_path: "parser.mjs",
|
||||
left_export_name: "default",
|
||||
right_module_path: "parser.mjs",
|
||||
right_export_name: "default",
|
||||
};
|
||||
expect(
|
||||
compareJavaScriptExportShapesRequestSchema.safeParse(request).success,
|
||||
).toBe(true);
|
||||
expect(
|
||||
compareJavaScriptExportShapesRequestSchema.safeParse({
|
||||
...request,
|
||||
left_evidence_id: request.left,
|
||||
left: undefined,
|
||||
}).success,
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { projectManagedApplicationGraphEvidence } from "../../../src/application/ManagedApplicationGraphService.js";
|
||||
import { managedApplicationGraphReferenceInputSchema } from "../../../src/contracts/managedWorkflowToolContracts.js";
|
||||
import { traceApplicationFeatureEvidence } from "../../../src/application/JavaScriptApplicationWorkflowService.js";
|
||||
import { MANAGED_STATIC_PROVIDER } from "../../../src/application/InvestigationProviders.js";
|
||||
import { createEvidence, parseEvidence } from "../../../src/domain/evidence.js";
|
||||
@@ -159,6 +160,26 @@ describe("managed application graph projection", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("managed application graph request", () => {
|
||||
it("accepts any nonempty set of sources and rejects duplicate IDs", () => {
|
||||
const id = `ev_${"a".repeat(64)}`;
|
||||
expect(
|
||||
managedApplicationGraphReferenceInputSchema.safeParse({
|
||||
managed_members_evidence_id: id,
|
||||
}).success,
|
||||
).toBe(true);
|
||||
expect(
|
||||
managedApplicationGraphReferenceInputSchema.safeParse({}).success,
|
||||
).toBe(false);
|
||||
expect(
|
||||
managedApplicationGraphReferenceInputSchema.safeParse({
|
||||
managed_members_evidence_id: id,
|
||||
managed_native_boundaries_evidence_id: id,
|
||||
}).success,
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("managed application graph coverage", () => {
|
||||
it("preserves partial parser coverage in graph and per-fact coverage", () => {
|
||||
const bytes = buildManagedPeFixture();
|
||||
|
||||
Reference in New Issue
Block a user