feat(storage): path-build link store for per-path builds - #502
Open
behinddwalls wants to merge 1 commit into
Open
feat(storage): path-build link store for per-path builds#502behinddwalls wants to merge 1 commit into
behinddwalls wants to merge 1 commit into
Conversation
behinddwalls
marked this pull request as ready for review
August 3, 2026 17:11
behinddwalls
force-pushed
the
preetam/speculation-path-build-store
branch
from
August 3, 2026 23:03
5692021 to
4443963
Compare
behinddwalls
force-pushed
the
preetam/speculation-path-build-store
branch
from
August 4, 2026 01:58
4443963 to
471898d
Compare
This was referenced Aug 4, 2026
## Summary ### Why? Speculation needs one build per *path*, and something must record which build belongs to which path attempt. The runner chooses the build ID, so a caller holding a path cannot derive it; a keyed record is the key-value contract's mechanism for a reverse lookup. ### What? `entity.PathBuild` is new: the `(pathID, attempt) -> buildID` link, with `storage.PathBuildStore`, a MySQL implementation, schema, and mocks. The record is write-once: created only once the runner has named the build, never updated. Absent means no build is recorded for the attempt; present names its build permanently, and a retried path is a new attempt under a different key. Because creation is the only write, the first insert also decides concurrent dispatches for the same attempt — `ErrAlreadyExists` tells the loser the attempt's build is someone else's. There is deliberately no reservation state and no version column: the stage that watches builds (later in this stack) stops any build whose path no longer wants it, so no reader needs to distinguish "idle" from "mid-dispatch". `entity.Build` gains `PathID` and `Attempt`, and `entity.SpeculationPath` gains `Base()` — the dependencies the path assumes will succeed — so every consumer derives the base one way. ## Test Plan ✅ `bazel test //submitqueue/entity/... //submitqueue/extension/storage/...` ✅ `bazel test //test/integration/submitqueue/extension/storage/mysql:go_default_test` — an attempt resolving to its build, `ErrNotFound` when undispatched, and a duplicate `Create` refused so the first link stands. ✅ `make fmt`, `make gazelle`, `make mocks`
behinddwalls
force-pushed
the
preetam/speculation-path-build-store
branch
from
August 4, 2026 05:11
471898d to
edc7d3a
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?
Speculation needs one build per path, and something must record which build belongs to which path attempt. The runner chooses the build ID, so a caller holding a path cannot derive it; a keyed record is the key-value contract's mechanism for a reverse lookup.
What?
entity.PathBuildis new: the(pathID, attempt) -> buildIDlink, withstorage.PathBuildStore, a MySQL implementation, schema, and mocks.The record is write-once: created only once the runner has named the build, never updated. Absent means no build is recorded for the attempt; present names its build permanently, and a retried path is a new attempt under a different key. Because creation is the only write, the first insert also decides concurrent dispatches for the same attempt —
ErrAlreadyExiststells the loser the attempt's build is someone else's. There is deliberately no reservation state and no version column: the stage that watches builds (later in this stack) stops any build whose path no longer wants it, so no reader needs to distinguish "idle" from "mid-dispatch".entity.BuildgainsPathIDandAttempt, andentity.SpeculationPathgainsBase()— the dependencies the path assumes will succeed — so every consumer derives the base one way.Test Plan
✅
bazel test //submitqueue/entity/... //submitqueue/extension/storage/...✅
bazel test //test/integration/submitqueue/extension/storage/mysql:go_default_test— an attempt resolving to its build,ErrNotFoundwhen undispatched, and a duplicateCreaterefused so the first link stands.✅
make fmt,make gazelle,make mocksIssues
Stack