test: move remaining plugin-sdk guardrails to contracts

This commit is contained in:
Peter Steinberger 2026-04-01 02:46:50 +01:00
parent 7e02005ca9
commit 016f065d7e
No known key found for this signature in database
6 changed files with 12 additions and 12 deletions

View File

@ -6,10 +6,10 @@ import {
BUNDLED_PLUGIN_PATH_PREFIX,
BUNDLED_PLUGIN_ROOT_DIR,
bundledPluginFile,
} from "../../test/helpers/bundled-plugin-paths.js";
import { GUARDED_EXTENSION_PUBLIC_SURFACE_BASENAMES } from "../plugins/public-artifacts.js";
} from "../../../../test/helpers/bundled-plugin-paths.js";
import { GUARDED_EXTENSION_PUBLIC_SURFACE_BASENAMES } from "../../../plugins/public-artifacts.js";
const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "../../..");
const REPO_ROOT = resolve(ROOT_DIR, "..");
const ALLOWED_EXTENSION_PUBLIC_SURFACES = new Set(GUARDED_EXTENSION_PUBLIC_SURFACE_BASENAMES);
ALLOWED_EXTENSION_PUBLIC_SURFACES.add("test-api.js");

View File

@ -5,9 +5,9 @@ import { describe, expect, it } from "vitest";
import {
BUNDLED_PLUGIN_ROOT_DIR,
bundledPluginFile,
} from "../../test/helpers/bundled-plugin-paths.js";
} from "../../../test/helpers/bundled-plugin-paths.js";
const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
const REPO_ROOT = resolve(ROOT_DIR, "..");
const EXTENSIONS_DIR = resolve(REPO_ROOT, BUNDLED_PLUGIN_ROOT_DIR);
const CORE_PLUGIN_ENTRY_IMPORT_RE =

View File

@ -55,7 +55,7 @@ describe("plugin-sdk bundled exports", () => {
neverBundle: ["@lancedb/lancedb", "@matrix-org/matrix-sdk-crypto-nodejs", "matrix-js-sdk"],
},
// Full plugin-sdk coverage belongs to `pnpm build`, package contract
// guardrails, and `subpaths.test.ts`. This file only keeps the expensive
// guardrails, and `plugin-sdk-subpaths.test.ts`. This file only keeps the expensive
// bundler path honest across representative entrypoint families plus the
// Matrix SDK runtime import surface that historically crashed plugin
// loading when bare and deep SDK entrypoints mixed.
@ -90,7 +90,7 @@ describe("plugin-sdk bundled exports", () => {
expect(filesWithBareMatrixSdkImports).toEqual([]);
// Export list and package-specifier coverage already live in
// package-contract-guardrails.test.ts and subpaths.test.ts. Keep this file
// plugin-sdk-package-contract-guardrails.test.ts and plugin-sdk-subpaths.test.ts. Keep this file
// focused on the expensive part: can tsdown emit working bundle artifacts?
const importResults = await Promise.all(
bundledRepresentativeEntrypoints.map(async (entry) => [

View File

@ -12,7 +12,7 @@ const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
const REPO_ROOT = resolve(ROOT_DIR, "..");
const PUBLIC_CONTRACT_REFERENCE_FILES = [
"docs/plugins/architecture.md",
"src/plugin-sdk/subpaths.test.ts",
"src/plugins/contracts/plugin-sdk-subpaths.test.ts",
] as const;
const PLUGIN_SDK_SUBPATH_PATTERN = /openclaw\/plugin-sdk\/([a-z0-9][a-z0-9-]*)\b/g;
const NPM_PACK_MAX_BUFFER_BYTES = 64 * 1024 * 1024;

View File

@ -3,9 +3,9 @@ import { dirname, relative, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import ts from "typescript";
import { describe, expect, it } from "vitest";
import { bundledPluginFile } from "../../test/helpers/bundled-plugin-paths.js";
import { bundledPluginFile } from "../../../test/helpers/bundled-plugin-paths.js";
const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
const RUNTIME_API_EXPORT_GUARDS: Record<string, readonly string[]> = {
[bundledPluginFile("discord", "runtime-api.ts")]: [

View File

@ -22,6 +22,7 @@ import type {
} from "openclaw/plugin-sdk/core";
import * as providerEntrySdk from "openclaw/plugin-sdk/provider-entry";
import { describe, expect, expectTypeOf, it } from "vitest";
import { pluginSdkSubpaths } from "../../plugin-sdk/entrypoints.js";
import type { ChannelMessageActionContext } from "../channels/plugins/types.js";
import type {
BaseProbeResult,
@ -43,9 +44,8 @@ import type {
OpenClawPluginApi as SharedOpenClawPluginApi,
PluginRuntime as SharedPluginRuntime,
} from "./channel-plugin-common.js";
import { pluginSdkSubpaths } from "./entrypoints.js";
const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
const PLUGIN_SDK_DIR = resolve(ROOT_DIR, "plugin-sdk");
const sourceCache = new Map<string, string>();
const representativeRuntimeSmokeSubpaths = ["channel-runtime", "conversation-runtime"] as const;