Prevent duplicate Discord notifications for suspicious account registrations #1011
Labels
No labels
automated
code-quality
component: admin dashboard
component: backend
component: billing
component: content management
component: faqs
component: game genres
component: game lists
component: game reviews
component: game search
component: games
component: internal notifications
component: platforms
component: security
component: tests
component: user api
component: user badges
component: user blogs
component: user consoles
component: user favorites
component: user friends
component: user notifications
component: user profiles
component: user site notifications
component: user wishlists
component: web design
dependencies
javascript
php
priority
high
priority
low
priority
medium
security-hotspot
source: codex
source: sonarqube
status
awaiting feedback
status
backlog
status
done
status
in progress
status
in queue
status
in review
status
needs codex review
status
needs investigation
status
wontfix
type: bug
type: documentation
type: feature
type: improvement
type: regression
type: task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MyVideoGameList/myvideogamelist.com#1011
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Investigate the registration-to-Discord notification flow and make delivery idempotent so one suspicious account registration produces one notification.
Add regression coverage for the identified duplicate-dispatch path.
Scope
Acceptance Criteria
Test Coverage Required
Progress Checklist
Determine Why Multiple Discord Notifications Are Sent for Newly Registered Suspicious Accountsto Prevent duplicate Discord notifications for suspicious account registrationsImplemented and merged in PR #1019 (master merge commit
8f12bd45; implementation commit84dcc917).Suspicious-registration processing now locks the user row and reuses the existing security audit, preventing repeated handling from creating duplicate audits or jobs. Delivery locks and reloads the audit for each page, skips completed pages, and commits successful-page checkpoints separately so later failures resume correctly. Existing pagination, detection rules, payloads, mention suppression, and sanitized errors are preserved.
Concurrency review also reproduced a deadlock between distinct suspicious registrations. Database-only recording and registration transactions now retry up to three times. Turnstile verification and Fider provisioning are outside the retried transaction, alert dispatch remains after commit, and transactions containing Discord HTTP requests are never automatically retried.
Verification: all 134 focused tests passed on MariaDB 12.3 (1,435 assertions), including overlapping handlers/workers, independent registrations, deadlock recovery, synchronous delivery, and partial-page recovery. SQLite passed 129 tests with five MariaDB-only checks skipped. Pint, PHPStan, and diff checks passed. All four checklist items are complete.
One logical alert can span multiple Discord messages to preserve all matching-account details. Webhook acceptance followed by a lost response or worker crash remains an ambiguous delivery outcome; strict exactly-once delivery across that boundary is outside this fix's guarantee.
Deployment to development and production follows this closeout. No migrations, dependency changes, or frontend rebuilds are required.
Deployed merged PR #1019 (
8f12bd45) to development and production. Both release manifests now end in+pr1019-8f12bd45, and all three deployed runtime file SHA-256 checksums match the merged source.Deployment verified each target environment/database and baseline checksum, retained file/release-manifest rollback backups, restarted both database queue workers, and gracefully reloaded PHP 8.5 FPM. Unrelated application/configuration/assets were checksum-guarded. No migrations, dependency changes, frontend rebuilds, or account/domain-data writes were performed.
HTTPS verification passed for home, login, and registration on both sites (HTTP 200); registration still includes the Turnstile control. Live suspicious accounts/Discord alerts were not generated during smoke checks; delivery behavior is covered by the mocked regression/concurrency tests described above.
Rollback backups:
/home/mvgldev/deploy-backups/pr1019-8f12bd45-reizg7oc/home/mvgl/deploy-backups/pr1019-8f12bd45-2owmf8mcEach deployment account retains
~/deploy-staging/pr1019-8f12bd45/deploy.py. For rollback, run it as that account with--rollback <corresponding-backup-path>and the account's PHP bin directory on PATH; it restores the three original files and release manifest and restarts the queue. Gracefully reload PHP 8.5 FPM afterward and repeat the HTTPS checks.