Skip to content

feat(speculation): add path scorer extension#316

Open
behinddwalls wants to merge 1 commit into
preetam/ext/speculation-enumeratorfrom
preetam/ext/speculation-scorer
Open

feat(speculation): add path scorer extension#316
behinddwalls wants to merge 1 commit into
preetam/ext/speculation-enumeratorfrom
preetam/ext/speculation-scorer

Conversation

@behinddwalls

@behinddwalls behinddwalls commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Add the scorer seam from the speculation RFC, as a vendor-agnostic extension interface under submitqueue/extension/speculation/scorer/.

The scorer computes each speculation path's predicted-success score from the current state: the per-batch scores of the path's base batches (entity.Batch.Score) and which of those dependencies have resolved (landed or build-passed), plus optionally other signals. It is a prediction over live state, so the controller re-runs it on every respeculate right after reconciling status, and persists the result; the scorer owns only the formula.

The controller hands it the batch's speculation tree directly — the subject it scores. Any richer signal an implementation needs (dependency batch scores, historical pass rates) is injected at its Factory, not put in the signature. It never writes: it returns the tree with Score recomputed and the controller persists, staying the single writer of tree state.

This is the per-path scorer, distinct from the existing per-batch score stage (extension/scorer) that sets entity.Batch.Score — the path scorer consumes those to score whole paths.

Follows the repo extension contract: Factory.For(Config) (Scorer, error) with Config carrying only QueueName. Includes README, gomock package, and a programmable fake. Interface only; concrete impls and controller wiring are deferred.

Stack

  1. feat(entity,storage): rework speculation tree model and store #231
  2. feat(speculation): add enumerator + dependency-limit extensions #315
  3. @ feat(speculation): add path scorer extension #316
  4. feat(speculation): add selector + selection-limit extensions #317
  5. feat(speculation): add prioritizer + prioritization-limit extensions #320

Add the scorer seam from the speculation RFC, as a vendor-agnostic extension interface under submitqueue/extension/speculation/scorer/.

The scorer computes each speculation path's predicted-success score from the current state: the per-batch scores of the path's base batches (entity.Batch.Score) and which of those dependencies have resolved (landed or build-passed), plus optionally other signals. It is a prediction over live state, so the controller re-runs it on every respeculate right after reconciling status, and persists the result; the scorer owns only the formula.

The controller hands it the batch's speculation tree directly — the subject it scores. Any richer signal an implementation needs (dependency batch scores, historical pass rates) is injected at its Factory, not put in the signature. It never writes: it returns the tree with Score recomputed and the controller persists, staying the single writer of tree state.

This is the per-path scorer, distinct from the existing per-batch score stage (extension/scorer) that sets entity.Batch.Score — the path scorer consumes those to score whole paths.

Follows the repo extension contract: Factory.For(Config) (Scorer, error) with Config carrying only QueueName. Includes README, gomock package, and a programmable fake. Interface only; concrete impls and controller wiring are deferred.
@behinddwalls behinddwalls force-pushed the preetam/ext/speculation-enumerator branch from e547a50 to 13b7fe1 Compare July 8, 2026 23:13
@behinddwalls behinddwalls force-pushed the preetam/ext/speculation-scorer branch from 86f877f to 9dc7023 Compare July 8, 2026 23:14
@behinddwalls behinddwalls marked this pull request as ready for review July 8, 2026 23:19
@behinddwalls behinddwalls requested review from a team and sbalabanov as code owners July 8, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant