Skip to content

Commit 9ecfb10

Browse files
authored
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.
1 parent 2234a7d commit 9ecfb10

2 files changed

Lines changed: 4 additions & 16 deletions

File tree

‎src/application/binaryDiagnostics/KernelBuildConfigService.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ it.each([
7777
if (!result.ok) throw result.error;
7878
expect(result.value).toMatchObject({
7979
confidence: "observed",
80-
subject: { format },
80+
subject: { identity: { format } },
8181
normalized_result: report,
8282
});
8383
},

‎src/domain/evidenceSubject.test.ts‎

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ const digest = "a".repeat(64);
1313

1414
describe("persisted observation subject declarations", () => {
1515
it("keeps Evidence and cache admission aligned for every format and architecture", () => {
16+
// A snapshot entry commits to its Evidence record's subject, so cache
17+
// admission parses the Evidence subject declaration itself.
18+
expect(snapshotSubject).toBe(evidenceSubject);
1619
for (const format of evidenceSubjectFormatSchema.options) {
1720
for (const architecture of [
1821
...BINARY_ARCHITECTURES,
@@ -30,19 +33,13 @@ describe("persisted observation subject declarations", () => {
3033
name: "fixture",
3134
local_path: "/tmp/fixture",
3235
});
33-
const snapshot = snapshotSubject.safeParse({
34-
...declaration,
35-
path: "/tmp/fixture",
36-
sha256: digest,
37-
});
3836
const allowed =
3937
architecture !== "unsupported" &&
4038
(format === "gamecube-dol"
4139
? architecture === "powerpc"
4240
: format === "raw-binary" ||
4341
(architecture !== "6502" && architecture !== "m68k"));
4442
expect(evidence.success, JSON.stringify(declaration)).toBe(allowed);
45-
expect(snapshot.success, JSON.stringify(declaration)).toBe(allowed);
4643
const manifest = evidenceBundleSchema.shape.artifacts.element.safeParse(
4744
{
4845
...declaration,
@@ -69,14 +66,5 @@ describe("persisted observation subject declarations", () => {
6966
extra: true,
7067
}).success,
7168
).toBe(false);
72-
expect(
73-
snapshotSubject.parse({
74-
format: "pe",
75-
architecture: null,
76-
path: "/tmp/fixture",
77-
sha256: digest,
78-
extra: true,
79-
}),
80-
).not.toHaveProperty("extra");
8169
});
8270
});

0 commit comments

Comments
 (0)