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`,
`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 #30972, it covers every assertion
of `MultipleStepsSumTokens`.
- Of the same 42 `summary.go` mutants, the tests now kill 34 (`main`
kills 22, #30972 kills 31). The new kills are the nil run ID return
value, a swallowed query error and a read without the chatd actor. The 8
survivors are equivalent or only change logging.
- Mutants of the `GetChatDebugStepsByRunID` SQL that order by
`started_at` alone or reverse the order fail the Postgres test. Dropping
the `ORDER BY` survives: Postgres reads these rows through the unique
`(run_id, step_number)` index, which already returns them in step order.
- No references to the removed helpers remain.
**Review focus:** the setup order in
`RecomputesHasErrorAndCompletedEndpointLabel`. Step 2 is inserted first,
so the expected label holds only if the query orders by `step_number`.
Since #31007, `CreateStep` numbers steps itself, so the test inserts
both rows through the store with explicit step numbers.
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. #30972 Replace run-summary Postgres subtests with literal rows
2. #30973 Check the run-summary query boundary
> Xum, an AI agent, opened this PR for @ibetitsmike and wrote this
description.