Skip to content

Fix Vahter autoban karma leaking across identical message text - #557

Merged
Szer merged 3 commits into
mainfrom
codex/vahter-message-karma
Oct 11, 2026
Merged

Szer merged 3 commits into
mainfrom
codex/vahter-message-karma

Conversation

@Szer

@Szer Szer commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

A historical “not spam” correction for one message made every sender using identical text earn positive karma, even when their messages were deleted as spam. Calculate karma from each of the last ten received messages’ current snapshot verdict instead, honoring later corrections and counting each message once. Temporary user protection and ML training remain unchanged; no migration is required.

Adds regressions for cross-user text reuse, corrected-message karma, later spam verdicts, duplicate delivery, the ten-message window, and autoban after protection budget exhaustion. Existing consecutive-spam tests now send identical text with separate Telegram message IDs.

Validation: reproduced the regression against the original query. Final CI passed all 317 Vahter integration tests, 133 unit tests, 51 serialization compatibility tests, and 34 BotInfra tests; multipod and lint/security checks also passed. Local validation initially hit a Podman teardown conflict, then passed 316/317 and exposed a warning test reusing a message ID; that test was corrected before the successful final CI run. Commit hooks passed.

Read-only production EXPLAIN (ANALYZE, BUFFERS), warm-cache spot checks: old/new execution times were 1.388/0.117 ms for a spammer and 0.824/0.116 ms for an active user with 11,711 historical messages. Buffer accesses fell from 152 to 14 and 126 to 12. The new query uses the existing user/time index and scans 11 rows to return 10, with a 25 KB incremental sort for deterministic ties. These are spot measurements, not a load test.

@Szer
Szer merged commit 16835f4 into main Oct 11, 2026
8 checks passed
@Szer
Szer deleted the codex/vahter-message-karma branch October 11, 2026 19:15
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