mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
refactor(channels): remove unused bootstrap list (#105531)
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
* Provides channel plugin metadata before the full runtime registry is installed.
|
||||
*/
|
||||
import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce";
|
||||
import { listBundledChannelPluginIdsForRoot } from "./bundled-ids.js";
|
||||
import { resolveBundledChannelRootScope } from "./bundled-root.js";
|
||||
import {
|
||||
getBundledChannelPlugin,
|
||||
getBundledChannelSecrets,
|
||||
@@ -66,14 +64,6 @@ function mergeBootstrapPlugin(
|
||||
} as ChannelPlugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists bundled channel ids visible to bootstrap for the current root scope.
|
||||
*/
|
||||
export function listBootstrapChannelPluginIds(): readonly string[] {
|
||||
const rootScope = resolveBundledChannelRootScope();
|
||||
return listBundledChannelPluginIdsForRoot(rootScope.cacheKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a bundled channel plugin for bootstrap, merging runtime and setup artifacts.
|
||||
*/
|
||||
|
||||
@@ -51,7 +51,6 @@ afterEach(() => {
|
||||
vi.resetModules();
|
||||
vi.doUnmock("../../plugins/channel-catalog-registry.js");
|
||||
vi.doUnmock("./bundled.js");
|
||||
vi.doUnmock("./bundled-ids.js");
|
||||
});
|
||||
|
||||
describe("bundled root-aware plugin lookups", () => {
|
||||
@@ -90,18 +89,6 @@ describe("bundled root-aware plugin lookups", () => {
|
||||
const rootA = makeBundledRoot("openclaw-bootstrap-a-");
|
||||
const rootB = makeBundledRoot("openclaw-bootstrap-b-");
|
||||
|
||||
vi.doMock("./bundled-ids.js", () => ({
|
||||
listBundledChannelPluginIdsForRoot: () => {
|
||||
if (process.env.OPENCLAW_BUNDLED_PLUGINS_DIR === rootA.pluginsDir) {
|
||||
return ["alpha"];
|
||||
}
|
||||
if (process.env.OPENCLAW_BUNDLED_PLUGINS_DIR === rootB.pluginsDir) {
|
||||
return ["beta"];
|
||||
}
|
||||
return [];
|
||||
},
|
||||
}));
|
||||
|
||||
vi.doMock("./bundled.js", () => ({
|
||||
getBundledChannelPlugin: (id: string) => ({
|
||||
id,
|
||||
@@ -143,14 +130,12 @@ describe("bundled root-aware plugin lookups", () => {
|
||||
);
|
||||
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = rootA.pluginsDir;
|
||||
expect(bootstrapRegistry.listBootstrapChannelPluginIds()).toEqual(["alpha"]);
|
||||
expect(bootstrapRegistry.getBootstrapChannelPlugin("alpha")?.meta.label).toBe("setup-A");
|
||||
expect(
|
||||
bootstrapRegistry.getBootstrapChannelSecrets("alpha")?.secretTargetRegistryEntries?.[0]?.id,
|
||||
).toBe("setup-alpha-A");
|
||||
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = rootB.pluginsDir;
|
||||
expect(bootstrapRegistry.listBootstrapChannelPluginIds()).toEqual(["beta"]);
|
||||
expect(bootstrapRegistry.getBootstrapChannelPlugin("beta")?.meta.label).toBe("setup-B");
|
||||
expect(
|
||||
bootstrapRegistry.getBootstrapChannelSecrets("beta")?.secretTargetRegistryEntries?.[0]?.id,
|
||||
@@ -158,13 +143,6 @@ describe("bundled root-aware plugin lookups", () => {
|
||||
});
|
||||
|
||||
it("retries bootstrap plugin loading after an error", async () => {
|
||||
const root = makeBundledRoot("openclaw-bootstrap-plugin-throw-");
|
||||
|
||||
vi.doMock("./bundled-ids.js", () => ({
|
||||
listBundledChannelPluginIdsForRoot: () =>
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR === root.pluginsDir ? ["alpha"] : [],
|
||||
}));
|
||||
|
||||
const getBundledChannelPluginMock = vi.fn(() => {
|
||||
throw new Error("Cannot find module 'nostr-tools'");
|
||||
});
|
||||
@@ -184,8 +162,6 @@ describe("bundled root-aware plugin lookups", () => {
|
||||
"./bootstrap-registry.js?scope=bootstrap-plugin-load-guard",
|
||||
);
|
||||
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = root.pluginsDir;
|
||||
expect(bootstrapRegistry.listBootstrapChannelPluginIds()).toEqual(["alpha"]);
|
||||
expect(bootstrapRegistry.getBootstrapChannelPlugin("alpha")).toBeUndefined();
|
||||
expect(bootstrapRegistry.getBootstrapChannelPlugin("alpha")).toBeUndefined();
|
||||
expect(bootstrapRegistry.getBootstrapChannelSecrets("alpha")).toBeUndefined();
|
||||
@@ -194,13 +170,6 @@ describe("bundled root-aware plugin lookups", () => {
|
||||
});
|
||||
|
||||
it("keeps plugin loading independent from bootstrap secrets loading errors", async () => {
|
||||
const root = makeBundledRoot("openclaw-bootstrap-secrets-throw-");
|
||||
|
||||
vi.doMock("./bundled-ids.js", () => ({
|
||||
listBundledChannelPluginIdsForRoot: () =>
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR === root.pluginsDir ? ["alpha"] : [],
|
||||
}));
|
||||
|
||||
const getBundledChannelSecretsMock = vi.fn(() => {
|
||||
throw new Error("Cannot find module '@larksuiteoapi/node-sdk'");
|
||||
});
|
||||
@@ -223,7 +192,6 @@ describe("bundled root-aware plugin lookups", () => {
|
||||
"./bootstrap-registry.js?scope=bootstrap-secrets-load-guard",
|
||||
);
|
||||
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = root.pluginsDir;
|
||||
expect(bootstrapRegistry.getBootstrapChannelSecrets("alpha")).toBeUndefined();
|
||||
expect(bootstrapRegistry.getBootstrapChannelSecrets("alpha")).toBeUndefined();
|
||||
expect(bootstrapRegistry.getBootstrapChannelPlugin("alpha")).toEqual({
|
||||
|
||||
Reference in New Issue
Block a user