fix(native): retain value trace source evidence (#8384)

* fix(native): retain value trace source evidence

* fix(native): build trace error evidence only on failure

* test(mcp): expect unowned value trace refusal

* test(mcp): avoid freezing trace error wording

* test(native): keep value-trace stop coverage with source evidence

Main's stop and continuation cases now meet the trace's evidence-owner
precondition: direct calls supply a source id, and a completed MCP trace
runs in a session that can retain it.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
morlutoandCursor Agent authored and GitHub committed 2026-11-05 00:19:50 +08:00
1 parent 25b62db838
commit 52bca6de41
22 files changed
+403 -37

No files matched your search

@@ -1182,6 +1182,71 @@ it("does not replay pre-envelope call graphs under the revised workflow profile"
).toBe(false);
});
it("keeps older value-trace Evidence as history without replaying its source IDs", () => {
const cache = new AnalysisSnapshotCache();
const target = ANALYSIS_SNAPSHOT_TARGET;
const profile = ANALYSIS_SNAPSHOT_PROFILE;
const operation = "trace_native_values" as const;
const parameters = { procedure: "0x1000" };
const oldProfile = workflowAnalysisProfile(profile);
const oldResult = {
seed: "0x1000",
target_sha256: target.sha256,
nodes: [],
edges: [],
procedures: [
{
address: "0x1000",
depth: 0,
evidence_id: `ev_${"a".repeat(64)}`,
provider: profile.provider.id,
analysis_profile_digest: profile.digest,
},
],
unknowns: [],
total_nodes: 0,
total_edges: 0,
decompilations: 1,
next_offset: null,
page_truncated: false,
traversal: { status: "complete" },
truncated: false,
limitations: [],
};
const execution = {
...createAnalysisExecution(oldResult, REA_WORKFLOW_PROVIDER, {
subject: target,
}),
analysisProfile: oldProfile,
};
cache.recordWorkflow({ target, profile, operation, parameters, execution });
const evidence = createEvidence(target, REA_WORKFLOW_PROVIDER, {
operation,
parameters,
result: oldResult,
confidence: "derived",
analysisProfile: oldProfile,
});
const exported = cache.export(
target,
profile,
createEvidenceBundle([evidence]),
);
if (!exported.ok) throw exported.error;
const snapshot = parseAnalysisSnapshot(exported.value);
expect(snapshot.evidence_bundle.records).toContainEqual(evidence);
expect(
snapshotEvidenceForQuery(snapshot, {
target,
bindingProfile: profile,
operation,
parameters,
provider: REA_WORKFLOW_PROVIDER,
evidenceProfile: workflowAnalysisProfile(profile, operation),
}),
).toBeUndefined();
});
it("declines source-bearing snapshot entries while replaying omitted and empty source controls", () => {
const cache = new AnalysisSnapshotCache();
const target = ANALYSIS_SNAPSHOT_TARGET;
+1 -1
View File
@@ -12,8 +12,8 @@ import {
snapshotMatchesTarget,
snapshotTarget,
type SnapshotBindingMismatch,
type AnalysisSnapshot,
} from "../../domain/analysisSnapshot.js";
import type { AnalysisSnapshot } from "../../domain/analysisSnapshot.js";
import { parseBinaryTarget } from "../BinaryTargetResolver.js";
import type { ArtifactResourceScope } from "../../artifacts/ArtifactResourceScope.js";
import {