test(openclaw): inspect runtime in plugin loader E2E (#3742)

Wave-assembled from PR #3742 by @arisgysel-design.

Co-Authored-By: arisgysel-design <arisgysel-design@users.noreply.github.com>
This commit is contained in:
Garry Tan
2026-08-12 14:38:36 -07:00
committed by Sina Matian
co-authored by arisgysel-design
parent 636628fdb2
commit b966d2682c
+7 -13
View File
@@ -18,7 +18,8 @@
* ship to ClawHub).
* 2. `openclaw plugins install --link` against an isolated `--profile`
* directory.
* 3. `openclaw plugins inspect <id> --json` reads our default-export shape
* 3. `openclaw plugins inspect <id> --runtime --json` imports the plugin and
* reads our default-export shape
* back from the runtime registry (`status: 'loaded'`, `imported: true`,
* id/name/description match).
* 4. `openclaw config set plugins.slots.contextEngine gbrain-context` →
@@ -167,7 +168,7 @@ describe('openclaw-plugin-load-real (Tier 2 e2e)', () => {
it.skipIf(SKIP)(
'openclaw imports the entry file and reports status=loaded',
() => {
const r = runOpenclaw(['plugins', 'inspect', PLUGIN_ID, '--json'], { timeoutMs: 30_000 });
const r = runOpenclaw(['plugins', 'inspect', PLUGIN_ID, '--runtime', '--json'], { timeoutMs: 30_000 });
expect(r.exitCode).toBe(0);
const inspect = JSON.parse(r.stdout);
@@ -183,7 +184,7 @@ describe('openclaw-plugin-load-real (Tier 2 e2e)', () => {
it.skipIf(SKIP)(
'default export carries the expected id / name / description metadata',
() => {
const r = runOpenclaw(['plugins', 'inspect', PLUGIN_ID, '--json'], { timeoutMs: 30_000 });
const r = runOpenclaw(['plugins', 'inspect', PLUGIN_ID, '--runtime', '--json'], { timeoutMs: 30_000 });
expect(r.exitCode).toBe(0);
const inspect = JSON.parse(r.stdout);
@@ -198,22 +199,15 @@ describe('openclaw-plugin-load-real (Tier 2 e2e)', () => {
it.skipIf(SKIP)(
'register(api) ran without producing error-level diagnostics',
() => {
const r = runOpenclaw(['plugins', 'inspect', PLUGIN_ID, '--json'], { timeoutMs: 30_000 });
const r = runOpenclaw(['plugins', 'inspect', PLUGIN_ID, '--runtime', '--json'], { timeoutMs: 30_000 });
expect(r.exitCode).toBe(0);
const inspect = JSON.parse(r.stdout);
const errors = (inspect.diagnostics ?? []).filter((d: { level: string }) => d.level === 'error');
expect(errors).toEqual([]);
// The trust warning is expected for --link installs — it's openclaw
// telling the operator that --link bypasses install-record provenance.
// We assert it's there so a future openclaw change that elevates it to
// error-level surfaces here too.
const warns = (inspect.diagnostics ?? []).filter((d: { level: string }) => d.level === 'warn');
const hasTrustWarning = warns.some((d: { message: string }) =>
d.message.includes('install/load-path provenance'),
);
expect(hasTrustWarning).toBe(true);
// Linked installs may or may not emit provenance warnings depending on
// the OpenClaw version. Registration errors are the stable contract.
},
);