feat(speculate): bypass unsettled deps on full passed coverage - #656
Merged
Conversation
behinddwalls
marked this pull request as ready for review
August 31, 2026 20:41
## Summary ### Why? A batch's merge used to wait for every dependency to resolve even when its passed builds already covered every way those dependencies could turn out. That made a small change sit behind a slow one for no reason: both the with- and without-dependency trees were validated, so whichever future arrives is already green. ### What? Adds bypassablePath to the speculate controller: decide() merges a head once passed, unbroken, well-formed paths cover every 2^n combination of its unsettled dependencies. Settled dependencies still pin each path to reality through assumptionBroken. Finalize prefers a strict mergeable path and falls back to bypass coverage, superseding siblings either way. Tightened isWellFormed to require dependencies in the head's canonical order, and read the coverage signature positionally off the slice (dropping the per-path map). Order is load-bearing: Base() projects the path positionally, so a permuted path is a different stack, and a reordered path can no longer masquerade as coverage for the canonical combination. The NoBypassWhenCoverageIsIncomplete e2e test asserts ordering (follower lands only after the lead) rather than the racy intermediate speculating state: waiting is a recorded history event, and once the ungated lead lands the seeded path is strictly mergeable — the old assertion raced the queue and flaked on fast runners. ## Test Plan - ./tool/bazel test //submitqueue/orchestrator/controller/speculate:go_default_test - ./tool/bazel test //submitqueue/extension/speculation/... //submitqueue/entity:go_default_test //submitqueue/orchestrator/controller/build:go_default_test - New TestBypassablePath "does not count a reordered path" and TestIsWellFormed "dependencies out of queue order" fail before, pass after. - Four bypass E2E tests pass (BypassedHeadLandsFirst, BypassesMergingDependency, NoBypassWhenCoverageIsIncomplete, BypassesAnUnresolvedDependency); full e2e suite green twice locally.
mnoah1
approved these changes
Sep 1, 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
Why?
A batch's merge used to wait for every dependency to resolve even when its passed builds already covered every way those dependencies could turn out. That made a small change sit behind a slow one for no reason: both the with- and without-dependency trees were validated, so whichever future arrives is already green.
What?
Adds bypassablePath to the speculate controller: decide() merges a head once passed, unbroken, well-formed paths cover every 2^n combination of its unsettled dependencies. Settled dependencies still pin each path to reality through assumptionBroken. Finalize prefers a strict mergeable path and falls back to bypass coverage, superseding siblings either way.
Tightened isWellFormed to require dependencies in the head's canonical order, and read the coverage signature positionally off the slice (dropping the per-path map). Order is load-bearing: Base() projects the path positionally, so a permuted path is a different stack, and a reordered path can no longer masquerade as coverage for the canonical combination.
The NoBypassWhenCoverageIsIncomplete e2e test asserts ordering (follower lands only after the lead) rather than the racy intermediate speculating state: waiting is a recorded history event, and once the ungated lead lands the seeded path is strictly mergeable — the old assertion raced the queue and flaked on fast runners.
Test Plan