fix(flipcash): treat an unset bill_exchange_data_timeout as absent - #1398
Merged
Merged
Conversation
bill_exchange_data_timeout is a google.protobuf.Duration, so an unset field still yields the default instance and the mapper turned that into 0.seconds rather than null. Guard on hasBillExchangeDataTimeout(), which is how every other optional message-typed field here is read — see UserProfileMapper's profilePicture and joinTs, and ChatMetadataMapper's lastMessage. The two values are not interchangeable downstream. VerifiedState.exchangeDataFor substitutes a 15 minute default for null but returns null outright for a timeout of zero, so every user whose flags omitted the field was treated as having verified exchange data permanently expired: GiveBillTransactor.start refetched the rate on every bill instead of using the state it already held. No consumer needed adjusting. Field.BillExchangeDataTimeout already encodes null as -1 and formats it as "None", and CachedFlags round-trips it as a nullable Long.
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.
bill_exchange_data_timeoutis agoogle.protobuf.Duration, so an unset field still deserializes to the default instance.UserFlagsMapperread it unconditionally and turned that into0.seconds, even though the domain field isDuration?andUserFlags.Defaultusesnull. A consumer could not tell "no timeout configured" from "timeout of zero".This guards the mapping on
hasBillExchangeDataTimeout(), which is how every other optional message-typed field in this package is read —UserProfileMapper'sprofilePictureandjoinTs,ChatMetadataMapper'slastMessage.Why the distinction matters
VerifiedState.exchangeDataFortreats the two values as opposites:So for any user whose flags omitted the field,
GiveBillTransactor.startdiscarded theVerifiedStateit already held — however fresh the rate was — and fell into its "rate expired" branch, refetching a verified state on every bill presentation. When that refetch failed (offline, or no rate for the currency/mint pair) the give flow returnedExchangeRateExpiredExceptionwhile holding a usable rate. Withnullthe held state gets the intended 15 minute window.A server that deliberately sends
0sstill disables verified exchange data, unchanged.Consumers
No changes needed.
Field.BillExchangeDataTimeoutalready encodesnullas-1Land formats it as"None",CachedFlagsround-trips it as a nullableLong, andTransactionController's gift-card path never passed the flag — it relies on the samenulldefault.The one visible difference is the debug flags screen, which now reads "None" rather than "0s" when the server omits the field.