fix(artifacts): carry recorded integrity contradictions into application workflows

A recorded contradiction appeared only in the analyze_javascript_application
response. Version and source comparisons, feature traces, and export-shape
comparisons read the application graph, which still claimed complete
coverage, so they could report complete-within-inputs results over
untrusted bytes. The graph is now partial when contradictions were
recorded, and its limitations, inherited by the result and the semantic
graph, name every contradicted path.

The mismatch remediation names both spellings: integrity_policy in MCP
and --integrity-policy on the CLI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-07 08:50:41 +00:00
co-authored by Claude Opus 5.5
parent 92b373e660
commit 5aafaa00ec
7 changed files with 53 additions and 15 deletions
@@ -8,6 +8,7 @@ import { z } from "zod";
import { createTestTempDirectory } from "../../../tests/fixtures/temporaryDirectory.js";
import { projectAnalysisError } from "../../domain/analysisErrorProjection.js";
import { analyzeJavaScriptApplication } from "./JavaScriptApplicationService.js";
import { compareApplicationVersionsEvidence } from "./JavaScriptApplicationWorkflowService.js";
describe("JavaScript application failure diagnostics", () => {
it("identifies the rejected result field in caller-visible diagnostics", async () => {
@@ -122,6 +123,9 @@ describe("JavaScript application failure diagnostics", () => {
);
});
const CONTRADICTION_LIMITATION =
"Observed bytes of 1 artifact file(s) contradict declared integrity and are untrusted; contradicted nested archives were not expanded: addon.node.";
describe("JavaScript application artifact integrity", () => {
it("analyzes a signed-after-packaging native module only when the mismatch is recorded", async () => {
const root = await createTestTempDirectory("rea-js-integrity-");
@@ -169,9 +173,27 @@ describe("JavaScript application artifact integrity", () => {
trust: "observed-untrusted",
},
],
limitations: expect.arrayContaining([
"1 artifact file(s) contradict declared integrity; their observed bytes are untrusted, and contradicted nested archives were not expanded.",
]),
graph: { coverage: { status: "partial" } },
limitations: expect.arrayContaining([CONTRADICTION_LIMITATION]),
semantic_graph: {
limitations: expect.arrayContaining([CONTRADICTION_LIMITATION]),
},
});
// Workflows built on the recorded graph inherit its partial coverage.
const clean = await analyzeJavaScriptApplication({
input_path: source,
format: "directory",
});
if (!clean.ok) throw new Error("Expected clean analysis");
const comparison = compareApplicationVersionsEvidence({
left: clean.value,
right: recorded.value,
});
expect(comparison.ok).toBe(true);
if (!comparison.ok) throw new Error("Expected comparison");
expect(comparison.value.normalized_result).toMatchObject({
coverage: { status: "partial", right_graph_status: "partial" },
});
});
});