Skip to content

fix: four correctness bugs — blocked-phrase bypass, empty-phrase scoring, proxyAuthors leak#58

Open
davelindsay84 wants to merge 4 commits into
mainfrom
feature/existential-dread
Open

fix: four correctness bugs — blocked-phrase bypass, empty-phrase scoring, proxyAuthors leak#58
davelindsay84 wants to merge 4 commits into
mainfrom
feature/existential-dread

Conversation

@davelindsay84

Copy link
Copy Markdown
Collaborator

Summary

  • config.js: Trim whitespace from SearchPhrasesToBlock entries — SEARCH_PHRASES_TO_BLOCK=bad, word was creating ' word' with a leading space, making the block silently ineffective
  • replacer.js: Apply normalizeUnicode to the replacement text before the blocked-phrase check — curly-quote variants of a blocked replacement phrase were bypassing the filter
  • scoring.js: Guard parseScoreLine against bare ++ / -- / lines with no phrase text, which were inserting empty-string rows into the DB
  • reactions.js: Cap proxyAuthors Map at 1000 entries with FIFO eviction to prevent unbounded growth over long uptime

Test plan

  • All 132 existing tests pass
  • New test: SearchPhrasesToBlock trims whitespace from each entry
  • New test: blocked replacement term containing a curly apostrophe is caught
  • New test: bare ++ / -- messages produce no DB entries

🤖 Generated with Claude Code

David Lindsay and others added 4 commits May 2, 2026 09:53
Discord.js Collection iterates as [id, Message] pairs, not bare Messages.
Passing .values() gives replaceFirstMessage the Message objects it expects.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ing, proxyAuthors leak

- config.js: trim whitespace from SearchPhrasesToBlock entries so that
  'bad, word' in the env var does not create a ' word' entry that silently
  bypasses the block
- replacer.js: apply normalizeUnicode to the replacement text before the
  blocked-phrase check, closing the curly-quote bypass
- scoring.js: guard parseScoreLine against bare '++' / '--' lines that
  would insert an empty-string phrase into the DB
- reactions.js: cap proxyAuthors Map at 1000 entries (FIFO eviction) to
  prevent unbounded growth over long uptime

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Output is now a single line: **👍 (30d)** 1. <@id1> 3, 2. <@id2> 2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread reactions.js
// of the command issuer.
// Capped at 1000 entries (FIFO) — the oldest entry is evicted when the cap is
// hit, since stale proxy mappings for long-past messages are never useful.
const PROXY_AUTHORS_MAX = 1000;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Mate configurable

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.

2 participants