BadBoy_AutoBlacklist v12.1.0.3
What's new
Code review of the whole addon (detection, filters, persistence, options and packaging) and the
fixes it produced. A regression suite (`tests/selftest.lua`, runs the addon with the WoW API
simulated) now covers the behaviour that cannot be checked by reading the code.
### Fixes
- **`/bbauto` is now a harmless self-test.** It used to call the production filter and blacklist:
with a full list it could evict a real entry (the 500-entry cap), sync a fake name to
BadBoy_Ignore, queue a bogus "added to the blacklist" notice and even alter the scores of
real players in the message buffer. It now runs in dry-run mode and restores the runtime
state afterwards: the blacklist, the Ignore list and the notices are left untouched.
- **Pattern classes are no longer corrupted by the options panel.** The phrase box lower-cased
everything, so `regex:%S+` (non-space) was stored as `regex:%s+` (space) and ended up hiding
and blacklisting ordinary messages. The text is now kept exactly as typed; plain phrases are
lower-cased when they are stored and patterns keep the case of their classes (`%S` is not
`%s`). A warning is printed when a pattern has upper-case literals, which never match the
lower-cased message text.
- **A pardon now really pardons.** While a manually removed player is pardoned, the messages
that triggered `repeat`/`crew` were still hidden (the message was hidden before the blacklist
refused the entry). Only the user phrases keep hiding during the pardon, as documented.
- **Secret values are checked before any comparison.** The `BadBoyLog` hook compared the sender
name with `""` before checking `issecretvalue()`, which raises an error and taints the
execution on clients that deliver secret values.
- **A blacklisted player is hidden even when the message or the name arrive as secret values.**
The filter returned before checking the list; membership only needs the GUID (or a readable
name), never the message text.
- **Hidden-message counts count messages, not chat frames.** The same message shown in two
chat frames was counted twice, and entries reached through the name fallback accumulated
their count under the GUID, where it was discarded.
- **Pending counts are no longer lost when the session ends** (they are flushed on logout and
when leaving the world).
- **Expired pardons are purged** at login and on the periodic sweep, and `/bbauto` now counts
only the pardons in force instead of every stored one.
- **The 500-entry cap is enforced again.** A database imported with more entries kept growing
(one added, one evicted) and never went back to the limit; it is now trimmed by age when it
is loaded, and the eviction never picks the entry being added.
- **`byName` is rebuilt when the addon loads.** A missing or stale index broke the name
fallback and let the detector create a second entry for a player who was already listed.
- **Every numeric option and stored entry is validated.** A hand-edited value such as
`pardonHours="6"` or `expireDays="30"` used to break the filter, the removal or the login;
they are now coerced and bounded when loading.
- **The phrase list is canonicalised when it is loaded.** Invalid or duplicated phrases are
dropped from the SavedVariable itself, so the stored list and the runtime list keep the same
indexes (a removal used to delete the wrong phrase and the removed one came back on the next
login).
- **Patterns that match the empty string are rejected** (`regex:%s*` used to be accepted and
then hid and blacklisted every message of every non-exempt player).
- **The minimum length of a phrase now applies to the compact form too**, so `ab!` or `a b` no
longer match inside words like "about".
- **Adding and removing the same pattern is symmetric again**: `regex: ^wts` could be added but
not removed, and the panel reported it as an invalid phrase.
- **The detector no longer counts the same message twice.** The core and one of its modules
can report the same chat; the two notifications were counted as two detections, which listed
the player after a single message.
### Changed
- **The similarity is a proper token-set Dice coefficient** (only distinct words of 3+ characters
count). Repeated words no longer lower the similarity of a mutating advertisement.
- **`selfHits` counts the similar messages, including the current one**: with the default value
of 5 the player is now listed on the fifth similar message (before, on the sixth).
- **The options panel**
- "Remove player" is now paged (20 per page) instead of dumping up to 500 entries in one
menu, where most of them could not be reached.
- "Clear list" asks for confirmation: it also removes the Ignore entries and the pardons.
- "Open report dialog" is greyed out when the client has no report API (the classic branch
of the core uses a different one), and "Sync Ignore" is greyed out when BadBoy_Ignore is
not installed. Both are checked when the panel opens, not when the addon loads.
- The phrase box accepts up to 100 characters.
- **`/bbauto remove Nombre-Realm`** removes a single entry (handy with long lists), and the
diagnostic reports the report API availability.
### Tooling
- `tests/selftest.lua`: regression suite that loads the addon with the WoW API simulated
(including secret string values that raise an error when compared). Run it with
`pandoc lua tests/selftest.lua`; 49 checks cover the self-test isolation, the pardons, the
phrase canonicalisation, the secret values, the persistence sanitation and the thresholds.
- `node package.js` now runs `checkblocks.js` and `checksyntax.lua` as a preflight, refuses to
overwrite the zip of an existing version (use `--force` only for a version that was never
published), prints the full `## Interface` list for CurseForge and fails if the `LICENSE`
file is missing.
- The MIT license text is now shipped inside the addon (`BadBoy_AutoBlacklist/LICENSE`).
This mod has no additional files