Repository navigation
test(coderd/x/chatd/chattest): pin the fake response-shape errors - #30949
ibetitsmike wants to merge 2 commits into
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review
|
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
No test reached the "handler returned both streaming and non-streaming responses" and "handler returned empty response" branches of the chattest fakes, and the next PR in the stack rewrites them. This PR adds
TestFakeResponseShapeErrors, which posts to the OpenAI/chat/completions, OpenAI/responsesand Anthropic/v1/messagesfakes with a handler that returns both response shapes or neither, and checks the 500 status and the exact error body. It is the test-first layer for that rewrite, so it adds 77 lines and deletes none.Why it is safe
main.go test -overlay. Each mutant fails exactly its own row, and the rest of the package still passes on all six, so no other test covered these branches.Review focus
The test sends plain
net/httprequests with a{}body, so it asserts the fake's own output (http.Errorwrites the message and a newline) with no provider SDK in between.Validation
go test ./coderd/x/chatd/chattest/ -run TestFakeResponseShapeErrors -count=1 -v: all six rows passgo vet ./coderd/x/chatd/chattest/: okgolangci-lint run --fix=false ./coderd/x/chatd/chattest/: 0 issuesStack
The stack makes the chattest fake tests fail on wrong output, then drops the fakes' write-only state and shares their response-shape check.