feat(reporting-governance): wire profile artifacts into contract and orchestrator
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import path from 'node:path';
|
||||
|
||||
import { executeGovernanceContract, runCompatibilityPreflight } from '../src/core/index.mjs';
|
||||
import capabilityDescriptor from '../capabilities/openclaw-watchdog-reference.json' with { type: 'json' };
|
||||
|
||||
const packageRoot = path.resolve(import.meta.dirname, '..');
|
||||
const repoRoot = path.resolve(packageRoot, '..', '..');
|
||||
|
||||
const noSilencePack = {
|
||||
metadata: { id: 'no-silence', severity_default: 'high' },
|
||||
spec: {
|
||||
@@ -294,3 +298,53 @@ test('schema/version mismatch blocks contract before any runnable plan is produc
|
||||
assert.ok(result.planning.receipt.notes.some((note) => note.includes('schema mismatch: decision_schema')));
|
||||
assert.ok(result.planning.receipt.notes.some((note) => note.includes('plugin version 0.1.0-mainline is not declared compatible')));
|
||||
});
|
||||
|
||||
test('executeGovernanceContract exposes deployment binding when profile artifact bindings are provided', () => {
|
||||
const profileArtifact = {
|
||||
...strictProfile,
|
||||
kind: 'DeploymentProfileArtifact',
|
||||
apiVersion: 'reporting-governance/v1alpha1',
|
||||
metadata: {
|
||||
...strictProfile.metadata,
|
||||
runtime: 'openclaw',
|
||||
compatibility_mode: 'strict_envelope',
|
||||
},
|
||||
spec: {
|
||||
...strictProfile.spec,
|
||||
bindings: {
|
||||
runtime: 'openclaw',
|
||||
entrypoint: 'scripts/watchdog_auto_notify_orchestrator.mjs',
|
||||
scripts: {
|
||||
watchdog: 'scripts/long_task_watchdog.mjs',
|
||||
dispatcher: 'scripts/operator_notify_dispatcher.mjs',
|
||||
bridgeSupervisor: 'scripts/operator_notify_bridge_supervisor.mjs',
|
||||
senderBinding: 'scripts/operator_notify_sender_binding.mjs',
|
||||
orchestrator: 'scripts/watchdog_auto_notify_orchestrator.mjs'
|
||||
},
|
||||
artifact_roots: {
|
||||
queueItems: 'state/operator-notify-queue'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const result = executeGovernanceContract({
|
||||
event: {
|
||||
type: 'silence_timeout',
|
||||
payload: { checkpoint_overdue: true }
|
||||
},
|
||||
capabilityDescriptor,
|
||||
policyPacks: [noSilencePack],
|
||||
context: {
|
||||
signals: ['checkpoint_overdue']
|
||||
},
|
||||
profile: profileArtifact,
|
||||
packageVersion: '0.1.0-mainline',
|
||||
repoRootOverride: repoRoot,
|
||||
});
|
||||
|
||||
assert.equal(result.preflight.status, 'pass');
|
||||
assert.equal(result.deploymentBinding.entrypoint, path.resolve(repoRoot, 'scripts/watchdog_auto_notify_orchestrator.mjs'));
|
||||
assert.equal(result.deploymentBinding.scripts.dispatcher, path.resolve(repoRoot, 'scripts/operator_notify_dispatcher.mjs'));
|
||||
assert.equal(result.deploymentBinding.artifactRoots.queueItems, path.resolve(repoRoot, 'state/operator-notify-queue'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user