feat(storage): speculation path set store - #501
Open
behinddwalls wants to merge 1 commit into
Open
Conversation
behinddwalls
marked this pull request as ready for review
August 3, 2026 16:46
behinddwalls
force-pushed
the
preetam/speculation-path-store
branch
2 times, most recently
from
August 4, 2026 01:58
c56ac02 to
e481adf
Compare
This was referenced Aug 4, 2026
behinddwalls
force-pushed
the
preetam/speculation-path-store
branch
from
August 4, 2026 05:11
e481adf to
c4f175e
Compare
behinddwalls
force-pushed
the
preetam/speculation-path-store
branch
from
August 5, 2026 03:15
c4f175e to
5483221
Compare
behinddwalls
force-pushed
the
preetam/speculation-path-store
branch
from
August 5, 2026 03:26
5483221 to
cdce63d
Compare
behinddwalls
force-pushed
the
preetam/speculation-path-store
branch
from
August 5, 2026 03:37
cdce63d to
6989aee
Compare
behinddwalls
force-pushed
the
preetam/speculation-path-store
branch
from
August 5, 2026 03:43
6989aee to
3f6c278
Compare
behinddwalls
force-pushed
the
preetam/speculation-path-store
branch
from
August 5, 2026 04:11
3f6c278 to
f9aa731
Compare
behinddwalls
force-pushed
the
preetam/speculation-path-store
branch
from
August 5, 2026 04:57
f9aa731 to
a39bba0
Compare
behinddwalls
force-pushed
the
preetam/speculation-path-store
branch
from
August 5, 2026 17:05
a39bba0 to
ba43a64
Compare
behinddwalls
force-pushed
the
preetam/speculation-path-store
branch
from
August 5, 2026 17:28
ba43a64 to
39b2158
Compare
## Summary ### Why? The speculate run reads every head's path set at the start of a run and persists what it funds at the end. `entity.SpeculationPathSet` exists, but nothing can store one. ### What? Adds `storage.SpeculationPathSetStore`, keyed on the head batch ID, with a MySQL implementation, schema, mocks, and contract tests. The mutation is a conditional whole-item put — `Update` replaces the set, guarded on version — because a conditional put on a key is the primitive every backend offers directly; a field-level update is the one shape non-SQL backends would have to emulate with a read-modify-write. Version arguments are explicit and the entity's own `Version` field is ignored, per the storage README. No secondary index: callers that want a queue's live sets enumerate the heads from the batch listing they already hold and read each set by key. ## Test Plan ✅ `bazel test //submitqueue/extension/storage/...` — sqlmock coverage of get/create/update and every error contract, plus a pin that `Update` ignores the entity's `Version` field. ✅ `bazel test //test/integration/submitqueue/extension/storage/mysql:go_default_test` — against real MySQL: round-trip (each stored ID still hashes its stored path), missing head, duplicate create, and a compare-and-swap race where the loser must not restore the path the winner dropped. ✅ `make fmt`, `make gazelle`, `make mocks`
behinddwalls
force-pushed
the
preetam/speculation-path-store
branch
from
August 5, 2026 19:05
39b2158 to
e76af5a
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?
The speculate run reads every head's path set at the start of a run and persists what it funds at the end.
entity.SpeculationPathSetexists, but nothing can store one.What?
Adds
storage.SpeculationPathSetStore, keyed on the head batch ID, with a MySQL implementation, schema, mocks, and contract tests.The mutation is a conditional whole-item put —
Updatereplaces the set, guarded on version — because a conditional put on a key is the primitive every backend offers directly; a field-level update is the one shape non-SQL backends would have to emulate with a read-modify-write. Version arguments are explicit and the entity's ownVersionfield is ignored, per the storage README.No secondary index: callers that want a queue's live sets enumerate the heads from the batch listing they already hold and read each set by key.
Test Plan
✅
bazel test //submitqueue/extension/storage/...— sqlmock coverage of get/create/update and every error contract, plus a pin thatUpdateignores the entity'sVersionfield.✅
bazel test //test/integration/submitqueue/extension/storage/mysql:go_default_test— against real MySQL: round-trip (each stored ID still hashes its stored path), missing head, duplicate create, and a compare-and-swap race where the loser must not restore the path the winner dropped.✅
make fmt,make gazelle,make mocksStack