Fix speculative build incorrectly triggering for current version branches#2776
Merged
Fix speculative build incorrectly triggering for current version branches#2776
Conversation
…ches
When a repository uses `main` as its current branch (not a version branch),
the speculative build logic falls back to product version information. The
comparison used `>=` against the anchored product version, which caused
version branches equal to the current product version to trigger speculative
builds unnecessarily.
For example, `elastic/elasticsearch` has `current: main` in assembler.yml
and the stack product version is `9.3.0`. When a push to the `9.3` branch
occurs, the match logic traces as follows:
1. Branch `9.3` is a version branch, but `current/next/edge` are all `main`
so no content source matches
2. `SemVersion.TryParse("main.0")` fails since current is not a version
branch, falling into the product version fallback path
3. Product version `9.3.0` anchors to `9.3.0`, and `9.3.0 >= 9.3.0` is
true, incorrectly triggering a speculative build
The `9.3` branch IS the current version — its content is already served
from `main`. Only versions strictly greater than current (e.g. `9.4`)
represent future versions that need speculative builds.
Fix: change `>=` to `>` in the product version comparison path. This does
not affect the versioned-current path (where current is e.g. `8.0`) which
correctly uses `>=` since the exact match is already recorded as a named
content source.
Fixes: https://github.com/elastic/elasticsearch/actions/runs/22323312600/job/64598377227?pr=142356
Co-authored-by: Cursor <cursoragent@cursor.com>
reakaleek
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a repository uses
mainas its current branch (not a version branch), the speculative build logic falls back to product version information. The comparison used>=against the anchored product version, which caused version branches equal to the current product version to trigger speculative builds unnecessarily.For example,
elastic/elasticsearchhascurrent: mainin assembler.yml and the stack product version is9.3.0. When a push to the9.3branch occurs, the match logic traces as follows:9.3is a version branch, butcurrent/next/edgeare allmainso no content source matchesSemVersion.TryParse("main.0")fails since current is not a version branch, falling into the product version fallback path9.3.0anchors to9.3.0, and9.3.0 >= 9.3.0is true, incorrectly triggering a speculative buildThe
9.3branch IS the current version — its content is already served frommain. Only versions strictly greater than current (e.g.9.4) represent future versions that need speculative builds.Fix: change
>=to>in the product version comparison path. This does not affect the versioned-current path (where current is e.g.8.0) which correctly uses>=since the exact match is already recorded as a named content source.Fixes: https://github.com/elastic/elasticsearch/actions/runs/22323312600/job/64598377227?pr=142356
Made with Cursor