diff --git a/src/application/binary/BinarySessionInvestigation.test.ts b/src/application/binary/BinarySessionInvestigation.test.ts index edd33d42f39..d952adf386b 100644 --- a/src/application/binary/BinarySessionInvestigation.test.ts +++ b/src/application/binary/BinarySessionInvestigation.test.ts @@ -280,12 +280,14 @@ it("adopts a later recording's selection without erasing retained display metada // selected path; adopting the bundle's later selection must keep that path. const foreign = createEvidenceBundle([observation("provider_run")]); expect(session.importEvidenceBundle(foreign).ok).toBe(true); - expect(session.recordEvidence( - withEvidenceCallerInputPath( - observation("provider_run"), - "/selected/app.bin", - ), - ).ok).toBe(true); + expect( + session.recordEvidence( + withEvidenceCallerInputPath( + observation("provider_run"), + "/selected/app.bin", + ), + ).ok, + ).toBe(true); const [record] = session.exportEvidenceBundle().records; expect(record?.caller_input_path).toBe("/selected/app.bin"); expect(record?.provider_selection).toMatchObject({ diff --git a/tests/boundary/filesystem/composedWorkflowEvidenceLinks.test.ts b/tests/boundary/filesystem/composedWorkflowEvidenceLinks.test.ts index 2fc5678cdde..e8bc8fbb611 100644 --- a/tests/boundary/filesystem/composedWorkflowEvidenceLinks.test.ts +++ b/tests/boundary/filesystem/composedWorkflowEvidenceLinks.test.ts @@ -5,7 +5,11 @@ import { ok } from "../../../src/domain/result.js"; import { createDeferred } from "../../fixtures/binarySession.js"; import { expect, it } from "vitest"; import { runDirectAnalysis } from "../../../src/application/DirectAnalysis.js"; -import { createEvidence, parseEvidence } from "../../../src/domain/evidence.js"; +import { + createEvidence, + evidenceSemanticContent, + parseEvidence, +} from "../../../src/domain/evidence.js"; import { composedWorkflowFixture } from "../../fixtures/composedWorkflowEvidence.js"; import { readFile, writeFile } from "node:fs/promises"; import { dirname, join } from "node:path"; @@ -403,11 +407,24 @@ it("reruns an ambiguous snapshot binding before selecting composed Evidence link const originalRecord = snapshot.value.evidence_bundle.records.find( ({ evidence_id }) => evidence_id === initial.value.evidenceId, ); - expect(replay.session.evidenceById(after.value.evidenceId)).toEqual( - originalRecord, + if (originalRecord === undefined) + throw new Error("Snapshot did not carry the initial record"); + const replayedRecord = replay.session.evidenceById(after.value.evidenceId); + if (replayedRecord === undefined) + throw new Error("Replay did not commit the reproduced record"); + // The replay session opens a different temp copy of the artifact, so the + // subject's display path and the session-attributed provider selection are + // presentation metadata, not part of the id. Compare what the id commits to. + expect(evidenceSemanticContent(replayedRecord)).toEqual( + evidenceSemanticContent(originalRecord), ); - expect(replay.session.evidenceById(alternative.evidence_id)).toEqual( - alternative, + const replayedAlternative = replay.session.evidenceById( + alternative.evidence_id, + ); + if (replayedAlternative === undefined) + throw new Error("Replay did not carry the alternative record"); + expect(evidenceSemanticContent(replayedAlternative)).toEqual( + evidenceSemanticContent(alternative), ); const composed = await executeComposedWorkflow(