Skip to content

test: expand sequential response coverage across providers and edge cases#52

Merged
jpr5 merged 8 commits intomainfrom
test/sequential-robustness
Mar 20, 2026
Merged

test: expand sequential response coverage across providers and edge cases#52
jpr5 merged 8 commits intomainfrom
test/sequential-robustness

Conversation

@jpr5
Copy link
Copy Markdown
Contributor

@jpr5 jpr5 commented Mar 20, 2026

Summary

Comprehensive test coverage expansion and two implementation improvements across the entire llmock codebase.

Implementation Changes

Chaos injection feature — New fault tolerance testing capability:

  • ChaosConfig with dropRate, malformedRate, disconnectRate (all 0-1 probability)
  • Three override levels: server defaults < fixture-level < per-request headers (X-LLMock-Chaos-*)
  • All HTTP handlers wired (Chat Completions, Responses, Messages, Gemini, Bedrock, Embeddings)
  • CLI flags: --chaos-drop, --chaos-malformed, --chaos-disconnect
  • Journal recording with chaosAction field
  • setChaos()/clearChaos() on LLMock class (propagates to running server)

Provider-specific error formats — Previously all providers returned identical OpenAI-style error JSON. Now:

  • Anthropic/Bedrock: { type: "error", error: { type, message } }
  • Gemini: { error: { code, message, status } }
  • OpenAI: unchanged (already correct)

Test Coverage (848 → 906 tests, +58)

Sequential Responses (+9): error responses, tool calls, gap indices, Anthropic/Gemini sequences, predicate+sequenceIndex, model matching, resetMatchCounts, concurrent requests

Embeddings (+14): base64 encoding_format, empty input, sequential embeddings, Unicode, error status codes (401, 503)

Structured Output (+9): streaming json_object, json_schema matching, combined responseFormat+model+userMessage routing, malformed response_format, sequenceIndex+error interleaving

Streaming Physics (+6): streamingProfile+truncateAfterChunks combined, streamingProfile+disconnectAfterMs, truncateAfterChunks:1 boundary, large chunkSize, empty content streaming, Anthropic truncation

Chaos (+12): server-level drop/malformed on Anthropic/Gemini/Bedrock, fixture-level chaos scoping, journal recording, setChaos/clearChaos integration

Error Format (+6): Anthropic/Gemini/Bedrock format conformance, streaming error returns JSON not SSE, cross-provider format verification

Provider Coverage (+4): Azure streaming, onToolResult live verification, onToolCall response verification, Groq streaming through proxy

Fixtures (+7): streamingProfile/chaos JSON passthrough, validation boundary conditions (status 99/100/599), error status default 500

WebSocket (+5): concurrent message serialization (no interleaving), frame fragmentation (continuation frames), multiple tool calls (Realtime + Responses WS)

Bug Fixes Found During Testing

  • setChaos()/clearChaos() silently failed on running servers (captured snapshot at startup, not live reference)
  • Error responses used OpenAI format for all providers (Anthropic, Gemini, Bedrock now use native formats)

Test plan

  • All 906 tests pass
  • Prettier clean
  • ESLint clean
  • Full build passes
  • 7-agent code review loop — zero actionable findings

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 20, 2026

Open in StackBlitz

npm i https://pkg.pr.new/CopilotKit/llmock/@copilotkit/llmock@52

commit: bbd3554

@jpr5 jpr5 force-pushed the test/sequential-robustness branch from d77ddce to 6097baa Compare March 20, 2026 08:48
jpr5 added 4 commits March 20, 2026 02:07
Add ChaosConfig with dropRate, malformedRate, disconnectRate. Chaos
can be configured at server level, fixture level, or per-request via
headers (X-LLMock-Chaos-*). Fixture overrides server, headers override
both. Actions are journaled with chaosAction field.

Also fix setChaos/clearChaos to propagate to running server by
exposing defaults on ServerInstance.
Anthropic (/v1/messages, Bedrock) now returns { type: 'error', error: { type, message } }.
Gemini now returns { error: { code, message, status } }.
OpenAI Chat unchanged (already correct).

Previously all providers returned identical OpenAI-style error JSON.
- Cross-provider error format conformance and streaming error tests
- Azure streaming through deployment path
- Error fixture with sequenceIndex (success/error/success)
- onToolResult and onToolCall live server verification
- setChaos/clearChaos integration tests
- Fixture loader streamingProfile/chaos passthrough and validation boundaries
- Groq streaming through proxy path
- Error status codes (401, 503, default 500)
…i-tool coverage

- Concurrent message serialization: verify no event interleaving on rapid sends
- WS frame fragmentation: continuation frame reassembly
- Multiple tool calls in single response (Realtime + Responses WS)
@jpr5 jpr5 merged commit d3eebc2 into main Mar 20, 2026
10 checks passed
@jpr5 jpr5 deleted the test/sequential-robustness branch March 20, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant