Skip to content

*: split bazel coverage test into build and test phases#67829

Open
winoros wants to merge 13 commits intopingcap:masterfrom
winoros:bazel-test-two-phase
Open

*: split bazel coverage test into build and test phases#67829
winoros wants to merge 13 commits intopingcap:masterfrom
winoros:bazel-test-two-phase

Conversation

@winoros
Copy link
Copy Markdown
Member

@winoros winoros commented Apr 16, 2026

What problem does this PR solve?

Issue Number: N/A

Problem Summary:

bazel_coverage_test used a single bazel coverage invocation, so the build and test phases had to share the same concurrency setting.

What changed and how does it work?

  • Added shared Bazel coverage target and concurrency variables.
  • Split bazel_coverage_test and bazel_coverage_test_ddlargsv1 into two phases.
  • Phase 1 runs bazel build --collect_code_coverage with higher build concurrency.
  • Phase 2 runs bazel coverage with the existing test concurrency and local_test_jobs.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
make -n bazel_coverage_test
make -n bazel_coverage_test_ddlargsv1
bazel --nohome_rc build ... --collect_code_coverage '--jobs=HOST_CPUS*3' ... //pkg/objstore/storeapi:storeapi_test
bazel --nohome_rc coverage ... '--jobs=HOST_CPUS*0.9' '--local_test_jobs=HOST_CPUS*0.9' ... //pkg/objstore/storeapi:storeapi_test
make lint
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Summary by CodeRabbit

  • Chores
    • Improved code-coverage workflow by splitting coverage into separate build and test phases with clear phase labels for easier CI/log debugging.
    • Added configurable concurrency and target-selection for coverage runs to improve reliability and control.
    • Added an option to disable remote caching for coverage/build runs to avoid stale results.
    • Enabled publishing of build/test events and asynchronous event upload for CI telemetry.

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. labels Apr 16, 2026
@pantheon-ai
Copy link
Copy Markdown

pantheon-ai bot commented Apr 16, 2026

@winoros I've received your pull request and will start the review. I'll conduct a thorough review covering code quality, potential issues, and implementation details.

⏳ This process typically takes 10-30 minutes depending on the complexity of the changes.

ℹ️ Learn more details on Pantheon AI.

@ti-chi-bot ti-chi-bot bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 16, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 16, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Makefile coverage targets were changed to a two-phase Bazel flow (build with coverage then coverage), added variables to disable remote cache and control coverage concurrency/targets, and .bazelrc gains CI build-event flags for asynchronous publishing.

Changes

Cohort / File(s) Summary
Makefile: Bazel coverage workflow
Makefile
Added BAZEL_NO_REMOTE_CACHE_CONFIG, BAZEL_COVERAGE_BUILD_JOBS, BAZEL_COVERAGE_TEST_JOBS, and BAZEL_COVERAGE_TARGETS. Replaced single-step bazel coverage with two-phase: bazel build --collect_code_coverage --jobs=$(BAZEL_COVERAGE_BUILD_JOBS) --build_tests_only then bazel coverage --jobs=$(BAZEL_COVERAGE_TEST_JOBS) --local_test_jobs=$(BAZEL_COVERAGE_TEST_JOBS) -- $(BAZEL_COVERAGE_TARGETS). Wired BAZEL_NO_REMOTE_CACHE_CONFIG and added phase echo output; bazel_coverage_test_ddlargsv1 includes the ddlargsv1 gotag variant.
Bazel CI flags
.bazelrc
Added CI build/test flags: --build_event_publish_all_actions and --experimental_build_event_upload_strategy=fully_async for build:ci and test:ci.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • D3Hunter

Poem

🐰 I hopped into Makefile lines today,
Split build and coverage so they play,
Turned off the remote cache, tuned jobs with flair,
Echoed each phase, and trimmed targets with care,
🥕 A rabbit's nibble on CI, light as air.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the problem statement and what changed, but the Issue Number is marked as 'N/A' which violates the template requirement. The description is otherwise mostly complete with manual test steps. Add a proper issue number linking to the relevant issue using 'close #xxx' or 'ref #xxx' format instead of 'N/A'.
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title directly summarizes the main change: splitting bazel coverage test into build and test phases, which matches the raw_summary alterations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.1566%. Comparing base (65d9fb6) to head (a45bba9).
⚠️ Report is 18 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #67829         +/-   ##
=================================================
- Coverage   77.5964%   49.1566%   -28.4398%     
=================================================
  Files          1982       1796        -186     
  Lines        548885     514805      -34080     
=================================================
- Hits         425915     253061     -172854     
- Misses       122165     261446     +139281     
+ Partials        805        298        -507     
Flag Coverage Δ
integration 40.9038% <ø> (+6.5638%) ⬆️
unit 32.0022% <ø> (-44.3384%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling ∅ <ø> (∅)
parser ∅ <ø> (∅)
br 0.1572% <ø> (-60.3672%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@winoros
Copy link
Copy Markdown
Member Author

winoros commented Apr 16, 2026

Temporary CI experiment: I squashed a small local code-change branch into this PR branch to avoid Bazel remote cache fully reusing previous results and to measure CI speed. This temporary commit will be reverted after the measurement.

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. component/statistics sig/planner SIG: Planner and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 16, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pkg/statistics/handle/syncload/stats_syncload.go`:
- Around line 334-346: The code directly assigns sessVars.ResourceGroupName and
sessVars.StmtCtx.ResourceGroupName which bypasses metrics updates; change these
direct writes to use sessVars.SetResourceGroupName(...) for session-level
updates and use the documented setter or an equivalent method for the StmtCtx
resource-group mutation (or call the session setter for the statement context if
that's the intended flow) and likewise restore the previous values in the defer
by calling SetResourceGroupName(prevSessionResourceGroupName) instead of
assigning sessVars.ResourceGroupName, while keeping restoration of
StmtCtx.ResourceGroupName via its proper setter or documented API to ensure
metrics are incremented/decremented correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 81774f01-54db-4fcd-955a-c8d7d829b69b

📥 Commits

Reviewing files that changed from the base of the PR and between 49d2fb8 and ad2542a.

📒 Files selected for processing (9)
  • br/pkg/metautil/BUILD.bazel
  • pkg/domain/infosync/BUILD.bazel
  • pkg/domain/infosync/info.go
  • pkg/domain/infosync/resource_manager_client.go
  • pkg/importsdk/BUILD.bazel
  • pkg/resourcegroup/checker.go
  • pkg/resourcegroup/tests/resource_group_test.go
  • pkg/statistics/handle/syncload/BUILD.bazel
  • pkg/statistics/handle/syncload/stats_syncload.go
✅ Files skipped from review due to trivial changes (4)
  • pkg/statistics/handle/syncload/BUILD.bazel
  • br/pkg/metautil/BUILD.bazel
  • pkg/resourcegroup/checker.go
  • pkg/domain/infosync/BUILD.bazel

Comment on lines 334 to 346
sessVars := sctx.GetSessionVars()
prevPriority := sessVars.StmtCtx.Priority
prevStmtResourceGroupName := sessVars.StmtCtx.ResourceGroupName
prevSessionResourceGroupName := sessVars.ResourceGroupName
sessVars.StmtCtx.Priority = mysql.HighPriority
sessVars.StmtCtx.ResourceGroupName = resourcegroup.DefaultHighPriorityResourceGroupName
// Keep StmtCtx and session resource group aligned to avoid fallback to the session default group.
sessVars.ResourceGroupName = resourcegroup.DefaultHighPriorityResourceGroupName
defer func() {
sctx.GetSessionVars().StmtCtx.Priority = mysql.NoPriority
sessVars.StmtCtx.Priority = prevPriority
sessVars.StmtCtx.ResourceGroupName = prevStmtResourceGroupName
sessVars.ResourceGroupName = prevSessionResourceGroupName
}()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Contract/comment on SessionVars.ResourceGroupName =="
rg -n --type=go -C2 "please don't change it directly|SetResourceGroupName changes the resource group name" pkg/sessionctx/variable/session.go

echo
echo "== Current direct assignments in sync load path =="
rg -n --type=go -C2 "ResourceGroupName\\s*=" pkg/statistics/handle/syncload/stats_syncload.go

echo
echo "== Available setter usage =="
rg -n --type=go "SetResourceGroupName\\(" pkg/statistics/handle/syncload/stats_syncload.go pkg/sessionctx/variable/session.go

Repository: pingcap/tidb

Length of output: 1479


Use SessionVars.SetResourceGroupName() instead of direct field assignment for metrics consistency.

Lines 341 and 345 bypass the setter, which is documented as the required way to update this field. The field carries an explicit note: "please don't change it directly. Use SetResourceGroupName, because it'll need to inc/dec the metrics." Direct assignment skips the metrics side-effects and violates the established mutation contract.

Proposed fix
 			sessVars := sctx.GetSessionVars()
 			prevPriority := sessVars.StmtCtx.Priority
 			prevStmtResourceGroupName := sessVars.StmtCtx.ResourceGroupName
 			prevSessionResourceGroupName := sessVars.ResourceGroupName
 			sessVars.StmtCtx.Priority = mysql.HighPriority
 			sessVars.StmtCtx.ResourceGroupName = resourcegroup.DefaultHighPriorityResourceGroupName
 			// Keep StmtCtx and session resource group aligned to avoid fallback to the session default group.
-			sessVars.ResourceGroupName = resourcegroup.DefaultHighPriorityResourceGroupName
+			sessVars.SetResourceGroupName(resourcegroup.DefaultHighPriorityResourceGroupName)
 			defer func() {
 				sessVars.StmtCtx.Priority = prevPriority
 				sessVars.StmtCtx.ResourceGroupName = prevStmtResourceGroupName
-				sessVars.ResourceGroupName = prevSessionResourceGroupName
+				sessVars.SetResourceGroupName(prevSessionResourceGroupName)
 			}()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/statistics/handle/syncload/stats_syncload.go` around lines 334 - 346, The
code directly assigns sessVars.ResourceGroupName and
sessVars.StmtCtx.ResourceGroupName which bypasses metrics updates; change these
direct writes to use sessVars.SetResourceGroupName(...) for session-level
updates and use the documented setter or an equivalent method for the StmtCtx
resource-group mutation (or call the session setter for the statement context if
that's the intended flow) and likewise restore the previous values in the defer
by calling SetResourceGroupName(prevSessionResourceGroupName) instead of
assigning sessVars.ResourceGroupName, while keeping restoration of
StmtCtx.ResourceGroupName via its proper setter or documented API to ensure
metrics are incremented/decremented correctly.

@winoros winoros force-pushed the bazel-test-two-phase branch from ad2542a to 49d2fb8 Compare April 20, 2026 07:18
@ti-chi-bot ti-chi-bot bot removed the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 20, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Apr 20, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign lonng for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 20, 2026
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 20, 2026
@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 20, 2026
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 20, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
Makefile (1)

718-722: Optional: deduplicate the Bazel target set shared with bazel_test.

BAZEL_COVERAGE_TARGETS is the same list hard-coded in bazel_test (lines 715-716). If a target is ever added/removed (e.g. a new tests/<kind>), the two will drift silently. Consider promoting this into a shared variable (e.g. BAZEL_UNIT_TEST_TARGETS) used by both bazel_test and the coverage targets.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` around lines 718 - 722, BAZEL_COVERAGE_TARGETS duplicates the
hard-coded target list used by the bazel_test recipe; extract the shared test
target list into a new variable (e.g. BAZEL_UNIT_TEST_TARGETS) containing the
long "//... -//cmd/... -//tests/..." sequence, replace the inline lists in both
bazel_test and the BAZEL_COVERAGE_TARGETS assignment to reference
BAZEL_UNIT_TEST_TARGETS, and ensure any existing overrides (like exclusions for
specific tests) are preserved by appending/removing entries relative to
BAZEL_UNIT_TEST_TARGETS rather than duplicating the full list.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.bazelrc:
- Around line 29-32: The CI Bazel flags use
--experimental_build_event_upload_strategy=fully_async together with
--build_event_publish_all_actions which can silently drop BES events; update the
CI config so coverage/test runs use a synchronous upload strategy (e.g., replace
or override fully_async with wait_for_upload_complete) or scope
publish_all_actions to smaller runs, and modify the bazel_coverage_test
invocation in the Makefile to ensure it runs with wait_for_upload_complete (or a
non-fully_async strategy) so coverage/test event uploads are awaited and
failures surface to CI.

In `@Makefile`:
- Line 684: The Makefile currently hard-wires BAZEL_NO_REMOTE_CACHE_CONFIG :=
--remote_cache= --noremote_accept_cached --noremote_upload_local_results which
must not ship to master and is inconsistently applied between the two coverage
targets; change the assignment to an opt-in form (BAZEL_NO_REMOTE_CACHE_CONFIG
?= with empty default) so it is only set by measurement CI, and then either
remove its usage from the bazel_coverage_test invocation or apply it
consistently to bazel_coverage_test_ddlargsv1 so both targets
(bazel_coverage_test and bazel_coverage_test_ddlargsv1) use the same cache
behavior; ensure references to BAZEL_NO_REMOTE_CACHE_CONFIG at the existing
invocation sites are updated accordingly.
- Around line 731-732: Add a new configurable variable (e.g. BAZEL_BES_FLAGS
with an empty default) and replace the hardcoded BES flags in the
bazel_coverage_test recipe with this variable; also apply the same
$(BAZEL_BES_FLAGS) insertion to bazel_coverage_test_ddlargsv1 so both targets
use the same optional BES flags and CI can opt-in via environment without
impacting local builds.

---

Nitpick comments:
In `@Makefile`:
- Around line 718-722: BAZEL_COVERAGE_TARGETS duplicates the hard-coded target
list used by the bazel_test recipe; extract the shared test target list into a
new variable (e.g. BAZEL_UNIT_TEST_TARGETS) containing the long "//...
-//cmd/... -//tests/..." sequence, replace the inline lists in both bazel_test
and the BAZEL_COVERAGE_TARGETS assignment to reference BAZEL_UNIT_TEST_TARGETS,
and ensure any existing overrides (like exclusions for specific tests) are
preserved by appending/removing entries relative to BAZEL_UNIT_TEST_TARGETS
rather than duplicating the full list.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6c65273f-0a52-46a9-9a7f-2d4bc76184cc

📥 Commits

Reviewing files that changed from the base of the PR and between b28f783 and 0c8fdb9.

📒 Files selected for processing (2)
  • .bazelrc
  • Makefile

Comment thread .bazelrc
Comment on lines +29 to +32
build:ci --build_event_publish_all_actions
test:ci --build_event_publish_all_actions
build:ci --experimental_build_event_upload_strategy=fully_async
test:ci --experimental_build_event_upload_strategy=fully_async
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Heads-up: fully_async + publish_all_actions can silently drop events.

--experimental_build_event_upload_strategy=fully_async intentionally decouples BES upload from the build lifecycle, so upload errors (timeouts, backend 5xx) are not surfaced as build failures. Combined with --build_event_publish_all_actions, the BES stream now includes every action event, which can be large for full-repo coverage runs. If the BES backend (see bazel_coverage_test in Makefile) is flaky or rate-limits, you may lose coverage/test event data without any CI signal. Consider wait_for_upload_complete at least for coverage runs whose primary purpose is to publish results.

bazel experimental_build_event_upload_strategy fully_async error handling
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.bazelrc around lines 29 - 32, The CI Bazel flags use
--experimental_build_event_upload_strategy=fully_async together with
--build_event_publish_all_actions which can silently drop BES events; update the
CI config so coverage/test runs use a synchronous upload strategy (e.g., replace
or override fully_async with wait_for_upload_complete) or scope
publish_all_actions to smaller runs, and modify the bazel_coverage_test
invocation in the Makefile to ensure it runs with wait_for_upload_complete (or a
non-fully_async strategy) so coverage/test event uploads are awaited and
failures surface to CI.

Comment thread Makefile
--run_under="cd $(CURDIR) && " \
//tools/tazel:tazel

BAZEL_NO_REMOTE_CACHE_CONFIG := --remote_cache= --noremote_accept_cached --noremote_upload_local_results
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Temporary cache-bypass must not ship to master, and is inconsistent between the two coverage targets.

Per the PR description, BAZEL_NO_REMOTE_CACHE_CONFIG := --remote_cache= --noremote_accept_cached --noremote_upload_local_results is a measurement aid — it disables both accepting and uploading remote cache results for every invocation that references it. Left in place, this will noticeably slow bazel_coverage_test on CI (every build is effectively a from-scratch local build). Two concerns:

  1. This variable (and its uses at lines 727 and 731) should be reverted before this PR leaves do-not-merge status. Please gate it behind an explicit opt-in (e.g. BAZEL_NO_REMOTE_CACHE_CONFIG ?= with empty default, set only by the measurement CI job) rather than hard-wiring it into the recipe.
  2. It is applied to bazel_coverage_test but not to bazel_coverage_test_ddlargsv1 (lines 740, 744). If the intent is to measure, the asymmetry makes the two runs not directly comparable; if the intent is production, the asymmetry is a bug. Either way, please align them.
🔧 Suggested opt-in form
-BAZEL_NO_REMOTE_CACHE_CONFIG := --remote_cache= --noremote_accept_cached --noremote_upload_local_results
+# Opt-in override used only for cache-busting measurement runs; leave empty for normal CI.
+BAZEL_NO_REMOTE_CACHE_CONFIG ?=

Also applies to: 727-727, 731-731

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` at line 684, The Makefile currently hard-wires
BAZEL_NO_REMOTE_CACHE_CONFIG := --remote_cache= --noremote_accept_cached
--noremote_upload_local_results which must not ship to master and is
inconsistently applied between the two coverage targets; change the assignment
to an opt-in form (BAZEL_NO_REMOTE_CACHE_CONFIG ?= with empty default) so it is
only set by measurement CI, and then either remove its usage from the
bazel_coverage_test invocation or apply it consistently to
bazel_coverage_test_ddlargsv1 so both targets (bazel_coverage_test and
bazel_coverage_test_ddlargsv1) use the same cache behavior; ensure references to
BAZEL_NO_REMOTE_CACHE_CONFIG at the existing invocation sites are updated
accordingly.

Comment thread Makefile Outdated
Comment on lines +731 to +732
bazel $(BAZEL_GLOBAL_CONFIG) --nohome_rc coverage $(BAZEL_CMD_CONFIG) $(BAZEL_NO_REMOTE_CACHE_CONFIG) $(BAZEL_INSTRUMENTATION_FILTER) --jobs=$(BAZEL_COVERAGE_TEST_JOBS) --local_test_jobs=$(BAZEL_COVERAGE_TEST_JOBS) --build_tests_only --test_keep_going=false \
--bes_backend=grpcs://beplessproxy.hawkingrei.com --bes_results_url=https://bepless.hawkingrei.com/ \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Search for references to the BES endpoint in the codebase
rg "beplessproxy|bepless|hawkingrei" -i

Repository: pingcap/tidb

Length of output: 50369


🏁 Script executed:

# Check the Makefile context around the flagged lines
fd Makefile -x cat -n {} | grep -A 10 -B 5 "bepless"

Repository: pingcap/tidb

Length of output: 1405


🏁 Script executed:

# Search for any documentation or comments related to BES configuration
rg "BES|bes_backend|bes_results_url" -A 2 -B 2

Repository: pingcap/tidb

Length of output: 50370


🏁 Script executed:

# Check git history for this endpoint (check recent commits)
git log --oneline --all -20 -- Makefile | head -20

Repository: pingcap/tidb

Length of output: 1382


Externalize BES configuration to make it optional and environment-specific.

The hardcoded --bes_backend=grpcs://beplessproxy.hawkingrei.com --bes_results_url=https://bepless.hawkingrei.com/ flags on line 732 tie bazel_coverage_test to a developer-managed endpoint with no fallback. Additionally, bazel_coverage_test_ddlargsv1 (line 744) does not include these flags, creating an inconsistency in coverage data collection.

Introduce a configurable variable with empty defaults so CI can opt-in to BES uploads without affecting local builds:

+BAZEL_BES_BACKEND ?=
+BAZEL_BES_RESULTS_URL ?=
+BAZEL_BES_FLAGS = $(if $(BAZEL_BES_BACKEND),--bes_backend=$(BAZEL_BES_BACKEND) --bes_results_url=$(BAZEL_BES_RESULTS_URL),)
@@
 bazel $(BAZEL_GLOBAL_CONFIG) --nohome_rc coverage $(BAZEL_CMD_CONFIG) $(BAZEL_NO_REMOTE_CACHE_CONFIG) $(BAZEL_INSTRUMENTATION_FILTER) --jobs=$(BAZEL_COVERAGE_TEST_JOBS) --local_test_jobs=$(BAZEL_COVERAGE_TEST_JOBS) --build_tests_only --test_keep_going=false \
-		--bes_backend=grpcs://beplessproxy.hawkingrei.com --bes_results_url=https://bepless.hawkingrei.com/ \
+		$(BAZEL_BES_FLAGS) \

Apply the same $(BAZEL_BES_FLAGS) variable to both bazel_coverage_test and bazel_coverage_test_ddlargsv1 to ensure consistent behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` around lines 731 - 732, Add a new configurable variable (e.g.
BAZEL_BES_FLAGS with an empty default) and replace the hardcoded BES flags in
the bazel_coverage_test recipe with this variable; also apply the same
$(BAZEL_BES_FLAGS) insertion to bazel_coverage_test_ddlargsv1 so both targets
use the same optional BES flags and CI can opt-in via environment without
impacting local builds.

Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@hawkingrei
Copy link
Copy Markdown
Member

/retest

@hawkingrei
Copy link
Copy Markdown
Member

/retest

1 similar comment
@hawkingrei
Copy link
Copy Markdown
Member

/retest

Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@hawkingrei hawkingrei force-pushed the bazel-test-two-phase branch from 0864523 to ff0f901 Compare April 21, 2026 06:59
@hawkingrei
Copy link
Copy Markdown
Member

/retest

@hawkingrei
Copy link
Copy Markdown
Member

/retest

@hawkingrei
Copy link
Copy Markdown
Member

/retest

Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Apr 21, 2026

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-linked-issue label, please provide the linked issue number on one line in the PR body, for example: Issue Number: close #123 or Issue Number: ref #456.

📖 For more info, you can check the "Contribute Code" section in the development guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/statistics do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants