Skip to content

Comments

Fix speculative build incorrectly triggering for current version branches#2776

Merged
Mpdreamz merged 1 commit intomainfrom
fix/speculative-builds-again
Feb 24, 2026
Merged

Fix speculative build incorrectly triggering for current version branches#2776
Mpdreamz merged 1 commit intomainfrom
fix/speculative-builds-again

Conversation

@Mpdreamz
Copy link
Member

Summary

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

Made with Cursor

…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>
@Mpdreamz Mpdreamz requested a review from a team as a code owner February 24, 2026 08:02
@Mpdreamz Mpdreamz requested a review from reakaleek February 24, 2026 08:02
@Mpdreamz Mpdreamz added the fix label Feb 24, 2026
@Mpdreamz Mpdreamz merged commit 0e3d416 into main Feb 24, 2026
31 checks passed
@Mpdreamz Mpdreamz deleted the fix/speculative-builds-again branch February 24, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants