fix(bot): a reaction that never reached the backend now says so (#409) #462
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/409-visible-vote-failures"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #409 (MEDIUM). One of the two remaining states gating #416.
The defect
Every failure in the reaction handlers was a
log.warningand nothing else. The emoji stays on the message either way, so a player whose vote never reached Quest Board had every reason to believe it landed.auto_close_votingthen confirms whichever slot scored highest from the votes that did arrive, with nothing to say the tally was short. A backend blip during a busy voting window can decide when the group plays, and nobody who voted during it ever finds out.What ships
A failed reaction DMs the reacting player — what didn't happen, and what to do while it still matters. DM first because the failure is theirs; a channel-wide notice on a shared poll would confuse everyone else. An ❗ on the message is the fallback when DMs are closed: worse, but it beats the silence this replaces.
Success stays silent. A DM per vote would be unusable, and the message only works if it is rare.
Covers votes, RSVPs and summary feedback.
The second half: a lost mapping is not "not ours"
A missing message mapping shared one bare
returnwith "someone reacted to an unrelated message". Those are different situations: a tracked emoji on a message this bot posted was a poll whose Redis mapping has expired (30-day TTL) or was lost to a restart while on the in-memory fallback. That now says so, with a different remedy — nothing will make that poll work again, so "try again in a minute" would be wrong.The discriminator is deliberately narrow: bot-authored AND one of our emojis. The bot posts reminders and summaries too, and a 🎉 on a reminder must not produce a "your vote failed" DM.
One honest limitation, commented in place:
message_author_idis only populated on reaction add, not remove. So un-voting against a lost mapping stays silent. That is acceptable — removing a vote that was never recorded changes nothing, and guessing would mean DMing anyone who reacts to anything.Verification
Mutation-checked: with the notifications disabled, 5 of the 8 new tests fail.
Three of the eight assert silence — a successful vote, an unrelated emoji on a bot message, a tracked emoji on someone else's message — so the change cannot pass by notifying indiscriminately, which is the failure mode that would make people ignore the message.
228 bot tests pass (was 220).
Lint: my two files are clean at pinned ruff 0.4.4. Note that
questboard_bot/utils/audio.py:14has a pre-existing unusedosimport (last touched in #320) — CI's ruff job coverswebapp/backend/ scripts/only, sobot/is not gated. Flagging rather than fixing, since it is unrelated andbot/is excluded from the formatter by project convention.🤖 Generated with Claude Code