docs: close reporting-governance entrypoint semantics gap

This commit is contained in:
Eve
2026-05-08 21:35:55 +08:00
parent 6f2ea9b3b3
commit bdd33bd42d
6 changed files with 460 additions and 7 deletions

View File

@@ -19,7 +19,7 @@
"orchestrator",
"storage"
],
"entrypoint": "plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs"
"entrypoint": "scripts/watchdog_auto_notify_orchestrator.mjs"
},
"compatibility": {
"plugin_spec_versions": [

View File

@@ -27,7 +27,7 @@
"src/"
],
"scripts": {
"test": "node --test test/package-structure.test.mjs test/policy-evaluator.test.mjs test/compatibility-preflight.test.mjs test/profile-artifact.test.mjs test/profile-generator.test.mjs test/decision-runner.test.mjs test/decision-store.test.mjs test/decision-store-runtime.integration.test.mjs test/governance-contract.integration.test.mjs test/watchdog-chain.integration.test.mjs test/orchestrator-execution.test.mjs test/runtime-integrated.integration.test.mjs test/exports-boundary.integration.test.mjs test/packed-consumer-install.smoke.test.mjs",
"test": "node --test test/package-structure.test.mjs test/descriptor-entrypoint-resolution.test.mjs test/policy-evaluator.test.mjs test/compatibility-preflight.test.mjs test/profile-artifact.test.mjs test/profile-generator.test.mjs test/decision-runner.test.mjs test/decision-store.test.mjs test/decision-store-runtime.integration.test.mjs test/governance-contract.integration.test.mjs test/watchdog-chain.integration.test.mjs test/orchestrator-execution.test.mjs test/runtime-integrated.integration.test.mjs test/exports-boundary.integration.test.mjs test/packed-consumer-install.smoke.test.mjs",
"smoke": "node ./scripts/package-smoke.mjs --compact"
},
"dependencies": {

View File

@@ -0,0 +1,38 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import capabilityDescriptor from '../capabilities/openclaw-watchdog-reference.json' with { type: 'json' };
import exampleDescriptor from '../examples/openclaw-watchdog-reference.descriptor.example.json' with { type: 'json' };
import { createDeploymentBindingContract } from '../src/storage/profile-artifact.mjs';
import profileArtifact from '../profiles/strict-manager-mode.profile.json' with { type: 'json' };
const packageRoot = path.resolve(import.meta.dirname, '..');
const repoRoot = path.resolve(packageRoot, '..', '..');
function resolvePackageEntrypoint(entrypoint) {
return path.resolve(packageRoot, entrypoint);
}
test('capability descriptor and example entrypoint resolve from package root to the package-owned orchestrator', () => {
const canonicalPath = path.resolve(packageRoot, 'scripts/watchdog_auto_notify_orchestrator.mjs');
const descriptorEntrypoint = resolvePackageEntrypoint(capabilityDescriptor.runtime.entrypoint);
const exampleEntrypoint = resolvePackageEntrypoint(exampleDescriptor.runtime.entrypoint);
assert.equal(capabilityDescriptor.runtime.entrypoint, 'scripts/watchdog_auto_notify_orchestrator.mjs');
assert.equal(exampleDescriptor.runtime.entrypoint, 'scripts/watchdog_auto_notify_orchestrator.mjs');
assert.equal(descriptorEntrypoint, canonicalPath);
assert.equal(exampleEntrypoint, canonicalPath);
assert.equal(fs.existsSync(canonicalPath), true);
});
test('deployment profile binding stays repo-root-relative while targeting the same package-owned orchestrator', () => {
const binding = createDeploymentBindingContract({ artifact: profileArtifact, repoRootOverride: repoRoot });
const canonicalPath = path.resolve(packageRoot, 'scripts/watchdog_auto_notify_orchestrator.mjs');
assert.equal(profileArtifact.spec.bindings.entrypoint, 'plugins/reporting-governance/scripts/watchdog_auto_notify_orchestrator.mjs');
assert.equal(binding.entrypoint, canonicalPath);
assert.equal(binding.scripts.orchestrator, canonicalPath);
});