test: reuse prepared bundled plugins in startup corpus (#148465)

This commit is contained in:
Peter Steinberger 2026-09-14 13:25:53 -07:00 • committed by GitHub
parent c3842f0ce7
commit cbc5d7e03c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 3 deletions

View file

@ -82,6 +82,10 @@ checkout revision. Partial, filtered or unknown plans retain the explicit step;
release-gate dispatches retain their separate merge-tree proof. Both state
repair passes, all static baseline ratchets and required Node failure aggregation
remain unchanged.
The corpus uses the normal bundled-plugin resolver to select the prepared
runtime from this checkout instead of forcing TypeScript plugin entrypoints.
Plugins whose Doctor contracts require source loading retain that behavior;
the complete config/state matrix and its assertions remain intact.
Ordinary pull requests that change only independent Control UI unit-test entries
keep all three UI unit rows, performance checks, and existing type/lint gates,

View file

@ -8,10 +8,18 @@ import { acquireReadOnlyPreparedModelRuntime } from "../agents/prepared-model-ru
import { applyLegacyCompatibilityStep } from "../commands/doctor/shared/config-flow-steps.js";
import { normalizeCompatibilityConfigValues } from "../commands/doctor/shared/legacy-config-core-migrate.js";
import { loadGatewayStartupConfigSnapshot } from "../gateway/server-startup-config-helpers.js";
import { resolveBundledDirFromPackageRoot } from "../plugins/bundled-dir.js";
import { resolveProviderChannelLoginChoice } from "../plugins/provider-login-options.js";
import { createConfigIO } from "./io.js";
import type { OpenClawConfig } from "./types.js";
const bundledPluginsDir = resolveBundledDirFromPackageRoot(
fileURLToPath(new URL("../../", import.meta.url)),
);
if (!bundledPluginsDir) {
throw new Error("Missing bundled plugin fixtures for startup corpus");
}
const corpusDir = fileURLToPath(new URL("../../test/fixtures/config-corpus/", import.meta.url));
const fixtureNames = fs
.readdirSync(corpusDir)
@ -107,7 +115,7 @@ describe("operator config startup corpus", () => {
OPENCLAW_STATE_DIR: home,
DISCORD_BOT_TOKEN: "synthetic-token",
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "0",
OPENCLAW_BUNDLED_PLUGINS_DIR: fileURLToPath(new URL("../../extensions/", import.meta.url)),
OPENCLAW_BUNDLED_PLUGINS_DIR: bundledPluginsDir,
};
const snapshot = await createConfigIO({
configPath,
@ -173,7 +181,7 @@ describe("operator config startup corpus", () => {
OPENCLAW_TEST_HOME: home,
OPENCLAW_STATE_DIR: stateDir,
OPENCLAW_CONFIG_PATH: configPath,
OPENCLAW_BUNDLED_PLUGINS_DIR: fileURLToPath(new URL("../../extensions/", import.meta.url)),
OPENCLAW_BUNDLED_PLUGINS_DIR: bundledPluginsDir,
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "0",
})) {
vi.stubEnv(key, value);

View file

@ -13,6 +13,7 @@ import { loadCronJobsStore, resolveCronJobsStorePathFromConfig } from "../cron/s
import { loadGatewayStartupConfigSnapshot } from "../gateway/server-startup-config-helpers.js";
import { runStartupSessionMigration } from "../gateway/server-startup-session-migration.js";
import { openNodeSqliteDatabase } from "../infra/node-sqlite.js";
import { resolveBundledDirFromPackageRoot } from "../plugins/bundled-dir.js";
import {
closeOpenClawAgentDatabasesAsync,
OPENCLAW_AGENT_SCHEMA_VERSION,
@ -29,6 +30,13 @@ import {
} from "./sessions.js";
import { loadSessionEntryReadOnly } from "./sessions/session-accessor.js";
const bundledPluginsDir = resolveBundledDirFromPackageRoot(
fileURLToPath(new URL("../../", import.meta.url)),
);
if (!bundledPluginsDir) {
throw new Error("Missing bundled plugin fixtures for startup corpus");
}
type StateFixture = {
release: string;
sessions: Array<{
@ -83,7 +91,7 @@ function prepareState(release: string, configName: string) {
OPENCLAW_TEST_HOME: home,
OPENCLAW_STATE_DIR: stateDir,
OPENCLAW_CONFIG_PATH: configPath,
OPENCLAW_BUNDLED_PLUGINS_DIR: fileURLToPath(new URL("../../extensions/", import.meta.url)),
OPENCLAW_BUNDLED_PLUGINS_DIR: bundledPluginsDir,
OPENCLAW_DISABLE_BUNDLED_PLUGINS: "0",
})) {
vi.stubEnv(key, value);