test(reporting-governance): prove runtime ack truth-state promotion

This commit is contained in:
Eve
2026-05-08 12:03:25 +08:00
parent b9d06c8acd
commit e178828a4e
2 changed files with 91 additions and 1 deletions

View File

@@ -70,6 +70,38 @@ function resolveRuntimeRoute({ governance, runtime, repoRootOverride }) {
return createNotAttemptedResult('runtime execution not attempted: no adapter_action matched an adapter runner route');
}
function promoteTruthStateFromRuntime(governance, routeResult) {
const supervisor = routeResult.runtimeExecution?.result?.supervisor ?? null;
if (!routeResult.attempted || !supervisor) {
return governance;
}
if ((supervisor.ackedCount ?? 0) > 0) {
return {
...governance,
planning: {
...governance.planning,
receipt: {
...governance.planning?.receipt,
status: 'acked',
delivery_state: 'acked',
notes: [
...(Array.isArray(governance.planning?.receipt?.notes) ? governance.planning.receipt.notes : []),
'Runtime execution produced sender-backed ack evidence; truth state promoted to acked.'
],
},
},
contract: {
...governance.contract,
receipt_status: 'acked',
delivery_state: 'acked',
},
};
}
return governance;
}
export function executeRuntimeIntegratedGovernance({
event,
evidence = [],
@@ -98,8 +130,10 @@ export function executeRuntimeIntegratedGovernance({
repoRootOverride,
});
const truthStateIntegrated = promoteTruthStateFromRuntime(governance, routeResult);
return {
...governance,
...truthStateIntegrated,
runtimeExecution: routeResult.runtimeExecution,
runtimeIntegration: {
attempted: routeResult.attempted,
@@ -114,4 +148,5 @@ export const __testables = {
ADAPTER_ACTION_RUNNER_ROUTES,
createNotAttemptedResult,
resolveRuntimeRoute,
promoteTruthStateFromRuntime,
};