fix(parameters): accumulate results across chunks in get_parameters_by_name#8002
Open
abhu85 wants to merge 1 commit intoaws-powertools:developfrom
Open
fix(parameters): accumulate results across chunks in get_parameters_by_name#8002abhu85 wants to merge 1 commit intoaws-powertools:developfrom
abhu85 wants to merge 1 commit intoaws-powertools:developfrom
Conversation
…y_name Fix variable shadowing bug in _get_parameters_by_name_in_chunks where the response dict was being overwritten on each loop iteration instead of being accumulated. This caused get_parameters_by_name to return only the last chunk of parameters when fetching more than 10 parameters. Before: response, possible_errors = ... ; response.update(response) After: chunk_response, possible_errors = ... ; response.update(chunk_response) Closes aws-powertools#7832 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: abhu85 <60182103+abhu85@users.noreply.github.com>
|
|
No acknowledgement section found. Please make sure you used the template to open a PR and didn't remove the acknowledgment section. Check the template at |
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.



Issue # (if applicable)
Closes #7832
Summary
Fixes a variable shadowing bug in
_get_parameters_by_name_in_chunksthat causedget_parameters_by_nameto return only the last chunk of parameters when fetching more than 10 parameters.Root Cause
In the
_get_parameters_by_name_in_chunksmethod, the loop variableresponsewas being overwritten on each iteration instead of being accumulated:Impact
When fetching more than 10 parameters with
get_parameters_by_name, only the last chunk (up to 10 parameters) was returned. For example, fetching 12 parameters would only return the last 2 parameters instead of all 12.Changes
aws_lambda_powertools/utilities/parameters/ssm.py: Fixed variable shadowing by renaming the loop variable fromresponsetochunk_responsetests/functional/parameters/_boto3/test_utilities_parameters.py: Addedtest_get_parameters_by_name_accumulates_results_across_chunksto verify results are accumulated across chunksTest Plan
test_get_parameters_by_name_accumulates_results_across_chunksverifies all 12 parameters are returned when fetching more than 10get_parameters_by_nametests pass (16 tests)Test Commands
Acknowledgment
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.