Skip to content

chore: code/dead tests cleanup#38286

Merged
vincentkoc merged 2 commits intoopenclaw:mainfrom
vincentkoc:vincentkoc-code/dead-tests-cleanup
Mar 6, 2026
Merged

chore: code/dead tests cleanup#38286
vincentkoc merged 2 commits intoopenclaw:mainfrom
vincentkoc:vincentkoc-code/dead-tests-cleanup

Conversation

@vincentkoc
Copy link
Copy Markdown
Member

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem:
  • Why it matters:
  • What changed:
  • What did NOT change (scope boundary):

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

Security Impact (required)

  • New permissions/capabilities? (Yes/No)
  • Secrets/tokens handling changed? (Yes/No)
  • New/changed network calls? (Yes/No)
  • Command/tool execution surface changed? (Yes/No)
  • Data access scope changed? (Yes/No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS:
  • Runtime/container:
  • Model/provider:
  • Integration/channel (if any):
  • Relevant config (redacted):

Steps

Expected

Actual

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
  • Edge cases checked:
  • What you did not verify:

Compatibility / Migration

  • Backward compatible? (Yes/No)
  • Config/env changes? (Yes/No)
  • Migration needed? (Yes/No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly:
  • Files/config to restore:
  • Known bad symptoms reviewers should watch for:

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:
    • Mitigation:

@vincentkoc vincentkoc merged commit 38f46e8 into openclaw:main Mar 6, 2026
9 checks passed
@openclaw-barnacle openclaw-barnacle bot added channel: discord Channel integration: discord cli CLI command changes size: S maintainer Maintainer-authored PR labels Mar 6, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 6, 2026

Greptile Summary

This PR performs two test-file-only housekeeping changes: it removes a dead placeholder test file (gateway.sigterm.test.ts) that contained only an it.skip() documenting the retirement of a superseded test, and it refactors message-handler.bot-self-filter.test.ts to replace a fragile try/catch-swallowing pattern with proper vi.hoisted/vi.mock module mocking and explicit call-count assertions.

Key changes:

  • gateway.sigterm.test.ts deleted — was a comment-only placeholder with no runtime coverage.
  • Mocks for preflightDiscordMessage and processDiscordMessage are now hoisted correctly so the dynamic await import("./message-handler.js") picks them up.
  • debounceMs: 0 added to the test config, ensuring the debouncer flushes synchronously in tests.
  • createPreflightContext helper added to provide the minimal context required for buildDiscordInboundJob to enqueue work without triggering real I/O.
  • vi.waitFor() used appropriately to handle the async KeyedAsyncQueue flush.

No production code is modified.

Confidence Score: 5/5

  • Test-only cleanup with no production code changes; safe to merge.
  • Both files are test-only. The deleted file was a no-op placeholder, and the refactored test file improves reliability by introducing proper module mocking. The single style observation (missing handler.deactivate()) is non-blocking.
  • No files require special attention.

Last reviewed commit: c1ee017

Comment on lines 118 to 128
const handler = createDiscordMessageHandler(createHandlerParams());
try {
await handler(
createMessageData("user-456") as never,
{
fetchChannel: vi.fn().mockResolvedValue(null),
} as never,
);
} catch {
// Expected: pipeline fails without full mock, but it passed the filter.
}

await expect(
handler(createMessageData("user-456") as never, {} as never),
).resolves.toBeUndefined();

await vi.waitFor(() => {
expect(preflightDiscordMessageMock).toHaveBeenCalledTimes(1);
expect(processDiscordMessageMock).toHaveBeenCalledTimes(1);
});
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing handler deactivation after test

createDiscordMessageHandler internally creates a createDiscordInboundWorker, which owns a KeyedAsyncQueue and a run-state machine. Neither test calls handler.deactivate() after use. In the second test the worker actually processes a job (via runDiscordTaskWithTimeout), which sets an internal timeout. Vitest may report an open-handle warning, and if a future slow CI run lets the timeout fire after the test module is torn down, it could surface a noisy error.

Consider adding cleanup:

Suggested change
const handler = createDiscordMessageHandler(createHandlerParams());
try {
await handler(
createMessageData("user-456") as never,
{
fetchChannel: vi.fn().mockResolvedValue(null),
} as never,
);
} catch {
// Expected: pipeline fails without full mock, but it passed the filter.
}
await expect(
handler(createMessageData("user-456") as never, {} as never),
).resolves.toBeUndefined();
await vi.waitFor(() => {
expect(preflightDiscordMessageMock).toHaveBeenCalledTimes(1);
expect(processDiscordMessageMock).toHaveBeenCalledTimes(1);
});
});
const handler = createDiscordMessageHandler(createHandlerParams());
await expect(
handler(createMessageData("user-456") as never, {} as never),
).resolves.toBeUndefined();
await vi.waitFor(() => {
expect(preflightDiscordMessageMock).toHaveBeenCalledTimes(1);
expect(processDiscordMessageMock).toHaveBeenCalledTimes(1);
});
handler.deactivate();
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/discord/monitor/message-handler.bot-self-filter.test.ts
Line: 118-128

Comment:
**Missing handler deactivation after test**

`createDiscordMessageHandler` internally creates a `createDiscordInboundWorker`, which owns a `KeyedAsyncQueue` and a run-state machine. Neither test calls `handler.deactivate()` after use. In the second test the worker actually processes a job (via `runDiscordTaskWithTimeout`), which sets an internal timeout. Vitest may report an open-handle warning, and if a future slow CI run lets the timeout fire after the test module is torn down, it could surface a noisy error.

Consider adding cleanup:

```suggestion
    const handler = createDiscordMessageHandler(createHandlerParams());

    await expect(
      handler(createMessageData("user-456") as never, {} as never),
    ).resolves.toBeUndefined();

    await vi.waitFor(() => {
      expect(preflightDiscordMessageMock).toHaveBeenCalledTimes(1);
      expect(processDiscordMessageMock).toHaveBeenCalledTimes(1);
    });

    handler.deactivate();
```

How can I resolve this? If you propose a fix, please make it concise.

mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Mar 6, 2026
* main: (37 commits)
  feat(gateway): add channel-backed readiness probes (openclaw#38285)
  CI: enable report-only Knip deadcode job
  Tooling: wire deadcode scripts to Knip
  Tooling: add Knip workspace config
  CI: skip detect-secrets on main temporarily
  Install Smoke: fetch docs base on demand
  CI: fetch base history on demand
  CI: add base-commit fetch helper
  Docs: clarify main secret scan behavior
  CI: keep full secret scans on main
  Docs: update secret scan reproduction steps
  CI: scope secret scans to changed files
  Media: reject spoofed input_image MIME payloads (openclaw#38289)
  chore: code/dead tests cleanup (openclaw#38286)
  Install Smoke: cache docker smoke builds
  Install Smoke: allow reusing prebuilt test images
  Install Smoke: shallow docs-scope checkout
  CI: shallow scope checkouts
  feat(onboarding): add web search to onboarding flow (openclaw#34009)
  chore: disable contributor labels
  ...
vincentkoc added a commit to BryanTegomoh/openclaw-fork that referenced this pull request Mar 8, 2026
* Discord: assert bot-self filter queue guard

* Tests: remove dead gateway SIGTERM placeholder
Saitop pushed a commit to NomiciAI/openclaw that referenced this pull request Mar 8, 2026
* Discord: assert bot-self filter queue guard

* Tests: remove dead gateway SIGTERM placeholder
jenawant pushed a commit to jenawant/openclaw that referenced this pull request Mar 10, 2026
* Discord: assert bot-self filter queue guard

* Tests: remove dead gateway SIGTERM placeholder
dhoman pushed a commit to dhoman/chrono-claw that referenced this pull request Mar 11, 2026
* Discord: assert bot-self filter queue guard

* Tests: remove dead gateway SIGTERM placeholder
senw-developers pushed a commit to senw-developers/va-openclaw that referenced this pull request Mar 17, 2026
* Discord: assert bot-self filter queue guard

* Tests: remove dead gateway SIGTERM placeholder
V-Gutierrez pushed a commit to V-Gutierrez/openclaw-vendor that referenced this pull request Mar 17, 2026
* Discord: assert bot-self filter queue guard

* Tests: remove dead gateway SIGTERM placeholder
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 20, 2026
* Discord: assert bot-self filter queue guard

* Tests: remove dead gateway SIGTERM placeholder

(cherry picked from commit 38f46e8)
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 20, 2026
* Discord: assert bot-self filter queue guard

* Tests: remove dead gateway SIGTERM placeholder

(cherry picked from commit 38f46e8)
alexey-pelykh added a commit to remoteclaw/remoteclaw that referenced this pull request Mar 20, 2026
* fix(subagents): recover announce cleanup after kill/complete race

(cherry picked from commit 2f86ae7)

* feat(hooks): emit compaction lifecycle hooks (openclaw#16788)

(cherry picked from commit 71ec421)

* fix(agent): harden undici stream timeouts for long openai-completions runs

(cherry picked from commit 05fb16d)

* fix(agents): allow configured ollama endpoints without dummy api keys

(cherry picked from commit 36afd1b)

* feat(openai): add gpt-5.4 support for API and Codex OAuth (openclaw#36590)

Co-authored-by: Tyler Yust <[email protected]>
(cherry picked from commit 5d4b040)

* Fix failover for zhipuai 1310 Weekly/Monthly Limit Exhausted (openclaw#33813)

Co-authored-by: zhouhe-xydt <[email protected]>
Co-authored-by: altaywtf <[email protected]>
(cherry picked from commit a65d70f)

* fix(failover): classify HTTP 402 as rate_limit when payload indicates usage limit (openclaw#30484) (openclaw#36802)

Co-authored-by: Val Alexander <[email protected]>
(cherry picked from commit 01b2017)

* feat(onboarding): add web search to onboarding flow (openclaw#34009)

* add web search to onboarding flow

* remove post onboarding step (now redundant)

* post-onboarding nudge if no web search set up

* address comments

* fix test mocking

* add enabled: false assertion to the no-key test

* --skip-search cli flag

* use provider that a user has a key for

* add assertions, replace the duplicated switch blocks

* test for quickstart fast-path with existing config key

* address comments

* cover quickstart falls through to key test

* bring back key source

* normalize secret inputs instead of direct string trimming

* preserve enabled: false if it's already set

* handle missing API keys in flow

* doc updates

* hasExistingKey to detect both plaintext strings and SecretRef objects

* preserve enabled state only on the "keep current" paths

* add test for preserving

* better gate flows

* guard against invalid provider values in config

* Update src/commands/configure.wizard.ts

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* format fix

* only mentions env var when it's actually available

* search apiKey fields now typed as SecretInput

* if no provider check if any search provider key is detectable

* handle both kimi keys

* remove .filter(Boolean)

* do not disable web_search after user enables it

* update resolveSearchProvider

* fix(onboarding): skip search key prompt in ref mode

* fix: add onboarding web search step (openclaw#34009) (thanks @kesku)

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Shadow <[email protected]>
(cherry picked from commit 3d7bc59)

* fix(ci): restore protocol and schema checks (openclaw#37470)

(cherry picked from commit ee6f7b1)

* Infra: require explicit opt-in for prerelease npm installs (openclaw#38117)

* Infra: tighten npm registry spec parsing

* Infra: block implicit prerelease npm installs

* Plugins: cover prerelease install policy

* Infra: add npm registry spec tests

* Hooks: cover prerelease install policy

* Docs: clarify plugin guide version policy

* Docs: clarify plugin install version policy

* Docs: clarify hooks install version policy

* Docs: clarify hook pack version policy

(cherry picked from commit f392b81)

* ci: trigger workflow

* fix: resolve cherry-pick adaptation failures from upstream web search commit

- Add missing hasConfiguredSecretInput() to types.secrets.ts
- Add SecretInput import to types.tools.ts for apiKey fields
- Replace OpenClawConfig with RemoteClawConfig in onboard-search
- Remove non-existent DEFAULT_SECRET_PROVIDER_ALIAS import
- Remove invalid 'provider' field from SecretRef literal
- Stub resolveSyntheticLocalProviderAuth (models.providers was gutted)
- Replace undefined registerRun/emitLifecycleEnd test helpers with
  existing mod.registerSubagentRun/lifecycleHandler patterns

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* Plugins: clarify registerHttpHandler migration errors (openclaw#36794)

* Changelog: note plugin HTTP route migration diagnostics

* Tests: cover registerHttpHandler migration diagnostics

* Plugins: clarify registerHttpHandler migration errors

* Tests: cover registerHttpHandler diagnostic edge cases

* Plugins: tighten registerHttpHandler migration hint

(cherry picked from commit d4021f4)

* Plugins: avoid false integrity drift prompts on unpinned updates (openclaw#37179)

* Plugins: skip drift prompts for unpinned updates

* Plugins: cover unpinned integrity update behavior

(cherry picked from commit 428d176)

* docs(protocol): document slash-delimited schema lookup plugin ids

(cherry picked from commit f788ba1)

* docs(plugins): document context engine slots and registration

(cherry picked from commit eb2eeba)

* docs(plugins): add context-engine manifest kind example

(cherry picked from commit 7cc3376)

* docs(config): list the context engine plugin slot

(cherry picked from commit 5470337)

* fix: Windows: openclaw plugins install fails with spawn EINVAL

Fixes openclaw#7631

(cherry picked from commit d000316)

* fix(whatsapp): remove implicit [openclaw] self-chat prefix

(cherry picked from commit 4d9134f)

* WhatsApp: honor outbound mediaMaxMb (openclaw#38097)

* WhatsApp: add media cap helper

* WhatsApp: cap outbound media loads

* WhatsApp: align auto-reply media caps

* WhatsApp: add outbound media cap test

* WhatsApp: update auto-reply cap tests

* Docs: update WhatsApp media caps

* Changelog: note WhatsApp media cap fix

(cherry picked from commit 222d635)

* fix(mattermost): allow reachable interaction callback URLs (openclaw#37543)

Merged via squash.

Prepared head SHA: 4d59373
Co-authored-by: mukhtharcm <[email protected]>
Co-authored-by: mukhtharcm <[email protected]>
Reviewed-by: @mukhtharcm

(cherry picked from commit 4a80d48)

* Mattermost: harden interaction callback binding (openclaw#38057)

(cherry picked from commit a274ef9)

* chore: code/dead tests cleanup (openclaw#38286)

* Discord: assert bot-self filter queue guard

* Tests: remove dead gateway SIGTERM placeholder

(cherry picked from commit 38f46e8)

* Delete changelog/fragments directory

(cherry picked from commit 8f69e07)

* fix(feishu): restore explicit media request timeouts

(cherry picked from commit b127333)

* fix: adapt upstream naming to fork conventions

Replace OpenClawConfig with RemoteClawConfig, openclaw/plugin-sdk with
remoteclaw/plugin-sdk, and fix import paths for fork type exports.

* fix: resolve type errors from upstream cherry-picks

- Add missing RemoteClawConfig import in discord test
- Use spread with as-any for feishu SDK timeout property
- Remove allowUnresolvedSecretRef from mattermost test

* ci: re-trigger CI after force push

* fix: revert unintended onboarding changes from linter bleed

* ci: sync PR head with branch

---------

Co-authored-by: Vignesh Natarajan <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: dorukardahan <[email protected]>
Co-authored-by: Tyler Yust <[email protected]>
Co-authored-by: zhouhe-xydt <[email protected]>
Co-authored-by: zhouhe-xydt <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Co-authored-by: Xinhua Gu <[email protected]>
Co-authored-by: Val Alexander <[email protected]>
Co-authored-by: Kesku <[email protected]>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Shadow <[email protected]>
Co-authored-by: Altay <[email protected]>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Co-authored-by: 0xlin2023 <[email protected]>
Co-authored-by: Muhammed Mukhthar CM <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord cli CLI command changes maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant