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.
This commit is contained in:
morluto authored and GitHub committed 2026-11-15 20:53:13 -05:00
1 parent 2234a7db57
commit 9ecfb109e8
2 files changed
+4 -16

No files matched your search

@@ -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,
});
},
+3 -15
View File
@@ -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");
});
});