Repository navigation
test(coderd/x/chatd): fold taskTestFixture into workerTestFixture - #30924
ibetitsmike wants to merge 2 commits into
Conversation
taskTestFixture repeated workerTestFixture with the same seed rows, plus copies of the chat setup helpers, publishChatUpdate and two message builders. The task, hook and turn-trace tests now use workerTestFixture, whose helpers clear the recording pubsub at the same points the copies did. forceExecutionStateWithDeadline carries the explicit deadline the task copy took. The fixture's API key and the apiKeyID parameter of userTextMessage are dropped: nothing read them.
|
@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. 🎉 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. Can't wait for the next one! 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". |
taskTestFixtureintasks_test.gorepeatedworkerTestFixturefield for field, with the same seed rows, and carried its own copies of five chat setup helpers,publishChatUpdateand two message builders. This PR deletes the fixture and the copies and moves the 39 task, hook and turn-trace tests that built it ontoworkerTestFixtureand the shared helpers. It also drops the fixture's API key row and theapiKeyIDparameter ofuserTextMessage, which nothing read.Why it is safe
The copies differed from the shared helpers in two ways, and both are kept:
interruptChatcleared it before interrupting, so assertions on published events see only what the code under test published.workerTestFixture.pubsubis now that recorder (from the layer below), and the shared helpers clear it at the same points. No worker test reads the fixture recorder's events, so the extra clears do not change them.forceExecutionStatetook an explicit requires-action deadline.forceExecutionStateWithDeadlinetakes it as a pointer (nil keeps the current one) forsetRequiresActionDeadlineand the one call that cleared an expired deadline. The other three callers passed an empty deadline for chats that never had one, so they callforceExecutionState.The rest of the move keeps the old behavior:
startRealTaskWorkernow starts fromtestOptions, which holds the same values. It unsets the recording task starter so the worker builds its real one, as before.After the change,
rg 'taskTestFixture|taskUserTextMessage|taskAssistantToolCallMessage|f\.apiKey' coderd/ enterprise/finds nothing.Review focus
The
clear()placement inhelpers_test.go. Setup helpers clear when they finish, andinterruptChatclears before it runs.Validation
Same commands as the layer below: the 142 top-level tests in the ten files listed there, run from
go test -c ./coderd/x/chatd/binaries (plain and-race) with-test.count=1 -test.parallel 4.-racemain(e289c6fe011)The pre-commit hook passed.
Stack
The stack folds the task test fixture into the shared worker test fixture.
recordingPubsubin the task test fixturetaskTestFixtureintoworkerTestFixture(this PR)