Skip to content

test(coderd/x/chatd/chatdebug): check the run-summary query boundary - #30973

Draft
ibetitsmike wants to merge 4 commits into
mike/chatdebug-summary-literal-rowsfrom
mike/chatdebug-summary-query-boundary
Draft

ibetitsmike wants to merge 4 commits into
mike/chatdebug-summary-literal-rowsfrom
mike/chatdebug-summary-query-boundary

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Replaces the last Postgres-backed run-summary subtests with mock tests of the AggregateRunSummary boundary and one extended Postgres test. This deletes MultipleStepsSumTokens and the helpers createTestStep, createTestStepN, updateTestStepWithUsage and updateTestStepWithFullUsage.

Why it is safe:

  • NilRunID now runs against a mock with no expectations, so any query fails it, and checks that the base map comes back unchanged.
  • The new QueryAsChatdReturnsError checks that the read runs as the chatd actor and that the query error is returned.
  • RecomputesHasErrorAndCompletedEndpointLabel now 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 seeded first_message. With the table from refactor(coderd/x/chatd/chatdebug): replace run-summary Postgres subtests with literal rows #30972, it covers every assertion of MultipleStepsSumTokens.
  • Of the same 42 summary.go mutants, the tests now kill 34 (main kills 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 by started_at alone now fails the Postgres test. The 8 survivors are equivalent or only change logging.
  • No references to the removed helpers remain.

Review focus: the setup order in RecomputesHasErrorAndCompletedEndpointLabel. Step 2 is created first, so the expected label holds only if the query orders by step_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.

  1. refactor(coderd/x/chatd/chatdebug): replace run-summary Postgres subtests with literal rows #30972 Replace run-summary Postgres subtests with literal rows
  2. test(coderd/x/chatd/chatdebug): check the run-summary query boundary #30973 Check the run-summary query boundary

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

…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.
@ibetitsmike
ibetitsmike added this pull request to stack #30974 October 18, 2026 16:02
@ibetitsmike ibetitsmike changed the title test(coderd/x/chatd/chatdebug): check the run-summary query boundary with mocks and one ordering test test(coderd/x/chatd/chatdebug): check the run-summary query boundary 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-18T17:17:22.402738Z e30b3ce 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. Breezy!

Reviewed commit: eb5c056f79

ℹ️ 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, requested this review for @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: e30b3ce566

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