Repository navigation
test(coderd/x/chatd/chatprompt): table the text and error tool result rows in memory - #30945
ibetitsmike wants to merge 3 commits into
Conversation
|
@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". |
…error and mime checks ErrorResultStaysError now compares the whole error message, so it fails when error extraction returns the JSON wrapper. IsMediaTrueButMissingMimeType now carries valid base64, so it fails only when the mime check is missing.
|
@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". |
TestMediaToolResultRoundTripwrote a chat and two messages to PostgreSQL for every tool result codec case, although the read policy under test (toolResultPartToMessagePart) is pure. This PR moves the eight text-fallback and error cases intoTestMediaToolResultConversion, an in-memory table, and deletes their database subtests:TextResultStaysText,MissingMimeTypeStaysText,MissingDataStaysText,ErrorResultStaysError,NonMediaResultTypeStaysTextand the threeIsMediaTrueBut*cases. The table encodes the same assistant tool call and tool result withMarshalPartsandCurrentContentVersion, then runsConvertMessagesWithFiles. The layer above moves the media rows.Why it is safe
ToolCallIDandProviderExecuted=false, and text rows compare the output to a literal withJSONEq.ErrorResultStaysErrorcompares the whole error message, andIsMediaTrueButMissingMimeTypecarries valid base64, so it fails on themime_typecheck itself rather than in the base64 branch.chatprompt.gowithgo test -overlayagainst the tests onmain, on this PR and on test(coderd/x/chatd/chatprompt): table the media codec matrix in memory #30946 (list below). Every mutant thatmaincatches, this PR catches too. Three that survive onmainfail here, and one (IsMedia winning over IsError) survives everywhere.Mutants (main / this PR / #30946)
main, caught here and in test(coderd/x/chatd/chatprompt): table the media codec matrix in memory #30946: nomime_typecheck; placeholder for every IsMedia text fallback; error-string extraction disabled.ProviderExecutedforced true for media, text or error results; text or mediaToolCallIDdropped; base64 check skipped; first attachment chosen regardless of media type; attachment file ID not mirrored; write path drops the media flag, the error flag or the media text; error message replaced.chatprompt.gofails to build under each overlay, so the overlay applies.Review focus
The shared assertions in the table loop. The rows also stop passing through PostgreSQL, whose jsonb normalizes key order, whitespace, number forms and escapes, so production decodes different bytes than these rows feed in, with the same meaning. The deleted subtests and the new rows both compare with
JSONEq, and the round trip the stack keeps covers media results only.Validation
go test ./coderd/x/chatd/chatprompt/ -count=1 -p 4 -parallel 4: ok onmainand on this PRgo vet ./coderd/x/chatd/chatprompt/: okgolangci-lint run --fix=false ./coderd/x/chatd/chatprompt/: 0 issuesStack
The stack moves the tool result codec matrix out of PostgreSQL and keeps one storage round trip.