feat(entity): speculation path and run entities - #444
Open
behinddwalls wants to merge 1 commit into
Open
Conversation
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
marked this pull request as ready for review
July 27, 2026 17:36
behinddwalls
force-pushed
the
preetam/speculation-entities
branch
from
July 27, 2026 18:02
4c78ae2 to
e178f70
Compare
behinddwalls
marked this pull request as draft
July 27, 2026 18:05
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
behinddwalls
force-pushed
the
preetam/speculation-entities
branch
from
July 27, 2026 23:18
e178f70 to
f905059
Compare
sbalabanov
approved these changes
Jul 28, 2026
| // full meaning can be read without consulting any external relaxed set or | ||
| // dependency list. | ||
| type SpeculationPath struct { | ||
| // Head is the batch being built along this path. |
Contributor
There was a problem hiding this comment.
wording should say "batch id" ? May be even field name.
| // and its bets in order. Two paths with the same head and the same ordered | ||
| // bets share an ID; any difference in head, dependency, or bet yields a | ||
| // different ID. | ||
| func (p SpeculationPath) ID() string { |
Contributor
There was a problem hiding this comment.
may be GetID() to indicate that the operation is always computational and there is no cache?
| // is meaningful only within a single speculation run). | ||
| type SpeculationPathEntry struct { | ||
| // ID is the primary key: the hash of the path's content (head plus its | ||
| // bets). It equals Path.ID(). |
Contributor
There was a problem hiding this comment.
is there a reason to duplicate from path.ID?
| UpdatedAtMs int64 | ||
| } | ||
|
|
||
| // ToBytes serializes the SpeculationPathEntry to JSON bytes for queue message payload. |
Contributor
There was a problem hiding this comment.
is it ever transmitted over queue? what serialization is for? May be add it when needed?
| // dependency list. | ||
| type SpeculationPathSet struct { | ||
| // BatchID is the primary key: the head batch these paths speculate on. | ||
| BatchID string |
Contributor
There was a problem hiding this comment.
to name is consistently with SpeculationPath - "Head" ? or at least the same
behinddwalls
force-pushed
the
preetam/speculation-entities
branch
from
July 28, 2026 19:13
f905059 to
e178f70
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) 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/DependencyBetType—included,excluded, ordropped(ignored by conflict relaxation).SpeculationPathStatus—pending,building,passed,failed,cancelling,cancelled.IsTerminal()excludescancelling: a build being cancelled may still reachpassedorfailed.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(buildorcancelonly — 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 eachFromBytes.Stack