mirror of
https://github.com/morluto/rea.git
synced 2026-11-12 01:41:21 +00:00
146 lines
4.3 KiB
TypeScript
146 lines
4.3 KiB
TypeScript
import { createEvidence } from "./evidence.js";
|
|
import { createEvidenceBundle } from "./evidenceBundle.js";
|
|
import {
|
|
createReconstructionCoverageData,
|
|
createReconstructionVerifierContract,
|
|
} from "./reconstructionCoverage.js";
|
|
|
|
const digest = (character: string): string => character.repeat(64);
|
|
|
|
const EVIDENCE_RECORDS = ["1", "2", "3", "4", "5"].map((character) =>
|
|
createEvidence(
|
|
undefined,
|
|
{ id: "fixture", name: "Fixture", version: "1" },
|
|
{
|
|
predicateType: "rea.coverage-fixture",
|
|
operation: `fixture-${character}`,
|
|
parameters: {},
|
|
result: { character },
|
|
},
|
|
),
|
|
);
|
|
|
|
/** Fixed evaluation time used by reconstruction-coverage tests. */
|
|
export const RECONSTRUCTION_COVERAGE_NOW = Date.parse(
|
|
"2026-07-16T12:00:00.000Z",
|
|
);
|
|
|
|
/** Resolve the stable Evidence identifier for one fixture record. */
|
|
export const reconstructionCoverageEvidenceId = (character: string): string => {
|
|
const record = EVIDENCE_RECORDS.find(
|
|
({ operation }) => operation === `fixture-${character}`,
|
|
);
|
|
if (record === undefined) throw new Error("Missing fixture Evidence");
|
|
return record.evidence_id;
|
|
};
|
|
|
|
/** Build one fully closed reconstruction-coverage workspace. */
|
|
export const completeReconstructionCoverageData = () => {
|
|
const contract = createReconstructionVerifierContract({
|
|
verifier_id: "verify.cli.help",
|
|
claim_ids: ["claim.cli.help"],
|
|
dimensions: ["output", "exit"],
|
|
authority: "controlled-replay",
|
|
max_age_ms: 86_400_000,
|
|
minimum_repeats: 2,
|
|
normalization_sha256: digest("4"),
|
|
normalization_removes_dimensions: false,
|
|
});
|
|
return createReconstructionCoverageData({
|
|
evidence_bundle: createEvidenceBundle(EVIDENCE_RECORDS),
|
|
artifacts: [
|
|
{
|
|
artifact_id: "authority.v1",
|
|
artifact_sha256: digest("1"),
|
|
version: "1.0.0",
|
|
environment_sha256: digest("2"),
|
|
evidence_ids: [reconstructionCoverageEvidenceId("1")],
|
|
},
|
|
],
|
|
surfaces: [
|
|
{
|
|
surface_id: "cli.help",
|
|
family: "cli-command",
|
|
artifact_id: "authority.v1",
|
|
occurrence_id: "occ-help",
|
|
location: "bin/app --help",
|
|
authority: "observed",
|
|
dependency_surface_ids: [],
|
|
evidence_ids: [reconstructionCoverageEvidenceId("2")],
|
|
},
|
|
],
|
|
owners: [
|
|
{
|
|
surface_id: "cli.help",
|
|
ownership: {
|
|
disposition: "implemented",
|
|
owner_path: "src/cli.ts",
|
|
owner_export: "registerHelp",
|
|
owner_sha256: digest("3"),
|
|
path_state: "present",
|
|
package_state: "distributed",
|
|
authority_route: "none",
|
|
},
|
|
},
|
|
],
|
|
claims: [
|
|
{
|
|
claim_id: "claim.cli.help",
|
|
title: "Help output and exit behavior match",
|
|
kind: "behavioral",
|
|
surface_ids: ["cli.help"],
|
|
required_dimensions: ["output", "exit"],
|
|
required_authority: "controlled-replay",
|
|
},
|
|
],
|
|
verifier_contracts: [contract],
|
|
verifier_results: [
|
|
{
|
|
verifier_id: contract.verifier_id,
|
|
contract_sha256: contract.contract_sha256,
|
|
observed_at: "2026-07-16T11:00:00.000Z",
|
|
status: "pass",
|
|
covered_claim_ids: ["claim.cli.help"],
|
|
covered_dimensions: ["output", "exit"],
|
|
artifact_sha256s: [digest("1")],
|
|
owner_sha256s: [digest("3")],
|
|
normalization_sha256: digest("4"),
|
|
repeats: 2,
|
|
evidence_ids: [reconstructionCoverageEvidenceId("3")],
|
|
},
|
|
],
|
|
residual_unknown_ids: [],
|
|
contradictions: [],
|
|
package_proofs: [
|
|
{
|
|
proof_id: "proof.clean-install",
|
|
kind: "clean-install",
|
|
status: "pass",
|
|
artifact_sha256s: [digest("1")],
|
|
evidence_ids: [reconstructionCoverageEvidenceId("4")],
|
|
},
|
|
{
|
|
proof_id: "proof.authority-independence",
|
|
kind: "authority-independence",
|
|
status: "pass",
|
|
artifact_sha256s: [digest("1")],
|
|
evidence_ids: [reconstructionCoverageEvidenceId("5")],
|
|
},
|
|
],
|
|
boundaries: [
|
|
{
|
|
boundary_id: "replacement.cli",
|
|
title: "CLI replacement",
|
|
required_surface_ids: ["cli.help"],
|
|
required_claim_ids: ["claim.cli.help"],
|
|
required_package_proof_kinds: [
|
|
"clean-install",
|
|
"authority-independence",
|
|
],
|
|
allowed_dispositions: [],
|
|
allowed_unknown_ids: [],
|
|
},
|
|
],
|
|
});
|
|
};
|