Skip to content

feat(speculation): speculator extension contract - #445

Open
behinddwalls wants to merge 1 commit into
preetam/speculation-entitiesfrom
preetam/speculation-speculator
Open

feat(speculation): speculator extension contract#445
behinddwalls wants to merge 1 commit into
preetam/speculation-entitiesfrom
preetam/speculation-speculator

Conversation

@behinddwalls

@behinddwalls behinddwalls commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

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 Speculator cannot 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.

  • Speculate takes 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.
  • Cancel is its only cancel power: preempting an in-flight path to free budget. Correctness cancels belong to the controller.
  • Config (queue name) and Factory follow the per-queue extension pattern. Budget, depth bound, and clock are injected at construction, keeping the contract backend-agnostic.
  • Adds the package README.md and generated mocks, and registers the package with the mocks Makefile 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

  1. feat(entity): speculation path and run entities #444
  2. @ feat(speculation): speculator extension contract #445
  3. feat(speculation): generator contract and bestfirst impl #446

@behinddwalls
behinddwalls marked this pull request as ready for review July 27, 2026 19:00
@behinddwalls
behinddwalls requested review from a team and sbalabanov as code owners July 27, 2026 19:00
@behinddwalls
behinddwalls marked this pull request as draft July 27, 2026 20:45
@behinddwalls
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
behinddwalls force-pushed the preetam/speculation-entities branch from e178f70 to f905059 Compare July 27, 2026 23:18
@behinddwalls
behinddwalls force-pushed the preetam/speculation-speculator branch from 648e491 to d89bfe4 Compare July 27, 2026 23:18
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