refactor: promote plugin test helpers to sdk

This commit is contained in:
Peter Steinberger
2026-04-28 00:53:58 +01:00
parent 49d069cd94
commit 8057561cee
153 changed files with 496 additions and 291 deletions

View File

@@ -19,15 +19,19 @@ const FORBIDDEN_PATTERNS: Array<{ pattern: RegExp; hint: string }> = [
},
{
pattern: /["'](?:\.\.\/)+(?:test-utils\/)[^"']+["']/,
hint: "Use test/helpers/plugins/* for repo-only bundled extension test helpers.",
hint: "Use a documented openclaw/plugin-sdk test subpath for bundled extension test helpers.",
},
{
pattern: /["'](?:\.\.\/)+(?:test\/helpers\/plugins\/)[^"']+["']/,
hint: "Use a documented openclaw/plugin-sdk test subpath instead of repo-only plugin helper bridges.",
},
{
pattern: /["'](?:\.\.\/)+(?:src\/test-utils\/)[^"']+["']/,
hint: "Use test/helpers/plugins/* for repo-only helpers, or openclaw/plugin-sdk/testing for public surfaces.",
hint: "Use a documented openclaw/plugin-sdk test subpath for public surfaces.",
},
{
pattern: /["'](?:\.\.\/)+(?:src\/plugins\/types\.js)["']/,
hint: "Use public plugin-sdk/core types or test/helpers/plugins/* instead.",
hint: "Use public plugin-sdk/core types or documented plugin-sdk test helpers instead.",
},
{
pattern: /["'](?:\.\.\/)+(?:src\/channels\/plugins\/contracts\/test-helpers\.js)["']/,
@@ -49,17 +53,46 @@ const RETIRED_EXTENSION_TEST_HELPER_BRIDGE_FILES = [
"test/helpers/plugins/frozen-time.ts",
"test/helpers/plugins/media-understanding.ts",
"test/helpers/plugins/mock-http-response.ts",
"test/helpers/plugins/contracts-testkit.ts",
"test/helpers/plugins/direct-smoke.ts",
"test/helpers/plugins/directory.ts",
"test/helpers/plugins/jiti-runtime-api.ts",
"test/helpers/plugins/onboard-config.ts",
"test/helpers/plugins/outbound-delivery.ts",
"test/helpers/plugins/package-manifest-contract.ts",
"test/helpers/plugins/plugin-api.ts",
"test/helpers/plugins/plugin-registration-contract-cases.ts",
"test/helpers/plugins/plugin-registration-contract.ts",
"test/helpers/plugins/plugin-registration.ts",
"test/helpers/plugins/plugin-runtime-mock.ts",
"test/helpers/plugins/plugin-registry.ts",
"test/helpers/plugins/provider-auth-contract.ts",
"test/helpers/plugins/provider-catalog.ts",
"test/helpers/plugins/provider-contract-suites.ts",
"test/helpers/plugins/provider-contract.ts",
"test/helpers/plugins/provider-discovery-contract.ts",
"test/helpers/plugins/provider-onboard.ts",
"test/helpers/plugins/provider-registration.ts",
"test/helpers/plugins/provider-runtime-contract.ts",
"test/helpers/plugins/provider-usage-fetch.ts",
"test/helpers/plugins/provider-wizard-contract-suites.ts",
"test/helpers/plugins/public-artifacts.ts",
"test/helpers/plugins/public-surface-loader.ts",
"test/helpers/plugins/runtime-taskflow.ts",
"test/helpers/plugins/runtime-env.ts",
"test/helpers/plugins/send-config.ts",
"test/helpers/plugins/setup-wizard.ts",
"test/helpers/plugins/start-account-context.ts",
"test/helpers/plugins/start-account-lifecycle.ts",
"test/helpers/plugins/status-issues.ts",
"test/helpers/plugins/stream-hooks.ts",
"test/helpers/plugins/subagent-hooks.ts",
"test/helpers/plugins/temp-dir.ts",
"test/helpers/plugins/temp-home.ts",
"test/helpers/plugins/tts-contract-suites.ts",
"test/helpers/plugins/typed-cases.ts",
"test/helpers/plugins/web-fetch-provider-contract.ts",
"test/helpers/plugins/web-search-provider-contract.ts",
];
function isExtensionTestFile(filePath: string): boolean {

View File

@@ -51,7 +51,7 @@ const FULL_INSTALL_SMOKE_SCOPE_RE =
/^(Dockerfile$|\.npmrc$|package\.json$|pnpm-lock\.yaml$|pnpm-workspace\.yaml$|scripts\/ci-changed-scope\.mjs$|scripts\/install\.sh$|scripts\/test-install-sh-docker\.sh$|scripts\/docker\/|scripts\/e2e\/(?:Dockerfile(?:\.qr-import)?|qr-import-docker\.sh|bun-global-install-smoke\.sh)$|\.github\/workflows\/install-smoke\.yml$|\.github\/actions\/setup-node-env\/action\.yml$)/;
const FAST_INSTALL_SMOKE_RUNTIME_SCOPE_RE = /^src\/(?:channels|gateway|plugin-sdk|plugins)\//;
const NODE_FAST_PLUGIN_CONTRACT_SCOPE_RE =
/^(src\/plugins\/contracts\/(?:inventory\/bundled-capability-metadata|registry)\.ts$|test\/helpers\/plugins\/tts-contract-suites\.ts$|scripts\/test-projects(?:\.test-support)?\.mjs$|test\/scripts\/test-projects\.test\.ts$)/;
/^(src\/plugins\/contracts\/(?:inventory\/bundled-capability-metadata|registry|tts-contract-suites)\.ts$|scripts\/test-projects(?:\.test-support)?\.mjs$|test\/scripts\/test-projects\.test\.ts$)/;
const NODE_FAST_CI_ROUTING_SCOPE_RE =
/^(scripts\/ci-changed-scope\.mjs$|src\/commands\/status\.scan-result\.test\.ts$|src\/scripts\/ci-changed-scope\.test\.ts$|\.github\/workflows\/ci\.yml$)/;
const NODE_FAST_SCOPE_RE = new RegExp(

View File

@@ -41,6 +41,12 @@ export const pluginSdkDocMetadata = {
"plugin-entry": {
category: "core",
},
"plugin-test-api": {
category: "utilities",
},
"plugin-test-contracts": {
category: "utilities",
},
"channel-actions": {
category: "channel",
},
@@ -53,6 +59,9 @@ export const pluginSdkDocMetadata = {
"channel-contract": {
category: "channel",
},
"channel-contract-testing": {
category: "channel",
},
"channel-pairing": {
category: "channel",
},
@@ -98,6 +107,12 @@ export const pluginSdkDocMetadata = {
testing: {
category: "utilities",
},
"channel-test-helpers": {
category: "utilities",
},
"provider-test-contracts": {
category: "utilities",
},
} as const satisfies Record<string, PluginSdkDocMetadata>;
export type PluginSdkDocEntrypoint = keyof typeof pluginSdkDocMetadata;

View File

@@ -109,7 +109,10 @@
"acp-binding-runtime",
"acp-binding-resolve-runtime",
"lazy-runtime",
"channel-test-helpers",
"plugin-test-api",
"plugin-test-contracts",
"provider-test-contracts",
"testing",
"temp-path",
"logging-core",

View File

@@ -219,7 +219,7 @@ const BROAD_CHANGED_FALLBACK_PATTERNS = [
];
const PRECISE_SOURCE_TEST_TARGETS = new Map([
[
"test/helpers/plugins/tts-contract-suites.ts",
"src/plugins/contracts/tts-contract-suites.ts",
[
"src/plugins/contracts/core-extension-facade-boundary.test.ts",
"src/plugins/contracts/tts.contract.test.ts",