Skip to content

refactor(coderd/x/chatd/chatdebug): replace run-summary Postgres subtests with literal rows - #30972

Draft
ibetitsmike wants to merge 3 commits into
mainfrom
mike/chatdebug-summary-literal-rows
Draft

ibetitsmike wants to merge 3 commits into
mainfrom
mike/chatdebug-summary-literal-rows

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Moves the post-query reduction in chatdebug.(*Service).AggregateRunSummary into a private summarizeRunSteps method and tests it with table cases over literal database.ChatDebugStep rows. This deletes the 11 Postgres-backed subtests of TestService_AggregateRunSummary whose assertions the table covers; each one built its own database.

Why it is safe:

  • The moved body is unchanged apart from return result. AggregateRunSummary still owns the nil run ID check, the chatd-authorized read and the error return.
  • Every assertion of the removed subtests maps to a table row that compares the whole output map, so absent keys are checked too. Each row also checks that the base map is not mutated.
  • NilRunID, RecomputesHasErrorAndCompletedEndpointLabel and MultipleStepsSumTokens stay on Postgres here; test(coderd/x/chatd/chatdebug): check the run-summary query boundary #30973 replaces them.
  • I ran 42 mutants of summary.go with go test -overlay: main's tests kill 22, this PR's tests kill 31, including all 22. The new kills cover JSON null and empty error payloads, error payloads on completed steps, malformed usage and attempts, empty paths, first-match selection and caller map mutation. Of the 11 survivors, 3 are query-boundary mutants that main also misses (test(coderd/x/chatd/chatdebug): check the run-summary query boundary #30973 kills them) and 8 are equivalent or only change logging.

Review focus: summarizeRunSteps in summary.go. The moved block should match main apart from the return statement.

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 literal rows

Move the post-query reduction of AggregateRunSummary into
summarizeRunSteps and cover it with table tests over literal
ChatDebugStep rows. Remove the Postgres subtests whose assertions
the table covers.
@ibetitsmike
ibetitsmike added this pull request to stack #30974 October 18, 2026 16:02
@ibetitsmike ibetitsmike changed the title mike/chatdebug summary literal rows test(coderd/x/chatd/chatdebug): replace run-summary Postgres subtests with literal rows 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:18:00.484404Z d95c88d 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. 🚀

Reviewed commit: 2bb4d64afb

ℹ️ 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 ibetitsmike changed the title test(coderd/x/chatd/chatdebug): replace run-summary Postgres subtests with literal rows refactor(coderd/x/chatd/chatdebug): replace run-summary Postgres subtests with literal rows Oct 18, 2026
@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. Delightful!

Reviewed commit: d95c88d370

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