Skip to content

feat(entity): speculation path and run entities - #444

Open
behinddwalls wants to merge 1 commit into
mainfrom
preetam/speculation-entities
Open

feat(entity): speculation path and run entities#444
behinddwalls wants to merge 1 commit into
mainfrom
preetam/speculation-entities

Conversation

@behinddwalls

@behinddwalls behinddwalls commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Why?

Queue-scoped speculation (#413) needs a shared vocabulary before the extension, generator, allocator, and controller can be built against it. Landing it on its own keeps it reviewable and gives the rest of the stack a fixed base.

What?

Adds the speculation domain model in submitqueue/entity/speculation.go.

Stored:

  • SpeculationPath — a head batch plus one bet per dependency, in queue order. ID() hashes the head and its ordered bets, so identical paths share an ID.
  • DependencyBet / DependencyBetTypeincluded, excluded, or dropped (ignored by conflict relaxation).
  • SpeculationPathStatuspending, building, passed, failed, cancelling, cancelled. IsTerminal() excludes cancelling: a build being cancelled may still reach passed or failed.
  • SpeculationPathEntry — keyed by the content hash. No build reference, no score: an execution is (ID, Attempt), and a score only means something within one run.
  • SpeculationPathSet — one head's paths under a single version, live and recently finished.

Transient, never stored: PathAction (build or cancel only — a verdict is a controller fact, not a proposal), Speculation, CandidatePath.

The three stored types round-trip through ToBytes/FromBytes. Enums are string-valued with "" sentinels. No storage and no wiring.

Test Plan

bazel test //submitqueue/entity/...

Table tests cover ID() determinism and its sensitivity to head, dependency, bet, and bet order; IsTerminal() across every status; and JSON round-trips plus invalid and empty input for each FromBytes.

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 17:36
@behinddwalls
behinddwalls requested review from a team and sbalabanov as code owners July 27, 2026 17:36
@behinddwalls
behinddwalls force-pushed the preetam/speculation-entities branch from 4c78ae2 to e178f70 Compare July 27, 2026 18:02
@behinddwalls
behinddwalls marked this pull request as draft July 27, 2026 18:05
@behinddwalls
behinddwalls marked this pull request as ready for review 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 the speculation domain model in submitqueue/entity/speculation.go: SpeculationPath (keyed by a content hash), DependencyBet/DependencyBetType, SpeculationPathStatus, SpeculationPathEntry, and SpeculationPathSet, plus the run vocabulary PathAction/Speculation/CandidatePath. Enums are iota-based and every type round-trips through ToBytes/FromBytes; covered by table tests.

No storage and no wiring — these are the entities the speculation extension and controller build on.
@behinddwalls
behinddwalls force-pushed the preetam/speculation-entities branch from e178f70 to f905059 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