mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-20 14:30:57 +00:00
fix(extensions): repair matrix contracts and test boundaries
This commit is contained in:
@@ -434,7 +434,7 @@ export const matrixPlugin: ChannelPlugin<ResolvedMatrixAccount> = {
|
||||
//
|
||||
// INVARIANT: The import() below cannot hang because:
|
||||
// 1. It only loads local ESM modules with no circular awaits
|
||||
// 2. Module initialization is synchronous (no top-level await in ./matrix/index.js)
|
||||
// 2. Module initialization is synchronous (no top-level await in ./matrix/monitor/index.js)
|
||||
// 3. The lock only serializes the import phase, not the provider startup
|
||||
const previousLock = matrixStartupLock;
|
||||
let releaseLock: () => void = () => {};
|
||||
@@ -445,9 +445,9 @@ export const matrixPlugin: ChannelPlugin<ResolvedMatrixAccount> = {
|
||||
|
||||
// Lazy import: the monitor pulls the reply pipeline; avoid ESM init cycles.
|
||||
// Wrap in try/finally to ensure lock is released even if import fails.
|
||||
let monitorMatrixProvider: typeof import("./matrix/index.js").monitorMatrixProvider;
|
||||
let monitorMatrixProvider: typeof import("./matrix/monitor/index.js").monitorMatrixProvider;
|
||||
try {
|
||||
const module = await import("./matrix/index.js");
|
||||
const module = await import("./matrix/monitor/index.js");
|
||||
monitorMatrixProvider = module.monitorMatrixProvider;
|
||||
} finally {
|
||||
// Release lock after import completes or fails
|
||||
|
||||
@@ -104,6 +104,7 @@ function createHandlerHarness() {
|
||||
directTracker: {
|
||||
isDirectMessage: vi.fn().mockResolvedValue(true),
|
||||
},
|
||||
dropPreStartupMessages: true,
|
||||
getRoomInfo: vi.fn().mockResolvedValue({
|
||||
name: "Media Room",
|
||||
canonicalAlias: "#media:example.org",
|
||||
|
||||
@@ -594,6 +594,7 @@ describe("matrix monitor handler pairing account scope", () => {
|
||||
directTracker: {
|
||||
isDirectMessage: async () => false,
|
||||
},
|
||||
dropPreStartupMessages: true,
|
||||
getRoomInfo: async () => ({ altAliases: [] }),
|
||||
getMemberDisplayName: async () => "sender",
|
||||
needsRoomAliasesForConfig: false,
|
||||
|
||||
@@ -119,6 +119,7 @@ describe("createMatrixRoomMessageHandler thread root media", () => {
|
||||
directTracker: {
|
||||
isDirectMessage: vi.fn().mockResolvedValue(true),
|
||||
},
|
||||
dropPreStartupMessages: true,
|
||||
getRoomInfo: vi.fn().mockResolvedValue({
|
||||
name: "Media Room",
|
||||
canonicalAlias: "#media:example.org",
|
||||
|
||||
7
test/helpers/extensions/plugin-routing.ts
Normal file
7
test/helpers/extensions/plugin-routing.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export {
|
||||
__testing as sessionBindingTesting,
|
||||
registerSessionBindingAdapter,
|
||||
} from "../../../src/infra/outbound/session-binding-service.js";
|
||||
export { setActivePluginRegistry } from "../../../src/plugins/runtime.js";
|
||||
export { resolveAgentRoute } from "../../../src/routing/resolve-route.js";
|
||||
export { createTestRegistry } from "../../../src/test-utils/channel-plugins.js";
|
||||
Reference in New Issue
Block a user