From 97f2c7cbe215f4293757124d0d5f2f99442b8d1d Mon Sep 17 00:00:00 2001 From: Ajit Pratap Singh Date: Wed, 28 Oct 2026 09:54:03 +0530 Subject: [PATCH] test(formatter): skip expression growth ratio under the race detector 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 Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2 --- pkg/formatter/expression_scaling_test.go | 5 +++++ pkg/formatter/race_enabled_norace_test.go | 20 ++++++++++++++++++++ pkg/formatter/race_enabled_race_test.go | 20 ++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 pkg/formatter/race_enabled_norace_test.go create mode 100644 pkg/formatter/race_enabled_race_test.go diff --git a/pkg/formatter/expression_scaling_test.go b/pkg/formatter/expression_scaling_test.go index 29d7630b..4e3f115c 100644 --- a/pkg/formatter/expression_scaling_test.go +++ b/pkg/formatter/expression_scaling_test.go @@ -30,6 +30,11 @@ import ( // and the 64x bound leaves room for noisy shared CI runners. Build ASTs outside the measurement so // parser limits and parsing time do not conceal formatter regressions. func TestFormatASTExpressionLinearGrowth(t *testing.T) { + // Race instrumentation inflates allocation-heavy paths unevenly across + // input sizes, so the growth ratio is only meaningful without it. + if raceEnabled { + t.Skip("timing ratios are unreliable under the race detector") + } for _, shape := range []struct { name string small int diff --git a/pkg/formatter/race_enabled_norace_test.go b/pkg/formatter/race_enabled_norace_test.go new file mode 100644 index 00000000..5b3cc4b4 --- /dev/null +++ b/pkg/formatter/race_enabled_norace_test.go @@ -0,0 +1,20 @@ +// Copyright 2026 GoSQLX Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !race + +package formatter_test + +// raceEnabled reports whether the race detector instruments this test binary. +const raceEnabled = false diff --git a/pkg/formatter/race_enabled_race_test.go b/pkg/formatter/race_enabled_race_test.go new file mode 100644 index 00000000..bd5e53e1 --- /dev/null +++ b/pkg/formatter/race_enabled_race_test.go @@ -0,0 +1,20 @@ +// Copyright 2026 GoSQLX Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build race + +package formatter_test + +// raceEnabled reports whether the race detector instruments this test binary. +const raceEnabled = true