Skip to content

[TE-6274] Fall bktec plan fallback parallelism back to BUILDKITE_PARALLEL_JOB_COUNT#577

Merged
gchan merged 3 commits into
mainfrom
gordon/te-6274-fallback-static-parallelism
Jul 2, 2026
Merged

[TE-6274] Fall bktec plan fallback parallelism back to BUILDKITE_PARALLEL_JOB_COUNT#577
gchan merged 3 commits into
mainfrom
gordon/te-6274-fallback-static-parallelism

Conversation

@gchan

@gchan gchan commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description

Fall the bktec plan fallback parallelism back to the static
BUILDKITE_PARALLEL_JOB_COUNT (cfg.Parallelism) when --max-parallelism
(BUILDKITE_TEST_ENGINE_MAX_PARALLELISM) is unset, so an unavailable Test Engine
degrades to "runs the full suite un-optimised" instead of "silently runs nothing".

When the API is unreachable or returns an error plan, bktec plan substitutes a
local fallback and exits 0. The fallback took cfg.MaxParallelism verbatim, so an
unset --max-parallelism gave parallelism 0: --pipeline-upload uploaded nothing,
--json emitted "0", and the suite was skipped. A green build that tested
nothing is the dangerous shape; "runs un-optimised" (non-zero parallelism) is the
acceptable fail-open degradation bktec run already makes.

This resolves the fallback parallelism like bktec run does —
MaxParallelism → Parallelism → 0 — aligning the two commands. It only adds
runs where there were none, so plans with a non-zero parallelism are unchanged.
The --max-parallelism help text already promises "when 0 ... the test plan
parallelism will be derived from BUILDKITE_PARALLEL_JOB_COUNT"; this honours that
in the fallback path.

Residual both-unset gap: when both --max-parallelism and
BUILDKITE_PARALLEL_JOB_COUNT are 0 (e.g. off-agent plan --plan-identifier), the
fallback would still be parallelism 0. #578 (TE-6275, merged) now catches this up
front with a client-side parallelism > 0 check that rejects the config before any
network call, so it no longer reaches this fallback.

Context

TE-6274. Surfaced during review of TE-6254 (bktec plan --plan-out, merged);
independent of it. Companion to #578 (TE-6275), the client-side parallelism > 0
check.

Changes

  • Add fallbackParallelism(cfg) and wire it into makeFallbackPlan and the
    --plan-out emitLocalFallback path in internal/command/plan.go.

Testing

Backed by specs: --pipeline-upload and --plan-out cases assert the fallback
uses the static parallelism when --max-parallelism is unset. Since #578 landed on
main, the parallelism-0 guard test drives Plan()'s guard directly (ValidateForPlan
now rejects the both-unset config before it reaches the guard; the guard stays as
defence in depth). AI assisted.

@gchan gchan requested a review from buildsworth-bk July 2, 2026 22:29

@buildsworth-bk-app buildsworth-bk-app Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I didn't find any code issues in this pass. This reads as an L1 bug fix with focused fallback-path coverage; I'm leaving a comment rather than an approval because the PR is still marked draft.

Want to dig deeper? The full session log is attached to this Buildkite build. Download the session file and open a new pi session with it:

Download the buildsworth logs from build 2452, then answer my questions about the findings.

@buildsworth-bk-app buildsworth-bk-app Bot removed the request for review from buildsworth-bk July 2, 2026 22:34
gchan added 3 commits July 3, 2026 10:55
…LLEL_JOB_COUNT

When the Test Engine API is unreachable or returns an error plan, bktec plan
substitutes a locally-computed fallback and exits 0. The fallback previously
took cfg.MaxParallelism verbatim, so an unset --max-parallelism yielded
parallelism 0 — --pipeline-upload uploaded nothing and --json emitted "0",
silently skipping the suite (a green build that tested nothing).

Resolve the fallback parallelism the way bktec run already does:
MaxParallelism -> Parallelism -> 0, falling back to the static
BUILDKITE_PARALLEL_JOB_COUNT when --max-parallelism is unset. On-agent this
closes the "nothing runs" hole: the suite runs un-optimised instead of being
skipped.
… rejects both-unset

TE-6275 (merged) makes ValidateForPlan reject the both-unset config that
produced this fallback, so the config can no longer reach Plan()'s
parallelism-0 guard through validation. The guard remains as defence in depth;
drive it directly and drop the now-failing ValidateForPlan call.
@gchan gchan force-pushed the gordon/te-6274-fallback-static-parallelism branch from 34ea2d1 to b1a51b0 Compare July 2, 2026 22:57
@gchan gchan marked this pull request as ready for review July 2, 2026 23:00
@gchan gchan requested a review from a team as a code owner July 2, 2026 23:00
@gchan gchan requested a review from buildsworth-bk July 2, 2026 23:01

@buildsworth-bk-app buildsworth-bk-app Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Focused fallback-path bug fix: the local fallback now derives parallelism from --max-parallelism or BUILDKITE_PARALLEL_JOB_COUNT, with direct coverage for both --pipeline-upload and --plan-out. I read this as L1: no API contract or config surface change, and CI is green.

Want to dig deeper? The full session log is attached to this Buildkite build. Download the session file and open a new pi session with it:

Download the buildsworth logs from build 2468, then answer my questions about the findings.

@buildsworth-bk-app buildsworth-bk-app Bot removed the request for review from buildsworth-bk July 2, 2026 23:03

@buildsworth-bk-app buildsworth-bk-app Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug fix with focused fallback-path coverage; no API surface or configuration contract change. I read this as L1 because it only changes the local fallback parallelism resolution from zero to the existing static job count when max-parallelism is unset.

Want to dig deeper? The full session log is attached to this Buildkite build. Download the session file and open a new pi session with it:

Download the buildsworth logs from build 2469, then answer my questions about the findings.

@gchan gchan merged commit 0483301 into main Jul 2, 2026
3 checks passed
@gchan gchan deleted the gordon/te-6274-fallback-static-parallelism branch July 2, 2026 23:07
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