ci(bazel): drop //cmd/bd:bd_test from the integration lane where the cmd/bd Dolt-server tier is required (#7230)

bazel-integration (--config=integration) and bazel-cmd-dolt
(--config=doltserver-cmd, //cmd/bd:bd_dolt_server_test) both run the
integration-build cmd/bd bd_test; the second without BEADS_TEST_SKIP=dolt,
so it is a superset. Once pr.yml requires bazel-cmd-dolt, the integration
lane's bd_test run is a duplicate.

bazel.yml gains a boolean workflow_call input, cmd-dolt-required (default
false). When true, bazel-integration tests //... -//cmd/bd:bd_test. pr.yml
passes it, and a policy test pins it to pr.yml's BAZEL_CMD_DOLT_REQUIRED
(a `with:` cannot read env), so the drop only happens where ci-gate
requires BAZEL_CMD_DOLT. bazel-farm.yml, nightly.yml, push and dispatch
leave it unset and keep bd_test. While the flag is "false" (current main)
nothing changes; with #7226's flip the input flips with it.

Coverage: both lanes share the same `if:` (modes remote, fork-ro, fork-rw,
cache; Dependabot included) and bazel-gate.sh accepts their skips in the
same modes (skip, local). TestBazelIntegrationExcludesBdTestOnlyWhereCmdDoltCovers
pins that, the exact exclusion, the flag/input equality, the gate's
conditional requirement, and that no other caller passes the input.

Rollback: commit BAZEL_CMD_DOLT_REQUIRED "false" and cmd-dolt-required:
false together in pr.yml.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Julian Knutsen 2026-10-05 01:19:47 -07:00 • committed by GitHub
commit ec72c8c563
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 173 additions and 5 deletions

View file

@ -27,7 +27,9 @@
# BAZEL_INTEGRATION, BAZEL_DOLTSERVER, BAZEL_PROXIED, BAZEL_SERVER_STORAGE);
# bazel-cmd-dolt (the cmd/bd Dolt-server tier, BAZEL_CMD_DOLT) is advisory:
# job-level continue-on-error, and pr.yml requires it only while its
# BAZEL_CMD_DOLT_REQUIRED flag is "true";
# BAZEL_CMD_DOLT_REQUIRED flag is "true" (pr.yml then also passes
# cmd-dolt-required: true, and bazel-integration leaves //cmd/bd:bd_test,
# which bazel-cmd-dolt runs too, to it);
# .github/scripts/bazel-gate.sh turns the rbe job's rbe-mode output into the
# skips it accepts, so a lane skipped by its `if:` below passes and one that
# should have run and failed, was cancelled or reported nothing fails the
@ -210,6 +212,22 @@ on:
type: string
required: false
default: "on"
# true (pr.yml only, policy-tested to equal its committed
# BAZEL_CMD_DOLT_REQUIRED flag): pr.yml's ci-gate requires
# bazel-cmd-dolt, which runs the whole integration-tagged cmd/bd suite
# (//cmd/bd:bd_dolt_server_test wraps the integration build's
# bd_test), so bazel-integration leaves //cmd/bd:bd_test to it and
# each of those tests runs once. A boolean: on push and dispatch it is
# null, which is not == true, so bazel-farm.yml, nightly.yml, push and
# dispatch (bazel-cmd-dolt advisory there) keep bd_test in
# bazel-integration.
cmd-dolt-required:
description: >
true (pr.yml only) drops //cmd/bd:bd_test from bazel-integration:
the required bazel-cmd-dolt lane runs those tests.
type: boolean
required: false
default: false
build-artifact-name:
description: >
Name of the uploaded bd artifact (ci-build-artifacts layout). pr.yml
@ -1178,6 +1196,17 @@ jobs:
# which no run here has. check_testcases.py still catches a target or
# shard that ran no tests. pr.yml's gate requires it (BAZEL_INTEGRATION)
# on same-repo PRs; see the header.
# Exactly-once cmd/bd: where the caller says bazel-cmd-dolt is required
# (inputs.cmd-dolt-required true: pr.yml while its
# BAZEL_CMD_DOLT_REQUIRED is "true"), the target set is //... minus
# //cmd/bd:bd_test. bazel-cmd-dolt has this job's `if:`, so it runs in
# every mode this one does (remote, fork-ro, fork-rw, cache; Dependabot
# too), bazel-gate.sh accepts the two lanes' skips in the same modes, and
# its //cmd/bd:bd_dolt_server_test runs that same integration-build
# bd_test without BEADS_TEST_SKIP=dolt (a superset: the skip only skips).
# Rollback: commit BAZEL_CMD_DOLT_REQUIRED "false" and pr.yml's
# cmd-dolt-required: false together (policy-tested equal); bd_test is
# back here on the next run.
bazel-integration:
name: integration
# Remote (modes remote, fork-ro, fork-rw), or local with the read-only
@ -1227,15 +1256,26 @@ jobs:
# make Bazel restart the build ("Lost inputs"), and ~30 with the cache
# closed (the farm's kill switch: everything local, cold), which must
# still fit so closing the cache does not turn fork PRs red.
# Where bazel-cmd-dolt is required, //cmd/bd:bd_test is excluded (see
# above): on a PR that changes cmd/bd or what it imports, its race
# link and 16 shards were this step's last ~2-3.5 minutes (runs of
# 2026-10-05: 215-314s wall, 113-208s of it after every other test
# had finished).
- name: bazel test //... --config=integration
id: test
timeout-minutes: 75
env:
EXCLUDE_TARGETS: ${{ inputs.cmd-dolt-required == true && '-//cmd/bd:bd_test' || '' }}
run: |
set -o pipefail
start=$(date +%s)
rc=0
if [[ -n "$EXCLUDE_TARGETS" ]]; then
echo "bazel-cmd-dolt is required: excluding $EXCLUDE_TARGETS (it runs there)" | tee -a "$GITHUB_STEP_SUMMARY"
fi
bazel test //... --config=integration \
--build_event_json_file="$RUNNER_TEMP/bazel-bep.json" \
${EXCLUDE_TARGETS:+-- "$EXCLUDE_TARGETS"} \
2>&1 | tee "$RUNNER_TEMP/bazel-test.log" || rc=$?
echo "bazel test --config=integration: exit $rc, $(( $(date +%s) - start ))s wall" | tee -a "$GITHUB_STEP_SUMMARY"
exit "$rc"
@ -1631,7 +1671,9 @@ jobs:
# call's aggregate result (BAZEL), and pr.yml's ci-gate requires the
# lane's own result (BAZEL_CMD_DOLT) only while pr.yml's committed
# BAZEL_CMD_DOLT_REQUIRED flag is "true" (scripts/ci_workflow_test.go,
# TestBazelCmdDoltJob).
# TestBazelCmdDoltJob); pr.yml then passes cmd-dolt-required: true and
# this lane is the integration build's only bd_test run
# (TestBazelIntegrationExcludesBdTestOnlyWhereCmdDoltCovers).
bazel-cmd-dolt:
name: cmd/bd Dolt-server tier
needs: rbe

View file

@ -58,7 +58,12 @@ env:
# BAZEL_CMD_DOLT result. "true" adds BAZEL_CMD_DOLT to CI_GATE_REQUIRED in
# the "Evaluate CI gate" step's run script; bazel-gate.sh still accepts
# its skip in modes skip and local. Committed, not a repo variable, for
# the same reason as the flags above.
# the same reason as the flags above. The `bazel` job's cmd-dolt-required
# input must equal it (a `with:` cannot read env; policy-tested): "true"
# also drops //cmd/bd:bd_test from bazel-integration, because the required
# lane runs the same integration-build bd_test without the dolt skip, so
# each cmd/bd test runs once. Rollback: commit "false" here and false in
# that input together; bazel-integration runs bd_test again on the next run.
BAZEL_CMD_DOLT_REQUIRED: "true"
jobs:
@ -2295,6 +2300,9 @@ jobs:
with:
build-artifact-name: bazel-ci-build-artifacts
integration: "on"
# Must equal BAZEL_CMD_DOLT_REQUIRED (top of this file; policy-tested):
# true leaves //cmd/bd:bd_test to the then-required bazel-cmd-dolt.
cmd-dolt-required: true
# F3: only pr.yml opts in; the package-mcp/package-npm jobs run inside
# this call, needing only its rbe job.
package-gates: "on"

View file

@ -130,7 +130,11 @@ init and store-backed suites) that every other lane skips with
`--config=integration`'s build, passes the binary no test selection (the Go
binary shards itself over every top-level test, 16 shards), and runs where
the integration lane runs (remote, or with the read-only cache). pr.yml's
gate requires it once `BAZEL_CMD_DOLT_REQUIRED` is `"true"`. Locally:
gate requires it once `BAZEL_CMD_DOLT_REQUIRED` is `"true"`; pr.yml then
also passes bazel.yml `cmd-dolt-required: true`, and the PR's
`bazel-integration` lane runs `//... -//cmd/bd:bd_test`, so each cmd/bd
integration-build test runs once (push, nightly and bazel-farm runs keep
`bd_test` in the integration lane). Locally:
`bazel test //cmd/bd:bd_dolt_server_test --config=doltserver-cmd`.
An ambient `BEADS_DOLT_SERVER_PORT` or `BEADS_DOLT_PORT` is never honored by

View file

@ -2813,6 +2813,10 @@ var bazelPRCallWith = map[string]string{
// F3: only pr.yml opts in; bazel-farm.yml and nightly.yml keep the
// default "off" (TestBazelGateSimulation's other callers).
"package-gates": "on",
// Mirrors pr.yml's BAZEL_CMD_DOLT_REQUIRED (a `with:` cannot read env):
// true leaves //cmd/bd:bd_test to the then-required bazel-cmd-dolt
// (TestBazelIntegrationExcludesBdTestOnlyWhereCmdDoltCovers).
"cmd-dolt-required": bazelFlagGatedLanes[bazelCmdDoltJobName].want,
}
// The call's aggregate result (needs.bazel.result, through bazel-gate.sh).
@ -4798,7 +4802,8 @@ func TestBazelIntegrationJob(t *testing.T) {
t.Errorf("%s timeout-minutes = %d, want above the test step's %d by at most 15", bazelIntegJobName, job.TimeoutMinutes, test.TimeoutMinutes)
}
cmd := regexp.MustCompile(`\s*\\\n\s*`).ReplaceAllString(test.Run, " ")
const wantCmd = `bazel test //... --config=integration --build_event_json_file="$RUNNER_TEMP/bazel-bep.json" 2>&1 | tee "$RUNNER_TEMP/bazel-test.log" || rc=$?`
// EXCLUDE_TARGETS: TestBazelIntegrationExcludesBdTestOnlyWhereCmdDoltCovers.
const wantCmd = `bazel test //... --config=integration --build_event_json_file="$RUNNER_TEMP/bazel-bep.json" ${EXCLUDE_TARGETS:+-- "$EXCLUDE_TARGETS"} 2>&1 | tee "$RUNNER_TEMP/bazel-test.log" || rc=$?`
if !strings.Contains(cmd, wantCmd) || !strings.Contains(test.Run, "set -o pipefail") {
t.Errorf("%s test step does not run exactly %q:\n%s", bazelIntegJobName, wantCmd, test.Run)
}
@ -6842,6 +6847,115 @@ func TestBazelCmdDoltJob(t *testing.T) {
}
}
// Exactly-once cmd/bd integration-build tests on PRs: bazel-integration runs
// //... minus //cmd/bd:bd_test only where the caller says bazel-cmd-dolt is
// required (inputs.cmd-dolt-required true, which only pr.yml passes and
// only as its committed BAZEL_CMD_DOLT_REQUIRED flag), and there
// bazel-cmd-dolt covers it: the same if (so it runs in every mode
// bazel-integration does, Dependabot and forks included), bazel-gate.sh
// accepts the two lanes' skips in exactly the same modes, pr.yml's gate then
// requires its result, and its target wraps the integration build's bd_test
// with no test selection (TestBazelCmdDoltJob). Everywhere else (bazel-farm,
// nightly, push, dispatch: bazel-cmd-dolt advisory) bd_test stays in
// bazel-integration. Rollback is committing "false" in both pr.yml places.
func TestBazelIntegrationExcludesBdTestOnlyWhereCmdDoltCovers(t *testing.T) {
const input, excluded = "cmd-dolt-required", "-//cmd/bd:bd_test"
workflow := readCIWorkflow(t, bazelWorkflowName)
integ := workflow.job(t, bazelIntegJobName)
cmdDolt := workflow.job(t, bazelCmdDoltJobName)
// The input: a boolean defaulting to false, so a caller that does not
// pass it (and push/dispatch, where it is null) keeps bd_test.
if in, ok := readBazelWorkflowCall(t).Inputs[input]; !ok || in.Type != "boolean" || in.Default != "false" {
t.Errorf("%s workflow_call input %s = %+v (present %v), want type boolean, default false", bazelWorkflowName, input, in, ok)
}
// The step: the exclusion is exactly bd_test, and only when the input is
// true; nothing else narrows the target set.
test := integ.step(t, "bazel test //... --config=integration")
wantEnv := "${{ inputs." + input + " == true && '" + excluded + "' || '' }}"
if got := test.Env["EXCLUDE_TARGETS"]; got != wantEnv {
t.Errorf("%s EXCLUDE_TARGETS = %q, want %q", bazelIntegJobName, got, wantEnv)
}
if strings.Count(test.Run, "${EXCLUDE_TARGETS:+-- \"$EXCLUDE_TARGETS\"}") != 1 || strings.Count(test.Run, "EXCLUDE_TARGETS:+") != 1 ||
strings.Contains(test.Run, " -- ") || strings.Contains(test.Run, "-//") {
t.Errorf("%s test step must narrow //... only through ${EXCLUDE_TARGETS:+-- \"$EXCLUDE_TARGETS\"}:\n%s", bazelIntegJobName, test.Run)
}
for name, job := range workflow.Jobs {
for k, v := range job.Env {
if strings.Contains(v, "inputs."+input) {
t.Errorf("%s job env %s reads inputs.%s; only %s's test step may", name, k, input, bazelIntegJobName)
}
}
for _, step := range job.Steps {
for k, v := range step.Env {
if strings.Contains(v, "inputs."+input) && (name != bazelIntegJobName || step.Name != test.Name || k != "EXCLUDE_TARGETS") {
t.Errorf("%s step %q env %s reads inputs.%s; only %s's EXCLUDE_TARGETS may", name, step.Name, k, input, bazelIntegJobName)
}
}
if strings.Contains(step.If, "inputs."+input) || strings.Contains(step.Run, "inputs."+input) {
t.Errorf("%s step %q reads inputs.%s", name, step.Name, input)
}
}
if strings.Contains(job.If, "inputs."+input) {
t.Errorf("%s if reads inputs.%s: the input must not change which lanes run", name, input)
}
}
// Coverage where it is dropped: bazel-cmd-dolt runs in every mode
// bazel-integration does (same if, for every caller's inputs).
if integ.If != bazelIntegIf || cmdDolt.If != integ.If {
t.Errorf("%s if = %q, %s if = %q; want both %q (the cmd/bd tier must run wherever integration drops bd_test)",
bazelIntegJobName, integ.If, bazelCmdDoltJobName, cmdDolt.If, bazelIntegIf)
}
// ... and pr.yml's gate accepts their skips in the same modes only.
requireHostTool(t, "bash")
root := sourceRepoRoot(t)
for _, mode := range bazelRBEModes {
cmd := exec.Command("bash", bazelGateScript, "skips")
cmd.Dir = root
cmd.Env = []string{"PATH=" + os.Getenv("PATH"), "BAZEL_RBE_MODE=" + mode, "BAZEL_RBE_ENABLED=" + bazelModeEnabled(mode)}
out, err := cmd.Output()
if err != nil {
t.Fatalf("%s skips (mode %s): %v", bazelGateScript, mode, err)
}
skips := map[string]bool{}
for _, id := range strings.Fields(string(out)) {
skips[id] = true
}
if skips["BAZEL_INTEGRATION"] != skips[bazelFlagGatedLanes[bazelCmdDoltJobName].id] {
t.Errorf("mode %s: bazel-gate.sh skips BAZEL_INTEGRATION=%v but %s=%v; they must match",
mode, skips["BAZEL_INTEGRATION"], bazelFlagGatedLanes[bazelCmdDoltJobName].id, skips[bazelFlagGatedLanes[bazelCmdDoltJobName].id])
}
}
// Callers: pr.yml passes the input as exactly its flag (whose "true"
// makes the gate require BAZEL_CMD_DOLT: bazelFlagGatedLanes); no other
// caller passes it.
pr := readCIWorkflow(t, "pr.yml")
g := bazelFlagGatedLanes[bazelCmdDoltJobName]
if got, flag := pr.job(t, "bazel").With[input], pr.Env[g.flag]; got != flag || (flag != "true" && flag != "false") {
t.Errorf("pr.yml bazel job %s = %q, %s = %q; want equal, \"true\" or \"false\" (flip both together)", input, got, g.flag, flag)
}
if !strings.Contains(pr.job(t, "ci-gate").step(t, "Evaluate CI gate").Run, bazelFlagGateRun(g)) {
t.Errorf("pr.yml's gate no longer requires %s when %s is \"true\"; bd_test would then run nowhere required", g.id, g.flag)
}
entries, err := os.ReadDir(filepath.Join(root, ".github", "workflows"))
if err != nil {
t.Fatal(err)
}
for _, e := range entries {
if e.Name() == "pr.yml" || !(strings.HasSuffix(e.Name(), ".yml") || strings.HasSuffix(e.Name(), ".yaml")) {
continue
}
for name, job := range readCIWorkflow(t, e.Name()).Jobs {
if _, ok := job.With[input]; ok && strings.HasSuffix(job.Uses, "/"+bazelWorkflowName) {
t.Errorf("%s job %s passes %s to %s; only pr.yml may (its gate is the one that requires bazel-cmd-dolt)", e.Name(), name, input, bazelWorkflowName)
}
}
}
}
// ciWorkflowEnvironment is a job's environment, written either as a bare name
// (environment: autofix) or as a mapping (environment: {name: github-pages,
// url: ...}, deploy-pages-redirect.yml).