Repository navigation
fix(chat): backfill group creators so reactions can be boosted - #1845
Merged
Merged
Conversation
A boost in a group failed with "No author or chat kind for message 443; boost not sent" and the slider sprang back. That trace covers both a missing author and a missing chat kind. Message 443 came back with a sender in the page fetched when the chat opened, which leaves the chat kind, and the only way a stored group yields none is a null creator: a group boost pays the creator. chat_metadata.creator_hex arrived in DB v38 as a nullable column, so every chat stored before then started with no creator. ChatMetadataDao only wrote the column on insert: updateServerOwnedFields refreshed the type, title and the other server-owned fields on each sync but not creator_hex, so those rows never got one. It now takes COALESCE(:creatorHex, creator_hex). The next feed sync or chat fetch that carries Metadata.creator fills the row in, with no migration. A boost that can't go out now shows the "Payment Failed" alert instead of resetting silently. That covers the unresolved chat kind, a message id or reaction that is gone by the time of the confirm, and the payer's no-account and own-message cases. Each traces its own reason, and the unresolved case names whether the author, the chat metadata or the group's creator was missing.
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.
A user on 4918 couldn't boost a reaction in a group: the slider reached the end and sprang back. Their log has one line for it:
That trace covers both a missing author and a missing chat kind. Message 443 came back with a sender in the page fetched when the chat opened, which leaves the chat kind. A group boost pays the creator, and
boostChatOf(GROUP, null)is null, so the stored creator for that chat was most likely null. The log can't show the database, so that last step is an inference.Why the creator was null
chat_metadata.creator_hexarrived in DB v38 as a nullable column, so every chat stored before then started with no creator.ChatMetadataDao.upsertonly writes the column on insert. For an existing row it callsupdateServerOwnedFields, which refreshes the type, title and the other server-owned fields but notcreator_hex, so those groups never got one. Fresh installs and groups joined after v38 are fine, which is why only some people hit it.updateServerOwnedFieldsnow setscreator_hex = COALESCE(:creatorHex, creator_hex). The next feed sync or chat fetch that carriesMetadata.creatorfills the row in, with no migration. The creator never changes, so a sync without one keeps the stored value.No more silent resets
A boost that can't go out now shows the existing "Payment Failed" alert instead of springing back with no explanation. That covers the unresolved chat kind, a message id or reaction that is gone by the time of the confirm, and the payer's no-account and own-message cases. Each one traces its own reason, and the unresolved case names whether the author, the chat metadata or the group's creator was missing, so the next log says which.
Tests
ChatMetadataDaoTestcovers a group stored without a creator getting one on the next upsert, and a later upsert without a creator keeping it. The backfill test fails against the old query.ReactionBoostReducerTestcovers the trace reasons.