Repository navigation
refactor(test): replace logic-bearing vi.mock factories with real modules and boundary fakes - #120063
Conversation
|
Incident-mode landing note (operator-directed). GitHub's Actions incident blocked core CI and ClawSweeper; the operator directed landing. Gates satisfied: coordinator diff review (the vi.mock factories that reimplemented |
…ules and boundary fakes (openclaw#120063) * refactor(test): use real Codex search module * refactor(test): use real Slack slash command runtime * test: satisfy Slack slash fixture lint
What Problem This Solves
Two test suites carried logic-bearing module factories that either copied production policy or let assertions pass without reaching the real implementation. The embedded-agent suite duplicated Codex native-search activation and payload injection, while the Slack slash suite duplicated command lookup, parsing, formatting, menu eligibility, and choice resolution.
Why This Change Was Made
The embedded-agent suite now uses the real Codex native-search module. Its duplicate-tool case was also corrected to route through the real OpenAI wrapper with a valid OAuth profile; the previous gateway route bypassed the behavior under test.
The Slack slash suite now imports the real command runtime and keeps only a narrow, data-only adapter for synthetic Slack-limit cases that no production command can express. Real built-ins cover login, tools, TTS, usage, think, and status behavior. The former internal mock-call assertion for dynamic think choices is now an observable assertion over encoded Block Kit menu values.
Per-file results:
src/agents/embedded-agent-runner-extraparams.test.ts: 139 -> 139 tests. Boundary: provider stream request/payload handoff. Deleted tests/assertions: none.extensions/slack/src/monitor/slash.test.ts: 56 -> 56 tests. Boundaries: Bolt/Slack response transport, model catalog loading, and plugin command discovery. Deleted tests: none. Deleted assertion: theresolveCommandArgMenumock-call inspection, replaced by observable runtime-specific menu values.Three requested files were intentionally not changed:
User Impact
No production behavior changes. The retained tests now cover production Codex search and Slack command/menu behavior instead of local reimplementations, while preserving all successful test cases.
Evidence
Passed:
node scripts/run-vitest.mjs src/agents/embedded-agent-runner-extraparams.test.ts— 139 passednode scripts/run-vitest.mjs src/agents/codex-native-web-search.test.ts— 21 passednode scripts/run-vitest.mjs src/llm/providers/stream-wrappers/openai.test.ts— 32 passednode scripts/run-vitest.mjs extensions/slack/src/monitor/slash.test.ts— 56 passednode scripts/run-vitest.mjs src/auto-reply/commands-registry.test.ts— 37 passednode scripts/run-vitest.mjs src/agents/thinking-runtime.test.ts— 12 passednode scripts/run-vitest.mjs extensions/slack/src/monitor/external-arg-menu-store.test.ts— 4 passednode scripts/run-oxlint.mjs src/agents/embedded-agent-runner-extraparams.test.ts extensions/slack/src/monitor/slash.test.tsnode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions-test.tsbuildinfogit diff --check.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main— clean, no accepted/actionable findingsChanged-gate note:
node scripts/check-changed.mjscould not acquire any remote provider. The trusted local fallback passed all guards, formatting, and lint before core-test typechecking stopped on pre-existing Control UI E2E errors inui/src/e2e/appearance-settings-defaults.e2e.test.ts(browser/serverare undefined). The independent extension-test typecheck passed.Production LOC delta: +0 / -0.
Test LOC delta from
git diff origin/main...HEAD --numstat: +175 / -385 (net -210) across two test files.