test: add reusable fixtures for E2E testing with real AI SDK pipeline#20208
Open
rmk40 wants to merge 1 commit intoanomalyco:devfrom
Open
test: add reusable fixtures for E2E testing with real AI SDK pipeline#20208rmk40 wants to merge 1 commit intoanomalyco:devfrom
rmk40 wants to merge 1 commit intoanomalyco:devfrom
Conversation
Add two shared test fixtures that enable E2E tests through the real AI SDK streamText pipeline without mocking: - test/fixture/anthropic.ts: fake Anthropic HTTP server with SSE response helpers (toolResponse, textResponse, waitRequest, deferred) - test/fixture/prompt-layers.ts: full SessionPrompt Effect layer stack with real LLM.defaultLayer and no-op stubs for MCP/LSP/FileTime These fixtures reduce boilerplate for tests that need to exercise the complete prompt pipeline (tool registration, resolveTools, processor event handling) against a fake provider. Closes anomalyco#20206
317dc09 to
6d82489
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #20206
Type of change
What does this PR do?
Adds two shared test fixtures that enable E2E tests through the real AI SDK
streamTextpipeline without mocking the LLM layer:test/fixture/anthropic.ts— Fake Anthropic HTTP server (Bun.serve({port:0})) with lifecycle management (start/stop/reset/origin) and SSE response helpers (toolResponse,textResponse,sse,waitRequest,deferred). The server queues responses FIFO and captures request details for assertions.test/fixture/prompt-layers.ts— FullSessionPromptEffect layer stack with realLLM.defaultLayerand no-op stubs for MCP/LSP/FileTime. Exports a singleenvlayer thattestEffect(env)can consume directly.Currently,
llm.test.tshas its own inline fake server and SSE helpers (~80 lines). These fixtures extract and generalize that pattern so future tests that need the complete prompt pipeline (tool registration viaToolRegistry,resolveTools, processor event handling) can import them instead of duplicating boilerplate.First consumer will be the regression test for #20184.
How did you verify your code works?
bun typecheckpasses frompackages/opencodeScreenshots / recordings
N/A — test infrastructure, not UI change.
Checklist