Skip to content

Commit 2fa94a3

Browse files
committed
feat(entity): give speculation paths an assigned identity
## Summary ### Why? The speculation seams being introduced up-stack (path scorer, selector, prioritizer) and durable links from other entities (a path→build mapping) all need to refer to one specific path inside a batch's speculation tree. Restating the full Base/Head split in every seam output couples those contracts to path structure and forces consumers to compare ordered slices; a single opaque identity lets each seam return only what matters — a path ID plus its verdict — and gives durable links a stable key to hang on. ### What? `entity.SpeculationPathInfo` gains `ID`: assigned by the controller when the path entry is first persisted, immutable thereafter, and unique within its tree. Its format is the controller's choice and carries no meaning — it is never parsed. Everything outside the tree names a path by this ID. The tree store persists it transparently through the JSON `paths` column, so the change is additive with no schema migration. ## Test Plan ✅ `bazel test //submitqueue/entity/...` — entity suite passes; the field rides the existing JSON round-trip in the tree store.
1 parent 7435b75 commit 2fa94a3

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

submitqueue/entity/speculation_tree.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,17 @@ const (
9898

9999
// SpeculationPathInfo is the per-path entry in a speculation tree: a path, its
100100
// latest predicted-success score, its controller-owned status, and a link to
101-
// the build dispatched for it (if any). Path is immutable once the entry is
102-
// persisted; Score, Status, and BuildID are updateable, written only by the
103-
// controller under the tree's Version optimistic lock.
101+
// the build dispatched for it (if any). ID and Path are immutable once the
102+
// entry is persisted; Score, Status, and BuildID are updateable, written only
103+
// by the controller under the tree's Version optimistic lock.
104104
type SpeculationPathInfo struct {
105+
// ID identifies this path within its tree. It is assigned by the controller
106+
// when the path entry is first persisted, immutable thereafter, and unique
107+
// within the tree; its format is the controller's choice and carries no
108+
// meaning — never parse it. Everything outside the tree names a path by this
109+
// ID: seam outputs (path scores, path decisions) and durable links from
110+
// other entities all refer to it rather than restating the Base/Head split.
111+
ID string
105112
// Path is the Base/Head split this entry covers. Immutable: it identifies
106113
// the entry and never changes after the path is first persisted.
107114
Path SpeculationPath

0 commit comments

Comments
 (0)