Files
karaoke-gen/backend/utils
Andrew Beveridge ☄️andClaude Opus 4.6 8e33c4b6aa Rework abuse investigation with cross-account correlations (#582)
## Summary
- **Fix** broken user profile link URL (was 404, now goes to correct
detail page)
- **Add** internal/test account filtering — excludes @nomadkaraoke.com,
@beveridge.uk, @inbox.testmail.app from all abuse views
- **New** Correlations tab (now default) showing fingerprint clusters
(RED flag) and IP clusters (ORANGE flag), with user agent matching
highlighted (YELLOW signal)
- **Demote** old "Suspicious Accounts" to secondary tab

## Motivation
The existing "Suspicious Accounts" view flagged too many false positives
— legitimate users who just used their 2 free credits, internal test
accounts, etc. The real abuse signal is **cross-account correlation**:
multiple accounts sharing the same device fingerprint or signup IP.

## Changes
| File | What |
|------|------|
| `backend/utils/test_data.py` | Add internal email domain filtering |
| `backend/services/user_service.py` | New
`find_account_correlations()`, filter suspicious accounts |
| `backend/api/routes/admin.py` | New `GET
/api/admin/abuse/correlations` endpoint |
| `frontend/lib/api.ts` | New types + API client method |
| `frontend/app/admin/abuse/page.tsx` | Fix link URL, new Correlations
tab, restructure tabs |
| `backend/tests/test_anti_abuse_investigation.py` | 10 new tests |

## Test plan
- [x] 27 anti-abuse investigation tests pass (10 new)
- [x] 2749 backend tests pass
- [x] Frontend dev server starts without errors
- [ ] Manual: verify correlations tab shows real data in prod

@coderabbitai ignore

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 16:40:07 -04:00
..