Repository navigation
test(coderd/x/chatd/chatdebug): check the run-summary query boundary - #30973
ibetitsmike wants to merge 4 commits into
Conversation
…with mocks and one ordering test Test the nil run ID and the chatd-authorized query error with mocks, and extend the remaining Postgres test to check summed usage and step ordering through the real query.
|
@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. Breezy! 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. Already looking forward to the next diff. 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". |
Replaces the last Postgres-backed run-summary subtests with mock tests of the
AggregateRunSummaryboundary and one extended Postgres test. This deletesMultipleStepsSumTokensand the helperscreateTestStep,createTestStepN,updateTestStepWithUsageandupdateTestStepWithFullUsage.Why it is safe:
NilRunIDnow runs against a mock with no expectations, so any query fails it, and checks that the base map comes back unchanged.QueryAsChatdReturnsErrorchecks that the read runs as the chatd actor and that the query error is returned.RecomputesHasErrorAndCompletedEndpointLabelnow inserts step 2 before step 1 and compares the whole summary read through the real query: five token sums,has_error, the endpoint label and the seededfirst_message. With the table from refactor(coderd/x/chatd/chatdebug): replace run-summary Postgres subtests with literal rows #30972, it covers every assertion ofMultipleStepsSumTokens.summary.gomutants, the tests now kill 34 (mainkills 22, refactor(coderd/x/chatd/chatdebug): replace run-summary Postgres subtests with literal rows #30972 kills 31). The new kills are the nil run ID return value, a swallowed query error and a read without the chatd actor. A mutant that orders the query bystarted_atalone now fails the Postgres test. The 8 survivors are equivalent or only change logging.Review focus: the setup order in
RecomputesHasErrorAndCompletedEndpointLabel. Step 2 is created first, so the expected label holds only if the query orders bystep_number.Validation:
go test -race -count=1 -p 4 -parallel 4 ./coderd/x/chatd/chatdebug/...passes.golangci-lint run --fix=false ./coderd/x/chatd/chatdebug/...reports 0 issues, and the pre-commit hook passed.Stack
This stack makes the debug run-summary reduction database-free and replaces its Postgres fixtures with literal rows.