fix: resolve variable shadowing of newSLR in IntegrateBatch - #3932
Open
Dev-next-gen wants to merge 1 commit into
Open
Dev-next-gen wants to merge 1 commit into
Dev-next-gen wants to merge 1 commit into
Conversation
The closure inside IntegrateBatch used := instead of = to assign newSLR, creating a new local variable that shadows the outer one. As a result, the outer newSLR stayed nil after the transaction, and the "sequenced N leaves, size M" log message never fired. Change := to = so the outer variable is correctly set, restoring the sequencing activity log line that operators depend on.
This branch has not been deployed
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
IntegrateBatchinlog/sequencer.godeclaresnewSLRin the outer function scope (line 282), but the closure passed toReadWriteTransactionassigns it with:=(line 403) instead of=. This creates a new local variable that shadows the outer one. After the transaction completes, the outernewSLRis stillnil, so the condition on line 419 is never true and theklog.Infof("sequenced %v leaves, size %v", ...)message never fires.Operators relying on log output to monitor sequencing activity see no "sequenced N leaves" messages, regardless of how many leaves are integrated.
Fix
Change
:=to=on line 403 so the assignment targets the outer variable.Proof
Added
TestIntegrateBatch_LogsSequencedLeaveswhich capturesklogoutput after a successful batch integration. With the shadow bug, the buffer is empty (FAIL). With the fix, it contains the expected "sequenced" message (PASS).Before fix:
After fix:
All existing tests in
./log/continue to pass.Found by a defect-hunting pipeline I build and run (Dev-next-gen), using Claude Code with Anthropic's Claude Opus 5.