Replace N+1 execution fetches in batch-status handler with one batch fetch#811
Open
AbirAbbas wants to merge 1 commit into
Open
Replace N+1 execution fetches in batch-status handler with one batch fetch#811AbirAbbas wants to merge 1 commit into
AbirAbbas wants to merge 1 commit into
Conversation
…tatus handler with one batch fetch handleBatchStatus now issues a single GetExecutionRecordsBatch query regardless of how many execution IDs are requested, instead of looping GetExecutionRecord per ID. Missing IDs preserve the prior per-ID 'not_found' response. Requests with more than 500 IDs are rejected with a 400 before hitting storage. Storage layer gains GetExecutionRecordsBatch on LocalStorage and the StorageProvider/ExecutionStore interfaces; test stubs updated to satisfy the new interface.
AbirAbbas
marked this pull request as draft
July 21, 2026 22:12
Contributor
📊 Coverage gateThresholds from
✅ Gate passedNo surface regressed past the allowed threshold and the aggregate stayed above the floor. |
Contributor
📐 Patch coverage gateThreshold: 80% on lines this PR touches vs
✅ Patch gate passedEvery surface whose lines were touched by this PR has patch coverage at or above the threshold. |
AbirAbbas
marked this pull request as ready for review
July 22, 2026 13:41
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
handleBatchStatuswith a singleGetExecutionRecordsBatchquery using a parameterizedWHERE execution_id IN (...)clause.not_foundresponse contract for missing execution IDs while collapsing all DB round-trips to one.400before any storage call, and reuses the batched webhook-registration lookup to avoid a secondary N+1.Changes
control-plane/internal/storage/storage.go: addsGetExecutionRecordsBatchto theStorageProvider/ExecutionStoreinterfaces.control-plane/internal/storage/execution_records.go: implementsGetExecutionRecordsBatchonLocalStoragewith a single parameterizedIN (...)query.control-plane/internal/handlers/execute.go: rewriteshandleBatchStatusto fetch once and enforce the batch-size cap.internal/handlers/*andinternal/server/*updated to satisfy the new storage interface; newexecute_batch_status_test.goandexecution_records_test.gocover the batch path, per-IDnot_foundmapping, and oversize rejection.Test plan
cd control-plane && go vet ./...(clean).cd control-plane && go test ./internal/handlers/... ./internal/storage/...(passing).400without hitting storage.Closes #430
🤖 Built with AgentField SWE-AF
🔌 Powered by AgentField