Skip to content

test: align extension runtime mocks with plugin-sdk#51289

Merged
jalehman merged 7 commits intoopenclaw:mainfrom
jalehman:codex/fix-channels-test-failures-main
Mar 20, 2026
Merged

test: align extension runtime mocks with plugin-sdk#51289
jalehman merged 7 commits intoopenclaw:mainfrom
jalehman:codex/fix-channels-test-failures-main

Conversation

@jalehman
Copy link
Copy Markdown
Contributor

What

This PR updates stale extension tests so they mock the plugin-sdk runtime barrels that production code now imports, and hardens the Signal tool-result reaction assertions to observe the enqueue seam directly.

Why

The pnpm test:channels lane was failing on current origin/main, not just on PR #51191. The failures came from tests that were still mocking pre-refactor internal modules or depending on brittle shared queue state after the ongoing extension-boundary refactor.

Changes

  • Update Telegram proxy test to mock openclaw/plugin-sdk/config-runtime
  • Update WhatsApp inbound media test to mock plugin-sdk config/media runtimes
  • Update WhatsApp login coverage test to use partial config-runtime mock and deterministic socket/mock resets
  • Harden Signal tool-result harness with an enqueueSystemEvent spy
  • Assert Signal reaction notifications against the enqueue seam instead of shared queue state

Testing

  • pnpm test -- extensions/signal/src/monitor.tool-result.sends-tool-summaries-responseprefix.test.ts extensions/telegram/src/send.proxy.test.ts extensions/whatsapp/src/inbound.media.test.ts extensions/whatsapp/src/login.coverage.test.ts
  • pnpm test:channels
  • pnpm check

@openclaw-barnacle openclaw-barnacle bot added channel: signal Channel integration: signal channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web size: S maintainer Maintainer-authored PR labels Mar 20, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 20, 2026

Greptile Summary

This PR aligns extension test mocks with the current plugin-sdk import boundaries after a refactor, fixing the pnpm test:channels lane that was failing on origin/main. The changes update Telegram, WhatsApp, and Signal tests to mock openclaw/plugin-sdk/*-runtime barrels rather than stale internal paths, and harden the Signal reaction assertions to observe the enqueueSystemEvent seam directly instead of polling shared queue state.

Key changes:

  • send.proxy.test.ts, inbound.media.test.ts, login.coverage.test.ts: Switch vi.mock targets from relative internal paths (../../../src/config/config.js, ../../../src/media/store.js) to the corresponding openclaw/plugin-sdk/*-runtime barrels and adopt vi.importActual in place of the deprecated importOriginal callback pattern.
  • login.coverage.test.ts: Fixes a real test-isolation bug where the old let call = 0 counter in the createWaSocket factory closure was never reset between tests; the new approach reads createWaSocket.mock.calls.length (cleared by vi.clearAllMocks() + explicit mockClear() in beforeEach). Additional explicit mockReset() calls are also added for waitForWaConnection, waitForCredsSaveQueueWithTimeout, and formatError mocks to fully reset implementations between tests.
  • monitor.tool-result.test-harness.ts / .test.ts: Introduces an enqueueSystemEventMock spy that wraps (and passes through to) the real enqueueSystemEvent implementation, replacing the previous approach of reading shared peekSystemEvents queue state — making reaction assertions immune to cross-test queue leakage.

Confidence Score: 5/5

  • This PR is safe to merge — it is a pure test maintenance change with no production code modifications.
  • All changes are confined to test files. The mock boundary alignment is mechanically straightforward, the call counter bug fix is correct (mock.calls is recorded before the implementation body executes in Vitest, so calls.length <= 1 correctly distinguishes the first call), and the spy pass-through pattern for enqueueSystemEvent is a well-established Vitest idiom. No production behavior is affected.
  • No files require special attention.

Last reviewed commit: "test: align extensio..."

@openclaw-barnacle openclaw-barnacle bot added channel: bluebubbles Channel integration: bluebubbles channel: matrix Channel integration: matrix labels Mar 20, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7f1079654

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 027c5ac871

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +39 to +43
if (!bundledWebSearchPluginIdsCache) {
bundledWebSearchPluginIdsCache = listBundledWebSearchPluginRegistrations()
.map(({ plugin }) => plugin.id)
.toSorted((left, right) => left.localeCompare(right));
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid caching a truncated bundled plugin list

If one of the new plugin getters throws once (for example during the transient circular-import/TDZ window this lazy-loading path is trying to tolerate), listBundledWebSearchPluginRegistrations() drops that plugin and this cache snapshots the shortened result forever; loadBundledWebSearchProviders() below has the same pattern. In that case the first call to resolveBundledWebSearchPluginIds(), listBundledWebSearchProviders(), or resolveBundledWebSearchPluginId() makes a built-in web-search provider disappear for the rest of the process even after the module finishes initializing, so we should only cache once every registration resolved or retry after a getter failure.

Useful? React with 👍 / 👎.

@jalehman jalehman requested a review from a team as a code owner March 20, 2026 22:39
@openclaw-barnacle openclaw-barnacle bot added the scripts Repository scripts label Mar 20, 2026
Update stale extension tests to mock the plugin-sdk runtime barrels that production code now imports, and harden the Signal tool-result harness around system-event assertions so the channels lane matches current extension boundaries.

Regeneration-Prompt: |
  Verify the failing channels-lane tests against current origin/main in an isolated worktree before changing anything. If the failures reproduce on main, keep the fix test-only unless production behavior is clearly wrong. Recent extension refactors moved Telegram, WhatsApp, and Signal code onto plugin-sdk runtime barrels, so update stale tests that still mock old core module paths to intercept the seams production code now uses. For Signal reaction notifications, avoid brittle assertions that depend on shared queued system-event state when a direct harness spy on enqueue behavior is sufficient. Preserve scope: only touch the failing tests and their local harness, then rerun the reproduced targeted tests plus the full channels lane and repo check gate.
@jalehman jalehman force-pushed the codex/fix-channels-test-failures-main branch from 9d7baf3 to 48f9271 Compare March 20, 2026 22:40
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48f9271088

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +20 to +22
get plugin() {
return bravePlugin;
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep contract registry from eagerly touching lazy plugin getters

These accessors only help code paths that resolve entry.plugin lazily, but src/plugins/contracts/registry.ts:79-82 still maps bundledWebSearchPluginRegistrations at module scope. If one bundled web-search plugin is in the transient circular-import/TDZ window that motivated this change, importing the contract registry will still touch the getter during module initialization and throw before src/plugins/bundled-web-search.ts can recover, so the contract tests and any other registry.ts consumer remain broken in that scenario.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f211573de

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

return bundledWebSearchPluginRegistrations
.map((entry) => {
const plugin = resolveBundledWebSearchPlugin(entry);
return plugin ? { ...entry, plugin } : null;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Stop re-reading lazy plugin getters while cloning registrations

If a bundled web-search module is still in the transient circular-import/TDZ state that this change is trying to tolerate, resolveBundledWebSearchPlugin(entry) returns null only for the first getter access. The { ...entry, plugin } clone immediately reads entry.plugin again because object spread copies enumerable getters, so the same ReferenceError escapes here and listBundledWebSearchPluginRegistrations() still aborts. In that state the first call to resolveBundledWebSearchPluginIds()/listBundledWebSearchProviders() fails instead of degrading gracefully.

Useful? React with 👍 / 👎.

@jalehman jalehman merged commit 2364e45 into openclaw:main Mar 20, 2026
41 checks passed
@jalehman jalehman deleted the codex/fix-channels-test-failures-main branch March 20, 2026 23:02
JohnJAS pushed a commit to JohnJAS/openclaw that referenced this pull request Mar 22, 2026
* test: align extension runtime mocks with plugin-sdk

Update stale extension tests to mock the plugin-sdk runtime barrels that production code now imports, and harden the Signal tool-result harness around system-event assertions so the channels lane matches current extension boundaries.

Regeneration-Prompt: |
  Verify the failing channels-lane tests against current origin/main in an isolated worktree before changing anything. If the failures reproduce on main, keep the fix test-only unless production behavior is clearly wrong. Recent extension refactors moved Telegram, WhatsApp, and Signal code onto plugin-sdk runtime barrels, so update stale tests that still mock old core module paths to intercept the seams production code now uses. For Signal reaction notifications, avoid brittle assertions that depend on shared queued system-event state when a direct harness spy on enqueue behavior is sufficient. Preserve scope: only touch the failing tests and their local harness, then rerun the reproduced targeted tests plus the full channels lane and repo check gate.

* test: fix extension test drift on main

* fix: lazy-load bundled web search plugin registry

* test: make matrix sweeper failure injection portable

* fix: split heavy matrix runtime-api seams

* fix: simplify bundled web search id lookup

* test: tolerate windows env key casing
pholpaphankorn pushed a commit to pholpaphankorn/openclaw that referenced this pull request Mar 22, 2026
* test: align extension runtime mocks with plugin-sdk

Update stale extension tests to mock the plugin-sdk runtime barrels that production code now imports, and harden the Signal tool-result harness around system-event assertions so the channels lane matches current extension boundaries.

Regeneration-Prompt: |
  Verify the failing channels-lane tests against current origin/main in an isolated worktree before changing anything. If the failures reproduce on main, keep the fix test-only unless production behavior is clearly wrong. Recent extension refactors moved Telegram, WhatsApp, and Signal code onto plugin-sdk runtime barrels, so update stale tests that still mock old core module paths to intercept the seams production code now uses. For Signal reaction notifications, avoid brittle assertions that depend on shared queued system-event state when a direct harness spy on enqueue behavior is sufficient. Preserve scope: only touch the failing tests and their local harness, then rerun the reproduced targeted tests plus the full channels lane and repo check gate.

* test: fix extension test drift on main

* fix: lazy-load bundled web search plugin registry

* test: make matrix sweeper failure injection portable

* fix: split heavy matrix runtime-api seams

* fix: simplify bundled web search id lookup

* test: tolerate windows env key casing
frankekn pushed a commit to artwalker/openclaw that referenced this pull request Mar 23, 2026
* test: align extension runtime mocks with plugin-sdk

Update stale extension tests to mock the plugin-sdk runtime barrels that production code now imports, and harden the Signal tool-result harness around system-event assertions so the channels lane matches current extension boundaries.

Regeneration-Prompt: |
  Verify the failing channels-lane tests against current origin/main in an isolated worktree before changing anything. If the failures reproduce on main, keep the fix test-only unless production behavior is clearly wrong. Recent extension refactors moved Telegram, WhatsApp, and Signal code onto plugin-sdk runtime barrels, so update stale tests that still mock old core module paths to intercept the seams production code now uses. For Signal reaction notifications, avoid brittle assertions that depend on shared queued system-event state when a direct harness spy on enqueue behavior is sufficient. Preserve scope: only touch the failing tests and their local harness, then rerun the reproduced targeted tests plus the full channels lane and repo check gate.

* test: fix extension test drift on main

* fix: lazy-load bundled web search plugin registry

* test: make matrix sweeper failure injection portable

* fix: split heavy matrix runtime-api seams

* fix: simplify bundled web search id lookup

* test: tolerate windows env key casing
furaul pushed a commit to furaul/openclaw that referenced this pull request Mar 24, 2026
* test: align extension runtime mocks with plugin-sdk

Update stale extension tests to mock the plugin-sdk runtime barrels that production code now imports, and harden the Signal tool-result harness around system-event assertions so the channels lane matches current extension boundaries.

Regeneration-Prompt: |
  Verify the failing channels-lane tests against current origin/main in an isolated worktree before changing anything. If the failures reproduce on main, keep the fix test-only unless production behavior is clearly wrong. Recent extension refactors moved Telegram, WhatsApp, and Signal code onto plugin-sdk runtime barrels, so update stale tests that still mock old core module paths to intercept the seams production code now uses. For Signal reaction notifications, avoid brittle assertions that depend on shared queued system-event state when a direct harness spy on enqueue behavior is sufficient. Preserve scope: only touch the failing tests and their local harness, then rerun the reproduced targeted tests plus the full channels lane and repo check gate.

* test: fix extension test drift on main

* fix: lazy-load bundled web search plugin registry

* test: make matrix sweeper failure injection portable

* fix: split heavy matrix runtime-api seams

* fix: simplify bundled web search id lookup

* test: tolerate windows env key casing
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 28, 2026
* test: align extension runtime mocks with plugin-sdk

Update stale extension tests to mock the plugin-sdk runtime barrels that production code now imports, and harden the Signal tool-result harness around system-event assertions so the channels lane matches current extension boundaries.

Regeneration-Prompt: |
  Verify the failing channels-lane tests against current origin/main in an isolated worktree before changing anything. If the failures reproduce on main, keep the fix test-only unless production behavior is clearly wrong. Recent extension refactors moved Telegram, WhatsApp, and Signal code onto plugin-sdk runtime barrels, so update stale tests that still mock old core module paths to intercept the seams production code now uses. For Signal reaction notifications, avoid brittle assertions that depend on shared queued system-event state when a direct harness spy on enqueue behavior is sufficient. Preserve scope: only touch the failing tests and their local harness, then rerun the reproduced targeted tests plus the full channels lane and repo check gate.

* test: fix extension test drift on main

* fix: lazy-load bundled web search plugin registry

* test: make matrix sweeper failure injection portable

* fix: split heavy matrix runtime-api seams

* fix: simplify bundled web search id lookup

* test: tolerate windows env key casing

(cherry picked from commit 2364e45)

# Conflicts:
#	extensions/bluebubbles/src/send.test.ts
#	extensions/matrix/runtime-api.ts
#	extensions/matrix/src/matrix/monitor/handler.media-failure.test.ts
#	extensions/matrix/src/matrix/thread-bindings-shared.ts
#	extensions/matrix/src/matrix/thread-bindings.test.ts
#	extensions/matrix/src/runtime-api.ts
#	extensions/signal/src/monitor.tool-result.sends-tool-summaries-responseprefix.test.ts
#	extensions/signal/src/monitor.tool-result.test-harness.ts
#	package.json
#	scripts/lib/plugin-sdk-entrypoints.json
#	src/bundled-web-search-registry.ts
#	src/node-host/invoke.sanitize-env.test.ts
#	src/plugin-sdk/matrix.ts
#	src/plugin-sdk/runtime-api-guardrails.test.ts
#	src/plugin-sdk/subpaths.test.ts
#	src/plugins/bundled-web-search.ts
#	src/secrets/runtime-web-tools.ts
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 28, 2026
* test: align extension runtime mocks with plugin-sdk

Update stale extension tests to mock the plugin-sdk runtime barrels that production code now imports, and harden the Signal tool-result harness around system-event assertions so the channels lane matches current extension boundaries.

Regeneration-Prompt: |
  Verify the failing channels-lane tests against current origin/main in an isolated worktree before changing anything. If the failures reproduce on main, keep the fix test-only unless production behavior is clearly wrong. Recent extension refactors moved Telegram, WhatsApp, and Signal code onto plugin-sdk runtime barrels, so update stale tests that still mock old core module paths to intercept the seams production code now uses. For Signal reaction notifications, avoid brittle assertions that depend on shared queued system-event state when a direct harness spy on enqueue behavior is sufficient. Preserve scope: only touch the failing tests and their local harness, then rerun the reproduced targeted tests plus the full channels lane and repo check gate.

* test: fix extension test drift on main

* fix: lazy-load bundled web search plugin registry

* test: make matrix sweeper failure injection portable

* fix: split heavy matrix runtime-api seams

* fix: simplify bundled web search id lookup

* test: tolerate windows env key casing

(cherry picked from commit 2364e45)

# Conflicts:
#	src/bundled-web-search-registry.ts
#	src/plugins/bundled-web-search.ts
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Apr 4, 2026
* test: align extension runtime mocks with plugin-sdk

Update stale extension tests to mock the plugin-sdk runtime barrels that production code now imports, and harden the Signal tool-result harness around system-event assertions so the channels lane matches current extension boundaries.

Regeneration-Prompt: |
  Verify the failing channels-lane tests against current origin/main in an isolated worktree before changing anything. If the failures reproduce on main, keep the fix test-only unless production behavior is clearly wrong. Recent extension refactors moved Telegram, WhatsApp, and Signal code onto plugin-sdk runtime barrels, so update stale tests that still mock old core module paths to intercept the seams production code now uses. For Signal reaction notifications, avoid brittle assertions that depend on shared queued system-event state when a direct harness spy on enqueue behavior is sufficient. Preserve scope: only touch the failing tests and their local harness, then rerun the reproduced targeted tests plus the full channels lane and repo check gate.

* test: fix extension test drift on main

* fix: lazy-load bundled web search plugin registry

* test: make matrix sweeper failure injection portable

* fix: split heavy matrix runtime-api seams

* fix: simplify bundled web search id lookup

* test: tolerate windows env key casing
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Apr 4, 2026
* test: align extension runtime mocks with plugin-sdk

Update stale extension tests to mock the plugin-sdk runtime barrels that production code now imports, and harden the Signal tool-result harness around system-event assertions so the channels lane matches current extension boundaries.

Regeneration-Prompt: |
  Verify the failing channels-lane tests against current origin/main in an isolated worktree before changing anything. If the failures reproduce on main, keep the fix test-only unless production behavior is clearly wrong. Recent extension refactors moved Telegram, WhatsApp, and Signal code onto plugin-sdk runtime barrels, so update stale tests that still mock old core module paths to intercept the seams production code now uses. For Signal reaction notifications, avoid brittle assertions that depend on shared queued system-event state when a direct harness spy on enqueue behavior is sufficient. Preserve scope: only touch the failing tests and their local harness, then rerun the reproduced targeted tests plus the full channels lane and repo check gate.

* test: fix extension test drift on main

* fix: lazy-load bundled web search plugin registry

* test: make matrix sweeper failure injection portable

* fix: split heavy matrix runtime-api seams

* fix: simplify bundled web search id lookup

* test: tolerate windows env key casing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: bluebubbles Channel integration: bluebubbles channel: matrix Channel integration: matrix channel: signal Channel integration: signal channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web maintainer Maintainer-authored PR scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant