Skip to content

test(formatter): skip expression growth ratio under the race detector - #875

Merged
ajitpratap0 merged 1 commit into
mainfrom
test/formatter-scaling-skip-race
Oct 28, 2026
Merged

ajitpratap0 merged 1 commit into
mainfrom
test/formatter-scaling-skip-race

Conversation

@ajitpratap0

Copy link
Copy Markdown
Owner

Summary

  • TestFormatASTExpressionLinearGrowth (added in fix(formatter,transform): complete lower-case output, keep comments by GO, handle TOP/FETCH #870) flakes in the Race Detector job: left_deep_binary/lower measured 65.24x for 16x input against a 64x bound.
  • Without race instrumentation the lower-case path grows linearly (n=8192→131072: 19ms→218ms, ~11x for 16x input), so this is instrumentation skew, not an O(n²) regression.
  • Skip the ratio check when built with -race, following the parser's existing raceEnabled build-tag pattern. The non-race test matrix (Linux/macOS/Windows) still runs it.

Test Plan

  • go test -race -run TestFormatASTExpressionLinearGrowth ./pkg/formatter/ → SKIP
  • go test -count=3 -run TestFormatASTExpressionLinearGrowth ./pkg/formatter/ → PASS
  • go vet ./pkg/formatter/

Breaking Changes

None (test-only).

🤖 Generated with Claude Code

https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2

Race instrumentation inflates the lower-case rendering path unevenly across
input sizes, so TestFormatASTExpressionLinearGrowth failed CI at 65x against a
64x bound while uninstrumented runs grow linearly (16x input -> ~11x time).
The check still runs in the non-race test matrix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
gosqlx-website Ignored Ignored Preview Oct 28, 2026 4:24am UTC

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Claude finished @ajitpratap0's task in 13s —— View job


Review of PR #875

Verdict: LGTM. The change is small, correct and low-risk. I read the diff and did not run the tests myself.

What I checked

  • The race / !race build-tag pair is mutually exclusive, so raceEnabled is always defined exactly once.
  • Both files are _test.go and use package formatter_test, which matches the package of expression_scaling_test.go. Nothing ships in the production build.
  • The skip sits at the top of TestFormatASTExpressionLinearGrowth, before any work is done, so the race job wastes no time on it.
  • It follows the existing parser pattern (performance_regression_race.go and performance_regression_norace.go). One small difference: the parser files are not _test.go files, while these are.

Minor, non-blocking notes

  1. Coverage under race: the race job no longer checks this test at all. That is a reasonable trade, since the Linux, macOS and Windows non-race jobs still run it. A real O(n²) regression would still be caught there.
  2. Flake risk elsewhere: the 64x bound is still tight for noisy runners. Your measurement of about 11x for 16x input (65.24x for 16x under race) shows plenty of headroom without race. If it ever flakes without race, consider taking the best of a few runs.
  3. Naming: race_enabled_*_test.go is clear. Other packages may later want the same helper. If a third package needs it, consider moving it to a shared internal test helper. That isn't needed now.

No bugs, security concerns or performance concerns. Safe to merge once CI is green.

@ajitpratap0
ajitpratap0 merged commit be7f2f1 into main Oct 28, 2026
42 checks passed
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