test(reporting-governance): prove runtime ack truth-state promotion
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user