From 9ecfb109e8c40ac64ca637b381ba25eec7d08ec9 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Mon, 16 Nov 2026 09:53:13 +0800 Subject: [PATCH] test(evidence): assert the identity-named subject in the snapshot and kernel config tests (#11650) #11551 made a snapshot entry's subject the Evidence subject schema and #11416 moved the subject's format under identity. Two tests that merged alongside them still asserted the old shapes and fail on main: - evidenceSubject.test.ts parsed the snapshot subject with the retired {format, architecture, path, sha256} projection and expected it to strip extra fields. It now asserts the snapshot subject is the Evidence subject schema, whose admission and strictness the rest of the test covers. - KernelBuildConfigService.test.ts matched subject.format; it now matches subject.identity.format. --- .../KernelBuildConfigService.test.ts | 2 +- src/domain/evidenceSubject.test.ts | 18 +++--------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/application/binaryDiagnostics/KernelBuildConfigService.test.ts b/src/application/binaryDiagnostics/KernelBuildConfigService.test.ts index f555174972..e73bcadad5 100644 --- a/src/application/binaryDiagnostics/KernelBuildConfigService.test.ts +++ b/src/application/binaryDiagnostics/KernelBuildConfigService.test.ts @@ -77,7 +77,7 @@ it.each([ if (!result.ok) throw result.error; expect(result.value).toMatchObject({ confidence: "observed", - subject: { format }, + subject: { identity: { format } }, normalized_result: report, }); }, diff --git a/src/domain/evidenceSubject.test.ts b/src/domain/evidenceSubject.test.ts index 1c272d9d00..b9dac97ea9 100644 --- a/src/domain/evidenceSubject.test.ts +++ b/src/domain/evidenceSubject.test.ts @@ -13,6 +13,9 @@ const digest = "a".repeat(64); describe("persisted observation subject declarations", () => { it("keeps Evidence and cache admission aligned for every format and architecture", () => { + // A snapshot entry commits to its Evidence record's subject, so cache + // admission parses the Evidence subject declaration itself. + expect(snapshotSubject).toBe(evidenceSubject); for (const format of evidenceSubjectFormatSchema.options) { for (const architecture of [ ...BINARY_ARCHITECTURES, @@ -30,11 +33,6 @@ describe("persisted observation subject declarations", () => { name: "fixture", local_path: "/tmp/fixture", }); - const snapshot = snapshotSubject.safeParse({ - ...declaration, - path: "/tmp/fixture", - sha256: digest, - }); const allowed = architecture !== "unsupported" && (format === "gamecube-dol" @@ -42,7 +40,6 @@ describe("persisted observation subject declarations", () => { : format === "raw-binary" || (architecture !== "6502" && architecture !== "m68k")); expect(evidence.success, JSON.stringify(declaration)).toBe(allowed); - expect(snapshot.success, JSON.stringify(declaration)).toBe(allowed); const manifest = evidenceBundleSchema.shape.artifacts.element.safeParse( { ...declaration, @@ -69,14 +66,5 @@ describe("persisted observation subject declarations", () => { extra: true, }).success, ).toBe(false); - expect( - snapshotSubject.parse({ - format: "pe", - architecture: null, - path: "/tmp/fixture", - sha256: digest, - extra: true, - }), - ).not.toHaveProperty("extra"); }); });