CoolFace
Datasetpublic

ValidatorMasterHeartcodeProtocol/heartcode-evaluation-fixtures

Heartcode Experimental Action Evidence v0.1 Eight original synthetic fixtures for an experimental action-submission boundary. GitHub is canonical: release directory. Hugging Face is a distribution copy of these exact files. What this measures A host-owned test grant allows exactly one bound RESET proposal. Missing, expired, revoked, stale, mismatched or unverifiable authority blocks submission to a fake environment. Expected records include deterministic decisions… See the full description on the dataset page: https://huggingface.co/datasets/ValidatorMasterHeartcodeProtocol/heartcode-evaluation-fixtures.

sourceHugging Facemitupdated 10d agoView on Hugging Face
1likes41downloads
verify.mjs63 linesDownload Raw Back to root
1import assert from "node:assert/strict";2import { createHash } from "node:crypto";3import { readFileSync } from "node:fs";4import { fileURLToPath } from "node:url";5import { resolve } from "node:path";6 7const sha256 = text => createHash("sha256").update(text).digest("hex");8const canonical = value => {9  if (Array.isArray(value)) return value.map(canonical);10  if (value && typeof value === "object") return Object.fromEntries(11    Object.keys(value).sort().map(key => [key, canonical(value[key])]));12  assert(value === null || ["string", "boolean"].includes(typeof value) ||13    (typeof value === "number" && Number.isFinite(value)), "Non-JSON value");14  return value;15};16export const hash = value => sha256(JSON.stringify(canonical(value)));17export function verifyRecords(fixtures, expected) {18  assert.equal(fixtures.length, 8, "Expected eight fixtures");19  assert.equal(expected.length, fixtures.length);20  assert.equal(new Set(fixtures.map(row => row.case_id)).size, fixtures.length, "Duplicate fixtures");21  assert.equal(new Set(expected.map(row => row.case_id)).size, expected.length, "Duplicate outputs");22  const expectedById = new Map(expected.map(row => [row.case_id, row]));23  for (const row of fixtures) {24    assert.equal(row.schema_version, "action-fixture.v0.1");25    assert.equal(row.synthetic, true);26    assert.equal(row.input_sha256, hash(row.input), "Input hash mismatch");27    const output = expectedById.get(row.case_id);28    assert(output, "Missing output");29    assert.equal(output.input_sha256, row.input_sha256);30    const { artifactSha256, ...payload } = output.evidence;31    assert.equal(artifactSha256, hash(payload), "Evidence hash mismatch");32    assert.equal(payload.schemaVersion, "experimental-action-evidence.v0.1");33    assert.equal(payload.policy, "experimental-action-boundary.v0.1");34    assert.deepEqual(payload.proposal, row.input.proposal);35    assert.equal(payload.observedAt, row.input.now);36    assert(["allow", "block"].includes(payload.decision));37    if (payload.decision === "block") {38      assert.equal(output.environment_calls, 0);39      assert.equal(payload.execution, "not_attempted");40      assert.equal(payload.receiptId, null);41      assert.equal(payload.submissionsReserved, 0);42      assert.notEqual(payload.reason, "permitted");43    } else {44      assert.equal(payload.reason, "permitted");45      assert.equal(output.environment_calls, 1);46      assert.equal(payload.submissionsReserved, 1);47      assert.equal(payload.execution, "succeeded");48      assert.equal(typeof payload.receiptId, "string");49    }50  }51}52export function verifyBundle(directory = fileURLToPath(new URL(".", import.meta.url))) {53  const manifest = JSON.parse(readFileSync(resolve(directory, "manifest.json"), "utf8"));54  assert.equal(manifest.release, "action-evidence-v0.1");55  const files = [".gitattributes", "LICENSE", "README.md", "expected.jsonl", "fixtures.jsonl", "verify.mjs", "verify.test.mjs"];56  assert.deepEqual(Object.keys(manifest.files).sort(), files);57  for (const name of files) assert.equal(sha256(readFileSync(resolve(directory, name))), manifest.files[name], name);58  const rows = name => readFileSync(resolve(directory, name), "utf8").trim().split("\n").map(line => JSON.parse(line));59  verifyRecords(rows("fixtures.jsonl"), rows("expected.jsonl"));60  return "Verified 8 synthetic fixtures, expected evidence and file hashes.";61}62if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) console.log(verifyBundle());63