Skip to content

Report only Discord-identified message edits - #86

Merged
jatmn merged 1 commit into
mainfrom
fix/message-edit-log-false-positives
Sep 22, 2026
Merged

jatmn merged 1 commit into
mainfrom
fix/message-edit-log-false-positives

Conversation

@jatmn

@jatmn jatmn commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • message_edit logs now require Discord's edited_timestamp. GIF/link unfurls, chat-reply previews, pin/flag refreshes, and other Gateway updates that omit that timestamp are not reported as edits (Zeppelin showed none for the same window).
  • Each report is one observed edit. The bot does not treat its own log posts as edits, so a log line cannot stack prior reports as Current text or mass-spam nested events.
  • Real user edits, including edits of reply messages, still report using supplied fields only. Reports still say "updated" and do not invent a before/after diff.

This implements the repository-scoped user report (including the follow-up that reply timestamps were mistaken for edits). No GitHub issue number was supplied.

Test plan

  • Focused cargo test --locked -p jmodguard-bot logging:: (21 passed), including GIF unfurl, reply-preview, bot-own log, and timestamped real-edit cases
  • Workspace tests, Clippy -D warnings, remaining bash scripts/ci-preflight.sh gates on the candidate tree (cargo audit 2 advisories allowed for PRs)
  • Rebased onto current main (7035684 / PR Load daisyUI and Headless UI at runtime for searchable Guild WebUI selects #85); logging tests and bot Clippy re-run on 488eda7
  • Live Discord: post a GIF-only Tenor link and confirm no message_edit log
  • Live Discord: reply to a message and confirm no message_edit log
  • Live Discord: actually edit a message (including a reply) and confirm a single unstacked report

Reviewed and pushed head: 488eda712d2963b9c321776464382cc538d2ae98.

Summary by Sourcery

Report only Discord-identified user message edits and exclude refresh events and the bot's own log messages.

Bug Fixes:

  • Prevent false-positive message-edit reports for Gateway updates that lack Discord's edited timestamp, including embeds, GIF/link unfurls, reply previews, pin/flag refreshes, and similar events.
  • Prevent the bot's own logging messages from generating nested or repeated message-edit reports.

Enhancements:

  • Limit deduplication to observations sharing the same Discord edit timestamp while preserving reports for distinct real edits.
  • Document message-edit reporting behavior and its exclusions across logging, setup, and template guidance.

Tests:

  • Expand logging coverage for timestamp-gated edits, refresh events, reply messages, bot-owned log updates, and timestamp-aware deduplication.

GIF unfurls, chat replies, and the bot's own log posts arrive as
MESSAGE_UPDATE without an edit timestamp and were logged as stacked edits.
@jatmn jatmn self-assigned this Sep 22, 2026
@jatmn
jatmn marked this pull request as ready for review September 22, 2026 15:36

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. If the edit-detection or bot-message filtering is wrong, legitimate edits could be omitted or misleading report messages could be posted to Discord. Reverting restores the prior behavior, but reports already sent remain in the log and would need bounded cleanup.

@jatmn
jatmn merged commit ae1308f into main Sep 22, 2026
2 checks passed
@jatmn
jatmn deleted the fix/message-edit-log-false-positives branch September 22, 2026 15:58
@jatmn jatmn mentioned this pull request Sep 22, 2026
5 of 6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant