fix(analysis-view): keep inferred confidence on views of inferred Evidence (#8099)

createAnalysisViewEvidence chose view confidence from the view result kind
only, so every summary, page or item view of an inferred parent
(compare_source_to_bundle, inspect_evm_interface, partially resolved
inspect_il2cpp_metadata) was sealed as derived while keeping the parent's
authority. A projection never makes its facts more certain: an inferred
parent now yields inferred views through CLI and MCP alike. Observed and
derived parents keep their existing view confidence and identities.

Fixes #8098

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822andClaude Opus 5.5 authored and GitHub committed 2026-10-30 00:59:53 -07:00
1 parent 317bf3fe23
commit bfa082f777
7 files changed
+114 -3

No files matched your search

@@ -10,7 +10,9 @@ import {
analysisViewJavaScriptAnalysisWithSource,
analysisViewJavaScriptEvidence,
analysisViewLayoutEvidence,
analysisViewLayoutFixture,
} from "../../../tests/fixtures/analysisView.js";
import { BINARY_LAYOUT_TEST_PROVIDER } from "../../../tests/fixtures/binaryDiagnostics/layout.js";
import { describe, expect, it, vi } from "vitest";
import { JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE } from "../../contracts/javascript/javascriptRuntimeReconciliationExample.js";
@@ -450,6 +452,54 @@ it("projects inline layout Evidence and retains a derived view record", async ()
});
});
it("never seals a view as more certain than its parent Evidence", async () => {
const layout = analysisViewLayoutFixture();
for (const [confidence, expected] of [
["observed", "derived"],
["derived", "derived"],
["inferred", "inferred"],
] as const) {
const parent = createEvidence(
{
path: layout.artifact.path,
format: "elf",
architecture: "x86_64",
sha256: layout.artifact.sha256,
},
BINARY_LAYOUT_TEST_PROVIDER,
{
operation: "inspect_binary_layout",
parameters: { path: layout.artifact.path },
result: layout,
confidence,
limitations: layout.limitations,
},
);
// Inline CLI/MCP views and retained summary delivery share one sealing owner.
const views = [
await inspectAnalysisView({
source: { kind: "inline", evidence: parent },
view: { kind: "item", collection: "sections", selector: { index: 2 } },
}),
projectRetainedAnalysis(
parent,
{
recordEvidence: () => ok("added"),
evidenceById: (id) =>
id === parent.evidence_id ? parent : undefined,
},
{ kind: "summary" },
),
];
for (const view of views) {
if (!view.ok) throw view.error;
expect(view.value.confidence).toBe(expected);
expect(view.value.authority).toBe(parent.authority);
expect(view.value.evidence_links).toEqual([parent.evidence_id]);
}
}
});
it("resolves same-session retained JavaScript Evidence without re-running analysis", async () => {
const parent = analysisViewJavaScriptEvidence(
analysisViewJavaScriptAnalysisWithSource(),