Skip to content

test: fix setup finalize web search mocks#51253

Merged
jalehman merged 1 commit intoopenclaw:mainfrom
jalehman:codex/pr-51191-setup-finalize
Mar 20, 2026
Merged

test: fix setup finalize web search mocks#51253
jalehman merged 1 commit intoopenclaw:mainfrom
jalehman:codex/pr-51191-setup-finalize

Conversation

@jalehman
Copy link
Copy Markdown
Contributor

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: pnpm tsgo fails on current origin/main because src/wizard/setup.finalize.test.ts still mocks web-search providers with an outdated partial shape.
  • Why it matters: the stale mock blocks repo typechecking even though the production provider contract is correct.
  • What changed: added a small test helper that creates fully typed PluginWebSearchProviderEntry mocks, then reused it in the two affected cases.
  • What did NOT change (scope boundary): no production runtime behavior, plugin contracts, or provider implementations changed.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • 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

User-visible / Behavior Changes

None.

Security Impact (required)

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

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node 22 via pnpm workspace
  • Model/provider: N/A
  • Integration/channel (if any): N/A
  • Relevant config (redacted): none

Steps

  1. Run pnpm tsgo on current origin/main.
  2. Observe TypeScript errors in src/wizard/setup.finalize.test.ts for mocked PluginWebSearchProviderEntry values.
  3. Apply this patch and rerun the same checks.

Expected

  • pnpm tsgo passes.
  • pnpm test -- src/wizard/setup.finalize.test.ts passes.

Actual

  • Before: the test file failed typechecking because two mocks were missing required provider fields.
  • After: both commands pass.

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: pnpm tsgo and pnpm test -- src/wizard/setup.finalize.test.ts both pass in this worktree.
  • Edge cases checked: the helper preserves provider-specific metadata while satisfying the newer required runtime hook fields.
  • What you did not verify: full pnpm check is currently blocked on an unrelated baseline mismatch in src/plugins/bundled-web-search-registry.ts already present on current origin/main.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

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

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: revert this commit; it only affects test code.
  • Files/config to restore: src/wizard/setup.finalize.test.ts
  • Known bad symptoms reviewers should watch for: none beyond the original pnpm tsgo failure returning.

Risks and Mitigations

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

  • Risk: the helper could accidentally hide a future required field addition if its construction path stops matching the test intent.
    • Mitigation: it still returns a typed PluginWebSearchProviderEntry, so future required contract changes will continue surfacing at this single seam.

Regeneration-Prompt: |
  Fix the unrelated TypeScript breakage in src/wizard/setup.finalize.test.ts that
  blocked pnpm tsgo on current origin/main. The failing tests mocked configured web
  search providers using an outdated partial shape, but PluginWebSearchProviderEntry
  now requires pluginId plus runtime hook methods like getCredentialValue,
  setCredentialValue, and createTool. Keep the fix additive and local to the test
  seam by introducing a small helper that builds fully typed provider entries, then
  reuse it in the affected cases instead of weakening production types.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 20, 2026

Greptile Summary

This PR fixes a TypeScript typecheck failure (pnpm tsgo) in src/wizard/setup.finalize.test.ts caused by two test mocks that were using partial object literals for PluginWebSearchProviderEntry, omitting the required runtime method fields (getCredentialValue, setCredentialValue, createTool) and the pluginId property added to the type contract.

The fix introduces a small createWebSearchProviderEntry helper that accepts only the provider-specific identifying fields and fills in no-op stubs for the runtime hooks, returning a correctly typed PluginWebSearchProviderEntry. The helper is then used in the two affected test cases.

  • No production code, plugin contracts, or runtime behavior changed — this is a test-only fix.
  • The helper's return type being PluginWebSearchProviderEntry ensures future required field additions to the contract will surface as compile errors at the helper's definition, not silently at call sites.
  • The no-op stubs (() => undefined, () => {}, () => null) are appropriate since the affected tests only exercise provider selection/reporting logic and never invoke the runtime methods on the mock entries.

Confidence Score: 5/5

  • Safe to merge — test-only change that fixes a typecheck failure with no production code impact.
  • The change is minimal, scoped entirely to a test file, and correctly addresses the root cause: the mocks were missing required fields from the PluginWebSearchProviderEntry type. The helper is well-typed and the no-op stubs are appropriate for the test scenarios. No logical issues found.
  • No files require special attention.

Last reviewed commit: "test: fix setup fina..."

@jalehman jalehman merged commit 23fef04 into openclaw:main Mar 20, 2026
11 checks passed
@jalehman jalehman deleted the codex/pr-51191-setup-finalize branch March 20, 2026 20:07
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Mar 20, 2026
frankekn pushed a commit to artwalker/openclaw that referenced this pull request Mar 23, 2026
furaul pushed a commit to furaul/openclaw that referenced this pull request Mar 24, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant