fix: correct indentation bug in MsgBatchSigner._prepare_messages#58
Merged
emilyzheng merged 1 commit intorelease-engineering:mainfrom Jan 22, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #58 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 24 24
Lines 1272 1272
=========================================
Hits 1272 1272 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f837844 to
33b7e46
Compare
The `run_in_parallel` and `messages.extend` calls were incorrectly indented inside the repo loop, causing batch_data to be processed multiple times - once per repo iteration. Since batch_data accumulates across all repos, this led to O(N²) message duplication. With the buggy code, signing requests spanning multiple repos would send duplicate batches to the signing service, causing timeouts and unnecessary load. For example, with 3 repos: - Buggy code: 2 + 4 + 6 = 12 messages (with duplicates) - Fixed code: 2 + 2 + 2 = 6 messages (no duplicates) The fix moves these two lines outside the repo loop so batch_data is processed exactly once after all repos have been iterated. Assisted-by: Claude Code (Opus 4.5) Signed-off-by: arewm <arewm@users.noreply.github.com>
33b7e46 to
d0a90d0
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
MsgBatchSigner._prepare_messagesthat caused O(N²) message duplication when signing requests span multiple repositoriesProblem
The
run_in_parallelandmessages.extendcalls were incorrectly indented inside the repo loop. Sincebatch_dataaccumulates across all repos but was processed inside the loop, each repo iteration would re-process all accumulated batches.Example with 3 repos (chunk_size=2, 3 digests per repo):
This was causing signing tasks to timeout in production when processing large numbers of images across multiple repositories.
Fix
Move the two affected lines outside the repo loop (dedent by 4 spaces):
Test plan
test_prepare_messages_multi_repo_no_duplicationtest that:run_in_parallelis called exactly once (not once per repo)🤖 Generated with Claude Code