Repository navigation
feat(fakes): add fault injection and scripted Write tool_use to mock-anthropic - #2
Merged
MushuEE merged 5 commits intoNov 16, 2026
Conversation
MushuEE
reviewed
Nov 14, 2026
MushuEE
left a comment
Contributor
There was a problem hiding this comment.
Looks good overall, and it lines up with the fakes/E2E plan (FAULT modes and scripted Write tool_use). I found three small bugs while poking at it locally; details inline. Both selftests pass on pr1 and pr2.
…_use - Validate slow_delay (number, finite, >= 0) before applying any config so an invalid value returns 400 instead of half-applying and dropping the connection. - Only emit the scripted Write tool_use when the request offers a Write tool, so tool-less side requests (quota probes, title generation) get text. - Apply truncated_sse only as stream truncation for streaming requests; for non-streaming requests, send a JSON body cut off mid-way instead of SSE. - Add selftest cases for all three and document behavior in the README.
MushuEE
previously approved these changes
Nov 16, 2026
MushuEE
approved these changes
Nov 16, 2026
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.
Extends
fakes/mock-anthropicwith runtime fault injection and multi-turnWritetool-call scripting for Claude Code E2E testing:FAULTenv orPOST /_mock/config):429(rate limit withRetry-After: 1),500(server error for SDK retry testing),slow(delayed JSON/SSE), andtruncated_sse(stream cut off beforemessage_stop).Writetool_use(TOOL_WRITE_PATH/TOOL_WRITE_CONTENT): Turn 1 emits aWritetool_usecall (SSE or JSON); Turn 2 (oncetool_resultis returned) replies withREPLY_TEXT(end_turn).POST /_mock/config): Allows switching fault/tool settings between test cases without restarting the pod, with validation (400on unknown keys/faults) and reset onPOST /_mock/reset.fakes/mock-anthropic/selftest.shto cover all fault modes, config validation, and 2-turnWritetool_use.