Repository navigation
fix(coderd/coderdtest): render the Swagger spec once in parallel tests - #31829
Conversation
swag's Spec.ReadDoc writes shared state. TestSwaggerParametersValid and TestChatModelPathParametersFormatted call it in parallel, and the race detector fails coderd/coderdtest in test-go-race-pg. Render the spec once with sync.OnceValue.
|
@codex review |
|
@codex security 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 Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Why
test-go-race-pgfails on PRs that touch no Go product code, for example two runs on #31782. Since #30124, two parallel tests incoderd/coderdtestcall swag'sSpec.ReadDoc, which writes shared state, so the race detector fails the whole package (WARNING: DATA RACEinswag.(*Spec).ReadDoc,swagger_test.go:41and:77).What changed
swagger_test.gorenders the spec once throughsync.OnceValue, and both tests read that string.Verification
main,go test -race -count=20 -run 'TestSwaggerParametersValid|TestChatModelPathParametersFormatted' ./coderd/coderdtest/reported 4 data races and failed.golangci-lintreports 0 issues for./coderd/coderdtest/with both the main and the new-code configs.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high