From 8567adf8175a12923de00934e3cfe9d0be1b6e83 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 2 May 2026 08:53:04 +0100 Subject: [PATCH] test: align plugin install metadata fixtures --- AGENTS.md | 2 ++ src/agents/subagent-spawn.workspace.test.ts | 1 + src/cli/plugins-cli-test-helpers.ts | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 68defee5b63..5fee5002dc9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -132,6 +132,8 @@ Telegraph style. Root rules only. Read scoped `AGENTS.md` before subtree work. - Hot tests: avoid per-test `vi.resetModules()` + heavy imports. Measure with `pnpm test:perf:imports ` / `pnpm test:perf:hotspots --limit N`. - Seam depth: pure helper/contract unit tests; one integration smoke per boundary. - Mock expensive seams directly: scanners, manifests, registries, fs crawls, provider SDKs, network/process launch. +- Plugin tests mocking `plugin-registry` need both manifest-registry and metadata-snapshot exports; missing `loadPluginRegistrySnapshotWithMetadata` masks install/slot behavior. +- Thread-bound subagent tests that do not create a requester transcript should set `context: "isolated"` so fork-context validation does not hide lifecycle cleanup paths. - Prefer injection; if module mocking, mock narrow local `*.runtime.ts`, not broad barrels or `openclaw/plugin-sdk/*`. - Share fixtures/builders; delete duplicate assertions; assert behavior that can regress here. - Do not edit baseline/inventory/ignore/snapshot/expected-failure files to silence checks without explicit approval. diff --git a/src/agents/subagent-spawn.workspace.test.ts b/src/agents/subagent-spawn.workspace.test.ts index 74601b29905..828d6e0a42f 100644 --- a/src/agents/subagent-spawn.workspace.test.ts +++ b/src/agents/subagent-spawn.workspace.test.ts @@ -277,6 +277,7 @@ describe("spawnSubagentDirect workspace inheritance", () => { task: "fail after register with thread binding", thread: true, mode: "session", + context: "isolated", }, { agentSessionKey: "agent:main:main", diff --git a/src/cli/plugins-cli-test-helpers.ts b/src/cli/plugins-cli-test-helpers.ts index e60a58d3ef5..ffaf253e95b 100644 --- a/src/cli/plugins-cli-test-helpers.ts +++ b/src/cli/plugins-cli-test-helpers.ts @@ -326,6 +326,11 @@ vi.mock("../plugins/plugin-registry.js", () => ({ invokeMock(loadPluginManifestRegistry, ...args)) as ( ...args: unknown[] ) => unknown, + loadPluginRegistrySnapshotWithMetadata: () => ({ + source: "derived", + snapshot: { plugins: [] }, + diagnostics: [], + }), inspectPluginRegistry: (( ...args: Parameters<(typeof import("../plugins/plugin-registry.js"))["inspectPluginRegistry"]> ) =>