Repository navigation
fix(idempotency): return stored falsy responses on replay - #8701
Open
thebadalov wants to merge 1 commit into
Open
thebadalov wants to merge 1 commit into
thebadalov wants to merge 1 commit into
Conversation
_handle_for_status only deserialized the stored response when it was
truthy, so a function returning 0, False, "", [] or {} got None back on
every replay, even though the value was saved correctly.
Check for None instead, matching the write path in
_get_function_response.
|
leandrodamascena
approved these changes
Oct 31, 2026
leandrodamascena
left a comment
Contributor
There was a problem hiding this comment.
Thanks @thebadalov, confirmed against real DynamoDB and Valkey: on develop every falsy return (0, False, "", [], {}) comes back as None on replay, with your change each one comes back as the stored value with the right type, and None and truthy values are unchanged. The dataclass serializer path is fine too.
I'm approving now. This goes out in 3.40.0, so it will sit here for a while before I merge it. No rebase needed in the meantime, and you'll be credited in the release notes.
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.



Issue number: closes #8700
Summary
Changes
IdempotencyHandler._handle_for_statusnow checksresponse_dict is not Nonebefore deserializing the stored response, the same check_get_function_responsealready uses when saving it.Added
test_idempotent_function_falsy_response_replay, parametrized over0,False,"",[]and{}. Each case calls the function twice with the same payload and checks that the second call returns the same value and type without running the function again. All five cases fail on the currentdevelopand pass with the fix.User experience
0,False,"",[]or{}gotNoneback on every replay.Noneand truthy values behave the same as before.Testing
tests/functional/idempotencyandtests/unit/idempotency: 207 passedCachePersistenceLayerfor0,False,"",[],{},Noneand a truthy valueBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.