feat(orchestrator): adopt QueueBatchStateStore for batch state reads and writes - #525
Merged
Conversation
…and writes ## Summary ### Why? `BatchStore.GetByQueueAndStates` was the storage contract's last query-by-attribute, backed by the schema's only secondary index (`idx_queue_state`). The queue's per-state membership records (`QueueBatchStateStore`) exist to replace it with pure by-key reads, but had no callers yet. ### What? Every batch state write now goes through the shared transition protocol in `submitqueue/core/batch`: `Transition` in the batch (Creating→Created), speculate (Speculating/Merging/Failed/Cancelled), mergesignal (terminal), cancel (Cancelling), and DLQ (Failed) controllers, with `EnsureRecord` repairing records after batch creation and on idempotent redelivery skip branches. The batch controller's dependency read goes through `core/batch.ListByStates` over the record buckets. `GetByQueueAndStates` is deleted from the contract, MySQL implementation, and mock, and `idx_queue_state` is dropped from the batch schema, so the batch table is pure get/put-by-key. Also repairs three stale controller tests that no longer matched the current control flow (they fail at the parent commit as well). ## Test Plan ✅ `go test ./...` (only pre-existing runway git-merger environment failures remain; they fail at the parent commit too) ✅ `make fmt` ✅ `make lint` ✅ `make gazelle` ✅ `make mocks` ✅ storage + orchestrator integration suites via `make integration-test` targets.
behinddwalls
marked this pull request as ready for review
August 6, 2026 14:39
behinddwalls
marked this pull request as draft
August 6, 2026 15:59
ubettigole
approved these changes
Aug 6, 2026
behinddwalls
marked this pull request as ready for review
August 6, 2026 16:16
behinddwalls
had a problem deploying
to
stack-rebase
August 6, 2026 16:25 — with
GitHub Actions
Failure
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?
BatchStore.GetByQueueAndStateswas the storage contract's last query-by-attribute, backed by the schema's only secondary index (idx_queue_state). The queue's per-state membership records (QueueBatchStateStore) exist to replace it with pure by-key reads, but had no callers yet.What?
Every batch state write now goes through the shared transition protocol in
submitqueue/core/batch:Transitionin the batch (Creating→Created), speculate (Speculating/Merging/Failed/Cancelled), mergesignal (terminal), cancel (Cancelling), and DLQ (Failed) controllers, withEnsureRecordrepairing records after batch creation and on idempotent redelivery skip branches. The batch controller's dependency read goes throughcore/batch.ListByStatesover the record buckets.GetByQueueAndStatesis deleted from the contract, MySQL implementation, and mock, andidx_queue_stateis dropped from the batch schema, so the batch table is pure get/put-by-key. Also repairs three stale controller tests that no longer matched the current control flow (they fail at the parent commit as well).Test Plan
✅
go test ./...(only pre-existing runway git-merger environment failures remain; they fail at the parent commit too) ✅make fmt✅make lint✅make gazelle✅make mocks✅ storage + orchestrator integration suites viamake integration-testtargets.Stack