Skip to content

Commit 8043923

Browse files
committed
refactor(plugins): remove extension jiti test hooks
1 parent 194c516 commit 8043923

8 files changed

Lines changed: 19 additions & 272 deletions

File tree

‎extensions/discord/src/monitor/thread-bindings.shared-state.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe("thread binding manager state", () => {
2121
});
2222

2323
it("shares managers between ESM and alternate-loaded module instances", async () => {
24-
const viaJiti = await loadThreadBindingsViaAlternateLoader();
24+
const viaAlternateLoader = await loadThreadBindingsViaAlternateLoader();
2525

2626
createThreadBindingManager({
2727
cfg: EMPTY_DISCORD_TEST_CONFIG,
@@ -31,6 +31,6 @@ describe("thread binding manager state", () => {
3131
});
3232

3333
expect(getThreadBindingManager("work")).not.toBeNull();
34-
expect(viaJiti.getThreadBindingManager("work")).not.toBeNull();
34+
expect(viaAlternateLoader.getThreadBindingManager("work")).not.toBeNull();
3535
});
3636
});

‎extensions/discord/src/monitor/thread-bindings.state.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ type ThreadBindingsGlobalState = {
3232
lastPersistedAtMs: number;
3333
};
3434

35-
// Plugin hooks can load this module via Jiti while core imports it via ESM.
36-
// Store mutable state on globalThis so both loader paths share one registry.
35+
// Plugin hooks can load this module through a separate runtime path while core
36+
// imports it via ESM. Store mutable state on globalThis so both paths share one
37+
// registry.
3738
const THREAD_BINDINGS_STATE_KEY = Symbol.for("openclaw.discordThreadBindingsState");
3839
let threadBindingsState: ThreadBindingsGlobalState | undefined;
3940

‎extensions/matrix/CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ collapsed here.
192192
### Fixes
193193

194194
- Plugins/bundled runtimes: ship bundled plugin runtime sidecars like WhatsApp `light-runtime-api.js`, Matrix `runtime-api.js`, and other plugin runtime entry files in the npm package again, so global installs stop failing on missing bundled plugin runtime surfaces.
195-
- Plugins/Matrix: avoid duplicate `resolveMatrixAccountStringValues` runtime-api exports under Jiti so bundled Matrix installs no longer crash at startup with `Cannot redefine property: resolveMatrixAccountStringValues`. Fixes #52909 and #52891. Thanks @vincentkoc.
195+
- Plugins/Matrix: avoid duplicate `resolveMatrixAccountStringValues` runtime-api exports under source loaders so bundled Matrix installs no longer crash at startup with `Cannot redefine property: resolveMatrixAccountStringValues`. Fixes #52909 and #52891. Thanks @vincentkoc.
196196

197197
## 2026.3.22
198198

‎extensions/matrix/src/plugin-entry.runtime.test.ts‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,11 @@ it("loads the packaged runtime wrapper without recursing through the stable root
123123
);
124124
}, 240_000);
125125

126-
it("does not use Jiti when only a TypeScript Matrix runtime shim exists", async () => {
126+
it("does not load when only a TypeScript Matrix runtime shim exists", async () => {
127127
const fixtureRoot = makeFixtureRoot(".tmp-matrix-runtime-ts-only-");
128128

129129
writeOpenClawPackageFixture(fixtureRoot);
130130
writeSourceRuntimeWrapperFixture(fixtureRoot, { runtimeExtension: ".ts" });
131-
writeFixtureFile(
132-
fixtureRoot,
133-
"node_modules/jiti/index.js",
134-
"throw new Error('matrix wrapper must not require jiti');\n",
135-
);
136131

137132
await expect(
138133
importFixtureModule(fixtureRoot, "extensions/matrix/src/plugin-entry.runtime.js"),
Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
import path from "node:path";
2-
import { loadRuntimeApiExportTypesViaJiti } from "openclaw/plugin-sdk/plugin-test-contracts";
1+
import { runDirectImportSmoke } from "openclaw/plugin-sdk/plugin-test-contracts";
32
import { describe, expect, it } from "vitest";
43

54
describe("zalo runtime api", () => {
6-
it("loads the narrow runtime api without reentering setup surfaces", () => {
7-
const runtimeApiPath = path.join(process.cwd(), "extensions", "zalo", "runtime-api.ts");
5+
it("loads the narrow runtime api without reentering setup surfaces", async () => {
6+
const stdout = await runDirectImportSmoke(
7+
`const runtime = await import("./extensions/zalo/runtime-api.ts");
8+
process.stdout.write(JSON.stringify({
9+
hasZaloPlugin: Object.hasOwn(runtime, "zaloPlugin"),
10+
hasZaloSetupWizard: Object.hasOwn(runtime, "zaloSetupWizard"),
11+
type: typeof runtime.setZaloRuntime,
12+
}));`,
13+
);
814

9-
expect(
10-
loadRuntimeApiExportTypesViaJiti({
11-
modulePath: runtimeApiPath,
12-
exportNames: ["setZaloRuntime"],
13-
realPluginSdkSpecifiers: ["openclaw/plugin-sdk/runtime-store"],
14-
}),
15-
).toEqual({
16-
setZaloRuntime: "function",
17-
});
18-
});
15+
expect(stdout).toBe('{"hasZaloPlugin":false,"hasZaloSetupWizard":false,"type":"function"}');
16+
}, 45_000);
1917
});

‎scripts/check-no-extension-test-core-imports.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ const RETIRED_EXTENSION_TEST_HELPER_BRIDGE_FILES = [
100100
"test/helpers/plugins/contracts-testkit.ts",
101101
"test/helpers/plugins/direct-smoke.ts",
102102
"test/helpers/plugins/directory.ts",
103-
"test/helpers/plugins/jiti-runtime-api.ts",
104103
"test/helpers/plugins/onboard-config.ts",
105104
"test/helpers/plugins/outbound-delivery.ts",
106105
"test/helpers/plugins/package-manifest-contract.ts",

‎src/plugin-sdk/plugin-test-contracts.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export {
88
uniqueSortedStrings,
99
} from "./test-helpers/contracts-testkit.js";
1010
export { runDirectImportSmoke } from "./test-helpers/direct-smoke.js";
11-
export { loadRuntimeApiExportTypesViaJiti } from "./test-helpers/jiti-runtime-api.js";
1211
export { describePackageManifestContract } from "./test-helpers/package-manifest-contract.js";
1312
export { pluginRegistrationContractCases } from "./test-helpers/plugin-registration-contract-cases.js";
1413
export { describePluginRegistrationContract } from "./test-helpers/plugin-registration-contract.js";

‎src/plugin-sdk/test-helpers/jiti-runtime-api.ts‎

Lines changed: 0 additions & 245 deletions
This file was deleted.

0 commit comments

Comments
 (0)