Skip to content

test(coderd): table the chatstate queue and invalid-state endpoint tests - #30941

Draft
ibetitsmike wants to merge 2 commits into
mainfrom
mike/coderd-chatstate-http-tables
Draft

ibetitsmike wants to merge 2 commits into
mainfrom
mike/coderd-chatstate-http-tables

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Replaces nine copy-pasted endpoint tests in coderd/exp_chats_chatstate_test.go with two table tests that each share one coderd server. TestChatQueueEndpointErrors turns the four queue delete and promote tests into rows. TestInvalidChatStateEndpoints turns the two shared invalid-state response tests into rows and holds the three reconcile cases as subtests. Every old case stays a parallel subtest with its own chat, and the file starts 13 coderd servers instead of 20.

Why it is safe: each subtest sends the same request and makes the same assertions as the test it replaces. With the old tests compiled back in through go test -overlay, each of 10 production mutants failed exactly the old test that guarded the line and the subtest that replaces it:

Mutant Failed, old and new
queue delete or promote returns 409 for an unknown ID, or 404 for an empty queue (4 mutants) the matching Missing or EmptyQueue case
send or tool results skip writeChatInvalidState (2 mutants) the matching ReturnsSharedResponse case
reconcile changes its not-invalid message ReconcileNotInvalidReturnsConflict
reconcile returns the old chat, or drops the default last_error (2 mutants) ReconcileSucceeds
the chat URL parameter maps a missing chat to 500 ReconcileNotFound

Review focus: subtests now share a server, user, and model config. Each subtest creates its own chat and reads only that chat, and withChatWorkerDisabled stays on, so no worker moves a chat between steps.

Timing (-count=1 -v -p 4 -parallel 4, median of 5 paired runs on a shared host): the nine old tests took 3.8 s summed. The two new tests take 0.9 s.

Validation:

  • go test ./coderd -run '^(TestChatQueueEndpointErrors|TestInvalidChatStateEndpoints)$' -count=10: pass
  • the same run with -race -count=3: pass
  • go vet ./coderd and golangci-lint run ./coderd/...: clean; the pre-commit hook passed

Stack: these two PRs share coderd servers across the copy-pasted chatstate endpoint tests.

  1. test(coderd): table the chatstate queue and invalid-state endpoint tests #30941 (this PR): queue and invalid-state tables
  2. test(coderd): share one server across the chat child archive tests #30956: child archive tests on one server

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

…ndpoint tests

Twelve tests in exp_chats_chatstate_test.go each started their own
coderd server to make one request. Merge them into three tests that
share a server: TestChatQueueEndpointErrors for queue delete and
promote, TestPatchChatChildArchive for the family archive rules, and
TestInvalidChatStateEndpoints for the shared invalid-state response
and reconcile. Every case stays a parallel subtest with its own chats.
The child archive test merge moves to its own stacked PR, so this
layer only tables the queue and invalid-state endpoint tests.
@ibetitsmike
ibetitsmike added this pull request to stack #30957 October 18, 2026 15:46
@ibetitsmike ibetitsmike changed the title test(coderd): table the chatstate queue, archive, and invalid-state endpoint tests test(coderd): table the chatstate queue and invalid-state endpoint tests Oct 18, 2026
@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-18T15:53:35.533762Z 959f0bb 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. Delightful!

Reviewed commit: 959f0bb629

ℹ️ 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