Repository navigation
fix(parameters): avoid mutating caller's dict in get_parameters_by_name - #8607
leandrodamascena merged 3 commits into
Conversation
|
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. |
leandrodamascena
left a comment
There was a problem hiding this comment.
Thanks @SumiRann1, nice first one! I ran the suite and checked a few extra cases with the stubber: the caller's dict stays untouched, a later decrypt=True or transform="json" is honored, and per-parameter overrides still win over the globals like before. I pushed a tiny commit fixing a typo that slipped into a comment (qparameters), nothing else.
Approving now. This goes out in 3.38.0, so it will sit here a bit before I merge. No need to rebase or touch anything, I'll take care of it and you'll get the credit in the release notes. Thank you!
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #8607 +/- ##
========================================
Coverage 96.93% 96.93%
========================================
Files 318 318
Lines 16067 16067
Branches 1433 1433
========================================
Hits 15575 15575
Misses 349 349
Partials 143 143 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience! |
|
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience! |



Issue number: closes #8590
Summary
Changes
SSMProvider._split_batch_and_decrypt_parameters(used byget_parameters_by_name) did_overrides = options or {}, which made_overridesthe same object as the caller's per-parameter dict. The following writes oftransform,decryptandmax_agetherefore modified the user's input. On later calls, those stale values took precedence over the new globaldecrypt/transform.This PR copies the dict instead (
_overrides = {**(options or {})}), so the caller's input is never modified. I also added a regression test.User experience
Before: reusing the same parameters dict (e.g. a module-level
PARAMS = {...}, as in the docs) across invocations mutated it on the first call. A later call such asget_parameters_by_name(PARAMS, decrypt=True)silently fetched parameters without decryption, because the staledecrypt=Falsefrom the first call won.After: the input dict is left untouched, and global
decrypt/transformpassed on each call are honored.Checklist
test_ssm_provider_get_parameters_by_name_does_not_mutate_input_and_honors_new_globalsuv run pytest tests/functional/parameters)ruff formatandruff checkpassBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.