Skip to content

fix(chat): backfill group creators so reactions can be boosted - #1845

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/chat-creator-backfill
Oct 24, 2026
Merged

bmc08gt merged 1 commit into
code/cashfrom
fix/chat-creator-backfill

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

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:

[E] [[ReactionBoost]] No author or chat kind for message 443; boost not sent

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_hex arrived in DB v38 as a nullable column, so every chat stored before then started with no creator. ChatMetadataDao.upsert only writes the column on insert. For an existing row it calls updateServerOwnedFields, which refreshes the type, title and the other server-owned fields but not creator_hex, so those groups never got one. Fresh installs and groups joined after v38 are fine, which is why only some people hit it.

updateServerOwnedFields now sets creator_hex = COALESCE(:creatorHex, creator_hex). The next feed sync or chat fetch that carries Metadata.creator fills 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

ChatMetadataDaoTest covers 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. ReactionBoostReducerTest covers the trace reasons.

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.
@bmc08gt bmc08gt self-assigned this Oct 24, 2026
@github-actions github-actions Bot added the type: fix Bug fix label Oct 24, 2026
@bmc08gt
bmc08gt merged commit d0a1d27 into code/cash Oct 24, 2026
5 checks passed
@bmc08gt
bmc08gt deleted the fix/chat-creator-backfill branch October 24, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant