mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:00:41 +00:00
fix(plugins): break catalog->ledger import cycle
Importing `loadInstalledPluginIndexInstallRecordsSync` from `./installed-plugin-index-records.js` pulled in the store/config-state re-export chain, closing a runtime value cycle through `channels/bundled-channel-catalog-read.ts` -> `plugins/channel-catalog-registry.ts` -> `plugins/installed-plugin-index-records.ts` -> `plugins/installed-plugin-index-store.ts` -> `plugins/config-state.ts` -> `plugins/config-normalization-shared.ts` -> `channels/ids.ts` -> `channels/bundled-channel-catalog-read.ts`. That tripped `pnpm check:import-cycles` and produced module-init TDZ errors like `ReferenceError: Cannot access 'OFFICIAL_CHANNEL_CATALOG_RELATIVE_PATH' before initialization` across many CI shards. Switch the import to the lower-level `./installed-plugin-index-record-reader.js`, which only depends on filesystem helpers and path resolution, and update the unit-test mock target to match. Functional behaviour is unchanged; the same reader function is re-exported from the records module. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
George Zhang
parent
26b8793095
commit
24235f9f11
@@ -6,7 +6,7 @@ afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
vi.resetModules();
|
||||
vi.doUnmock("./discovery.js");
|
||||
vi.doUnmock("./installed-plugin-index-records.js");
|
||||
vi.doUnmock("./installed-plugin-index-record-reader.js");
|
||||
});
|
||||
|
||||
const ENV: NodeJS.ProcessEnv = { HOME: "/tmp/openclaw-test-home" };
|
||||
@@ -41,7 +41,7 @@ async function loadWithMocks(params: {
|
||||
});
|
||||
|
||||
vi.doMock("./discovery.js", () => ({ discoverOpenClawPlugins: discoverSpy }));
|
||||
vi.doMock("./installed-plugin-index-records.js", () => ({
|
||||
vi.doMock("./installed-plugin-index-record-reader.js", () => ({
|
||||
loadInstalledPluginIndexInstallRecordsSync: loadRecordsSpy,
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { PluginInstallRecord } from "../config/types.plugins.js";
|
||||
import { discoverOpenClawPlugins } from "./discovery.js";
|
||||
import { loadInstalledPluginIndexInstallRecordsSync } from "./installed-plugin-index-records.js";
|
||||
import { loadInstalledPluginIndexInstallRecordsSync } from "./installed-plugin-index-record-reader.js";
|
||||
import {
|
||||
loadPluginManifest,
|
||||
type PluginPackageChannel,
|
||||
|
||||
Reference in New Issue
Block a user