mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-12-02 18:08:07 +09:00
## Summary - Filter out E2E test data from admin dashboard by default (emails ending in `@inbox.testmail.app`) - Add "Show test data" toggle in admin header that persists to localStorage - Add `exclude_test` query parameter to all admin list/stats endpoints (defaults to `true`) - Add streaming limits with warnings to prevent memory issues on large datasets ## Changes **Backend:** - New `backend/utils/test_data.py` with `is_test_email()` utility - Updated admin stats endpoint with test data filtering - Updated users list, jobs list, beta stats, and audio searches endpoints - Added USERS_STREAM_LIMIT (2000) and JOBS_STREAM_LIMIT (10000) with warning logs **Frontend:** - New `frontend/lib/admin-settings.ts` zustand store for admin preferences - Toggle switch in admin layout header - All admin pages pass `exclude_test: !showTestData` to API calls **Docs:** - Updated API.md with exclude_test parameter documentation ## Test Plan - [x] Backend tests pass (68 passed) - [x] Frontend tests pass (128 passed) - [x] Frontend build succeeds - [x] CodeRabbit review passed - [ ] Manual: Visit `/admin` - stats should show lower numbers by default - [ ] Manual: Toggle "Show test data" ON - counts should increase - [ ] Manual: Toggle persists across page refreshes <!-- @coderabbitai ignore --> 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <noreply@anthropic.com>
28 lines
713 B
Python
28 lines
713 B
Python
"""
|
|
Utilities for identifying test data.
|
|
|
|
Test data is generated by automated E2E tests and should be filterable
|
|
in admin dashboards to show only real user data by default.
|
|
"""
|
|
|
|
# Email domains used by automated testing frameworks
|
|
TEST_EMAIL_DOMAINS = [
|
|
"inbox.testmail.app", # Used by E2E happy path tests
|
|
]
|
|
|
|
|
|
def is_test_email(email: str) -> bool:
|
|
"""
|
|
Check if an email address belongs to automated test data.
|
|
|
|
Args:
|
|
email: Email address to check
|
|
|
|
Returns:
|
|
True if the email matches a test email domain pattern
|
|
"""
|
|
if not email:
|
|
return False
|
|
email_lower = email.lower()
|
|
return any(email_lower.endswith(f"@{domain}") for domain in TEST_EMAIL_DOMAINS)
|