Repository navigation
fix(idempotency): return stored falsy responses on replay - #8701
leandrodamascena merged 2 commits 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
left a comment
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.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #8701 +/- ##
========================================
Coverage 97.01% 97.01%
========================================
Files 321 321
Lines 16431 16431
Branches 1484 1484
========================================
Hits 15940 15940
Misses 350 350
Partials 141 141 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|



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.