mirror of
https://github.com/morluto/rea.git
synced 2026-11-29 18:06:46 +00:00
test(ledger): share the packaged process manifest fixture (#14526)
This commit is contained in:
1 parent
654320a8af
commit
cb477ff0e7
3 files changed
+71
-110
No files matched your search
@@ -11,6 +11,7 @@ import {
|
||||
request,
|
||||
reviewedObligation,
|
||||
readyReviewedLedgerRequest,
|
||||
packagedProcessManifest,
|
||||
} from "./ReconstructionObligationLedger.fixture.js";
|
||||
import { createEvidence, evidenceSubjectInput } from "../domain/evidence.js";
|
||||
import type { ReviewedReconstructionObligation } from "../domain/reconstructionObligationLedgerSchemas.js";
|
||||
@@ -145,40 +146,12 @@ describe("reconstruction obligation ledger", () => {
|
||||
throw new Error("Expected process obligation");
|
||||
const result = build(
|
||||
request([capture, proof], {
|
||||
manifest: {
|
||||
bindings: [
|
||||
{
|
||||
obligation_id: obligation.obligation_id,
|
||||
owner: {
|
||||
module_path: "src/processOwner.ts",
|
||||
symbol: "runProcess",
|
||||
owner_sha256: "5".repeat(64),
|
||||
},
|
||||
parser_type: null,
|
||||
original_cases: originalCases(obligation, capture.evidence_id),
|
||||
fixtures: obligation.required_case_kinds.map((caseKind) => ({
|
||||
fixture_id: `packaged.${caseKind}`,
|
||||
case_kind: caseKind,
|
||||
authority: "packaged-process",
|
||||
evidence_ids: [proof.evidence_id],
|
||||
})),
|
||||
verifier: {
|
||||
verifier_id: "verifier.packaged",
|
||||
claim_id: "claim.process",
|
||||
command: "npm run verify:package -- process",
|
||||
authority: "packaged-process",
|
||||
status: "pass",
|
||||
result_evidence_id: proof.evidence_id,
|
||||
enumerated_obligation_ids: [obligation.obligation_id],
|
||||
nondeterminism: {
|
||||
mode: "partial-order",
|
||||
specification: "Fixture scheduling is partially ordered.",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
contradictions: [],
|
||||
},
|
||||
manifest: packagedProcessManifest(obligation, {
|
||||
ownerSha256: "5".repeat(64),
|
||||
originalCases: originalCases(obligation, capture.evidence_id),
|
||||
proofEvidenceId: proof.evidence_id,
|
||||
specification: "Fixture scheduling is partially ordered.",
|
||||
}),
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
readyReviewedLedgerRequest,
|
||||
request,
|
||||
reviewedObligation,
|
||||
packagedProcessManifest,
|
||||
} from "./ReconstructionObligationLedger.fixture.js";
|
||||
import { evaluateReconstructionObligationLedger } from "./ReconstructionObligationLedgerEvaluation.js";
|
||||
|
||||
@@ -226,41 +227,13 @@ describe("reconstruction obligation ledger case closure", () => {
|
||||
throw new Error("Expected process obligation");
|
||||
const result = build(
|
||||
request([capture, proof], {
|
||||
manifest: {
|
||||
bindings: [
|
||||
{
|
||||
obligation_id: obligation.obligation_id,
|
||||
owner: {
|
||||
module_path: "src/processOwner.ts",
|
||||
symbol: "runProcess",
|
||||
owner_sha256: "4".repeat(64),
|
||||
},
|
||||
parser_type: null,
|
||||
original_cases: obligation.observed_cases,
|
||||
fixtures: obligation.required_case_kinds.map((caseKind) => ({
|
||||
fixture_id: `packaged.${caseKind}`,
|
||||
case_kind: caseKind,
|
||||
authority: "packaged-process",
|
||||
evidence_ids: [proof.evidence_id],
|
||||
})),
|
||||
verifier: {
|
||||
verifier_id: "verifier.packaged",
|
||||
claim_id: "claim.process",
|
||||
command: "npm run verify:package -- process",
|
||||
authority: "packaged-process",
|
||||
status: "pass",
|
||||
result_evidence_id: proof.evidence_id,
|
||||
enumerated_obligation_ids: [obligation.obligation_id],
|
||||
nondeterminism: {
|
||||
mode: "partial-order",
|
||||
specification:
|
||||
"Startup precedes teardown; worker completion is unordered.",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
contradictions: [],
|
||||
},
|
||||
manifest: packagedProcessManifest(obligation, {
|
||||
ownerSha256: "4".repeat(64),
|
||||
originalCases: obligation.observed_cases,
|
||||
proofEvidenceId: proof.evidence_id,
|
||||
specification:
|
||||
"Startup precedes teardown; worker completion is unordered.",
|
||||
}),
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ import {
|
||||
} from "../domain/evidenceBundle.js";
|
||||
import {
|
||||
reconstructionObligationLedgerSchema,
|
||||
type ReconstructionObligation,
|
||||
type ReconstructionObligationManifest,
|
||||
type ReconstructionObligationLedgerInput,
|
||||
type ReconstructionObligationLedger,
|
||||
type ReviewedReconstructionObligation,
|
||||
@@ -98,7 +100,7 @@ export const build = (
|
||||
|
||||
/** Create provenance for each required case from one source Evidence record. */
|
||||
export const originalCases = (
|
||||
obligation: ReconstructionObligationLedger["obligations"][number],
|
||||
obligation: ReconstructionObligation,
|
||||
evidenceId: string,
|
||||
) =>
|
||||
obligation.required_case_kinds.map((caseKind) => ({
|
||||
@@ -107,6 +109,50 @@ export const originalCases = (
|
||||
location: `/normalized_result/cases/${caseKind}`,
|
||||
}));
|
||||
|
||||
/** The manifest binding a packaged process fixture and its verifier to one obligation. */
|
||||
export const packagedProcessManifest = (
|
||||
obligation: ReconstructionObligation,
|
||||
binding: {
|
||||
readonly ownerSha256: string;
|
||||
readonly originalCases: ReconstructionObligation["observed_cases"];
|
||||
readonly proofEvidenceId: string;
|
||||
readonly specification: string;
|
||||
},
|
||||
): ReconstructionObligationManifest => ({
|
||||
bindings: [
|
||||
{
|
||||
obligation_id: obligation.obligation_id,
|
||||
owner: {
|
||||
module_path: "src/processOwner.ts",
|
||||
symbol: "runProcess",
|
||||
owner_sha256: binding.ownerSha256,
|
||||
},
|
||||
parser_type: null,
|
||||
original_cases: binding.originalCases,
|
||||
fixtures: obligation.required_case_kinds.map((caseKind) => ({
|
||||
fixture_id: `packaged.${caseKind}`,
|
||||
case_kind: caseKind,
|
||||
authority: "packaged-process",
|
||||
evidence_ids: [binding.proofEvidenceId],
|
||||
})),
|
||||
verifier: {
|
||||
verifier_id: "verifier.packaged",
|
||||
claim_id: "claim.process",
|
||||
command: "npm run verify:package -- process",
|
||||
authority: "packaged-process",
|
||||
status: "pass",
|
||||
result_evidence_id: binding.proofEvidenceId,
|
||||
enumerated_obligation_ids: [obligation.obligation_id],
|
||||
nondeterminism: {
|
||||
mode: "partial-order",
|
||||
specification: binding.specification,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
contradictions: [],
|
||||
});
|
||||
|
||||
/** Build a request whose packaged-process obligation closes as ready. */
|
||||
export const readyProcessLedgerRequest =
|
||||
(): ReconstructionObligationLedgerInput => {
|
||||
@@ -115,17 +161,14 @@ export const readyProcessLedgerRequest =
|
||||
const obligation = initial.obligations[0];
|
||||
if (obligation === undefined)
|
||||
throw new Error("Expected process obligation");
|
||||
const fixtureIds = obligation.required_case_kinds.map(
|
||||
(caseKind) => `packaged.${caseKind}`,
|
||||
);
|
||||
const proof = boundProofEvidence("packaged", {
|
||||
bindings: [
|
||||
{
|
||||
obligation_id: obligation.obligation_id,
|
||||
obligation_version: obligation.obligation_version,
|
||||
owner_sha256: "2".repeat(64),
|
||||
fixtures: obligation.required_case_kinds.map((caseKind, index) => ({
|
||||
fixture_id: fixtureIds[index]!,
|
||||
fixtures: obligation.required_case_kinds.map((caseKind) => ({
|
||||
fixture_id: `packaged.${caseKind}`,
|
||||
case_kind: caseKind,
|
||||
passed: true,
|
||||
})),
|
||||
@@ -140,41 +183,13 @@ export const readyProcessLedgerRequest =
|
||||
],
|
||||
});
|
||||
return request([capture, proof], {
|
||||
manifest: {
|
||||
bindings: [
|
||||
{
|
||||
obligation_id: obligation.obligation_id,
|
||||
owner: {
|
||||
module_path: "src/processOwner.ts",
|
||||
symbol: "runProcess",
|
||||
owner_sha256: "2".repeat(64),
|
||||
},
|
||||
parser_type: null,
|
||||
original_cases: originalCases(obligation, capture.evidence_id),
|
||||
fixtures: obligation.required_case_kinds.map((caseKind) => ({
|
||||
fixture_id: `packaged.${caseKind}`,
|
||||
case_kind: caseKind,
|
||||
authority: "packaged-process",
|
||||
evidence_ids: [proof.evidence_id],
|
||||
})),
|
||||
verifier: {
|
||||
verifier_id: "verifier.packaged",
|
||||
claim_id: "claim.process",
|
||||
command: "npm run verify:package -- process",
|
||||
authority: "packaged-process",
|
||||
status: "pass",
|
||||
result_evidence_id: proof.evidence_id,
|
||||
enumerated_obligation_ids: [obligation.obligation_id],
|
||||
nondeterminism: {
|
||||
mode: "partial-order",
|
||||
specification:
|
||||
"Startup precedes teardown; worker completion is unordered.",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
contradictions: [],
|
||||
},
|
||||
manifest: packagedProcessManifest(obligation, {
|
||||
ownerSha256: "2".repeat(64),
|
||||
originalCases: originalCases(obligation, capture.evidence_id),
|
||||
proofEvidenceId: proof.evidence_id,
|
||||
specification:
|
||||
"Startup precedes teardown; worker completion is unordered.",
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user