Skip to content

test: annotate chat abort helper exports#45346

Merged
frankekn merged 1 commit intomainfrom
fix/chat-abort-helper-ts2883
Mar 13, 2026
Merged

test: annotate chat abort helper exports#45346
frankekn merged 1 commit intomainfrom
fix/chat-abort-helper-ts2883

Conversation

@frankekn
Copy link
Contributor

Summary

  • add explicit exported helper types for chat abort test helpers
  • avoid leaking inferred vitest internal spy types across the export surface
  • unblock pnpm check / CI check on merge refs that include chat.abort.test-helpers.ts

Verification

  • pnpm tsgo
  • pnpm exec vitest run src/gateway/server-methods/chat.abort-authorization.test.ts src/gateway/server-methods/chat.abort-persistence.test.ts
  • pnpm check

@openclaw-barnacle openclaw-barnacle bot added gateway Gateway runtime size: XS maintainer Maintainer-authored PR labels Mar 13, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 13, 2026

Greptile Summary

This PR adds explicit exported TypeScript types (ChatAbortTestContext and ChatAbortRespondMock) to the chat abort test helpers file, replacing inferred types (ReturnType<typeof createChatAbortContext> and ReturnType<typeof vi.fn>) that were leaking Vitest internal spy types into the module's export surface. The invokeChatAbortHandler function is also updated to return Promise<ChatAbortRespondMock> instead of Promise<void>, making the returned mock directly usable for typed assertions in consuming tests.

  • Adds ChatAbortTestContext as an explicitly typed interface for the test context object, intersecting Record<string, unknown> to preserve compatibility with the overrides spread pattern.
  • Adds ChatAbortRespondMock = Mock<RespondFn> to expose a properly typed respond mock, replacing the untyped ReturnType<typeof vi.fn>.
  • Updates invokeChatAbortHandler return type from implicit Promise<void> to Promise<ChatAbortRespondMock>, enabling callers to do type-safe assertions on mock call arguments (e.g. the ok: boolean first argument of RespondFn).
  • Imports RespondFn from ./types.js to support the new ChatAbortRespondMock type.

Confidence Score: 5/5

  • This PR is safe to merge — it is a pure type-annotation improvement with no runtime behavior changes.
  • All changes are restricted to TypeScript type declarations and exported type aliases. No logic, runtime behavior, or test assertions are modified. The explicit types accurately reflect the runtime shapes already present in the file, and replacing inferred Vitest-internal types with explicit ones is a strictly additive improvement to the public API surface of this test-helper module.
  • No files require special attention.

Last reviewed commit: f531c4e

@frankekn frankekn merged commit 987c254 into main Mar 13, 2026
34 checks passed
@frankekn frankekn deleted the fix/chat-abort-helper-ts2883 branch March 13, 2026 18:03
z-hao-wang pushed a commit to z-hao-wang/openclaw that referenced this pull request Mar 13, 2026
frankekn added a commit to xinhuagu/openclaw that referenced this pull request Mar 14, 2026
ecochran76 pushed a commit to ecochran76/openclaw that referenced this pull request Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant