feat(speculation): speculator extension contract - #445
Open
behinddwalls wants to merge 1 commit into
Open
Conversation
This was referenced Jul 27, 2026
behinddwalls
marked this pull request as ready for review
July 27, 2026 19:00
behinddwalls
marked this pull request as draft
July 27, 2026 20:45
behinddwalls
marked this pull request as ready for review
July 27, 2026 23:17
Add submitqueue/extension/speculation/speculator, the one controller-facing speculation extension. Speculate returns the build and cancel actions to take from a queue snapshot and can never express a verdict; Config/Factory carry per-queue wiring. Includes the generated mocks. Register the speculation packages with the mocks make target so `make mocks` regenerates them.
behinddwalls
force-pushed
the
preetam/speculation-entities
branch
from
July 27, 2026 23:18
e178f70 to
f905059
Compare
behinddwalls
force-pushed
the
preetam/speculation-speculator
branch
from
July 27, 2026 23:18
648e491 to
d89bfe4
Compare
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?
Queue-scoped speculation (#413) puts one seam in front of the speculate controller. What the controller can delegate — which paths to build, which in-flight ones to preempt — goes through it; what it must not — whether a batch merges or fails — stays behind it.
A
Speculatorcannot express a verdict. A batch's outcome is computed by the controller, so swapping implementations changes which paths run, never whether a batch lands. That is enforced by the return type, not by convention.What?
Adds
submitqueue/extension/speculation/speculator.Speculatetakes the queue's in-flight batches plus finalized ones still referenced as dependencies, and every path set for them — live and recently finished, so an implementation won't re-propose a path that already passed or failed. It returns the build and cancel actions it proposes; a path left as-is has no entry.Config(queue name) andFactoryfollow the per-queue extension pattern. Budget, depth bound, and clock are injected at construction, keeping the contract backend-agnostic.README.mdand generated mocks, and registers the package with themocksMakefile target.Contract only — no implementation, no wiring.
Test Plan
✅
bazel build //submitqueue/extension/speculation/...No unit tests on this branch: it adds an interface, a config struct, and generated mocks, with no behavior to exercise. The contract is covered by the tests on the implementation branches.
Stack