From 6c8be105a2d92a69b1ae91b24c7dea18b0cb2e2c Mon Sep 17 00:00:00 2001 From: x-labb <154824493+x-labb@users.noreply.github.com> Date: Tue, 27 Oct 2026 10:59:08 +0100 Subject: [PATCH] test(cli): assert retained entropy Evidence beside the cleanup diagnostic Check the partial observation returned with the close-failure diagnostic: provider id, file digest and byte count. Refs #7279 Co-Authored-By: gensokyo-dev Co-Authored-By: Claude Opus 5.5 --- .../byteEntropyCleanupCli.test.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/process-global/byteEntropyCleanupCli.test.ts b/tests/process-global/byteEntropyCleanupCli.test.ts index 2ba5d69ff2..1c50384496 100644 --- a/tests/process-global/byteEntropyCleanupCli.test.ts +++ b/tests/process-global/byteEntropyCleanupCli.test.ts @@ -1,3 +1,4 @@ +import { createHash } from "node:crypto"; import { writeFile } from "node:fs/promises"; import { join } from "node:path"; import { afterEach, expect, it, vi } from "vitest"; @@ -72,7 +73,8 @@ it.each([ async ({ closeFails, attempts }) => { const directory = await createTestTempDirectory("rea-entropy-cleanup-cli-"); const path = join(directory, "entropy-input.bin"); - await writeFile(path, "entropy fixture\n".repeat(32)); + const content = Buffer.from("entropy fixture\n".repeat(32)); + await writeFile(path, content); closeState.path = path; closeState.failures = closeFails ? Number.MAX_SAFE_INTEGER : 0; @@ -91,6 +93,19 @@ it.each([ details: { cleanup: "incomplete", diagnostics: { + primary_error: { + details: { + partial_observation: { + provider: { id: BYTE_ENTROPY_PROVIDER.id }, + subject: { + digest: { + sha256: createHash("sha256").update(content).digest("hex"), + }, + }, + normalized_result: { artifact: { bytes: content.length } }, + }, + }, + }, cleanup_error: { code: "cleanup_incomplete", details: { provider_id: BYTE_ENTROPY_PROVIDER.id },