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 <gensokyo-dev@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
authored and Ysopwnable committed 2026-11-14 10:21:04 +01:00
1 parent bac8a115cd
commit 6c8be105a2
1 file changed
+16 -1
@@ -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 },