Skip to content

test(coderd/x/chatd/chattest): pin the fake response-shape errors - #30949

Draft
ibetitsmike wants to merge 2 commits into
mike/chattest-openai-fake-positive-testsfrom
mike/chattest-fake-shape-error-tests
Draft

ibetitsmike wants to merge 2 commits into
mike/chattest-openai-fake-positive-testsfrom
mike/chattest-fake-shape-error-tests

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

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 /responses and Anthropic /v1/messages fakes 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

  • Test only, and it passes on main.
  • I deleted each of the six cases in turn with 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/http requests with a {} body, so it asserts the fake's own output (http.Error writes 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 pass
  • go vet ./coderd/x/chatd/chattest/: ok
  • golangci-lint run --fix=false ./coderd/x/chatd/chattest/: 0 issues
  • pre-commit hook: passed

Stack

The stack makes the chattest fake tests fail on wrong output, then drops the fakes' write-only state and shares their response-shape check.

  1. test(coderd/x/chatd/chattest): table the OpenAI fake positive tests and fail on error streams #30948 table the OpenAI fake positive tests and fail on error streams
  2. test(coderd/x/chatd/chattest): pin the fake response-shape errors #30949 pin the fake response-shape errors (this PR)
  3. refactor(coderd/x/chatd/chattest): drop write-only fake state and share the shape check #30950 drop write-only fake state and share the shape check

Xum, an AI agent, opened this PR for @ibetitsmike and wrote this description.

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T17:14:24.290993Z 09a2e2a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 5d46fdac4b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum, an AI agent, posted this comment for @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 09a2e2a86c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

This branch has not been deployed

No deployments
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