Date: 2026-01-20Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Purpose: Guide for cleaning up test users from production and verifying staging environment
Overview
This guide covers:- Removing test users from production - Safe cleanup procedures
- Checking staging status - Verification of staging environment
- Testing strategy - Whether tests should run in staging
Part 1: Clean Up Test Users from Production
⚠️ Important Warnings
- Test users should NOT exist in production - Only real user signups belong there
- Deletion is permanent - Always run dry-run first
- Verify environment - Double-check you’re connected to production before deleting
- Backup first - Consider exporting user data before deletion (if needed)
Step 1: Identify Test Users (Dry-Run)
Before deleting anything, identify what will be deleted:- Lists all test users that match patterns
- Shows breakdown by type (E2E, RLS, debug, etc.)
- Shows recent test users
- No users are deleted in dry-run mode
Step 2: Verify Environment
Double-check you’re connected to production:Step 3: Preview Deletion
See what would be deleted without actually deleting:- Total test users found
- Breakdown by type
- Recent test users
- No deletion occurs - you must add
--confirmto actually delete
Step 4: Delete Test Users (Production Only)
⚠️ ONLY run this in production after verifying the preview:- Script shows 5-second warning
- Identifies all test users matching patterns:
%test%- Contains “test”%example%- Contains “example”e2e-%- E2E test usersrls-%- RLS test users%debug%- Debug users%staging%- Staging seed users
- Deletes users in batches (10 at a time)
- Shows progress and final count
- Test users are permanently removed
- Associated profiles may be cleaned up by triggers
- Production should only have real user signups
Part 2: Check Staging Status
Verify Staging Environment
Check staging database status:- ✅ Database Connection - Can connect to staging
- ✅ Test Users Count - Test users present (expected in staging)
- ✅ Seed Data - Seed organizations and users exist
- ✅ Environment Isolation - No production data leaked
- ✅ Connection successful
- ✅ Test users found (this is expected in staging)
- ✅ Seed data present (organizations with
00000000-prefix) - ✅ No production data detected
Manual Staging Verification
Check staging via Supabase Dashboard:-
Go to Supabase Dashboard:
- Navigate to staging project:
bcuftbeczbudndukafbc - Or switch to staging branch if using branching
- Navigate to staging project:
-
Verify Test Data:
-
Verify Isolation:
Part 3: Should Tests Run in Staging?
Current Testing Strategy
Current Setup:- Tests run in GitHub Actions CI/CD
- Uses production Supabase project (configured via environment variables)
- RLS tests require service role key (bypasses RLS)
- Tests create temporary test users during runs
Recommendation: Use Staging for Tests
✅ YES - Tests should run in staging, not production Reasons:- Data Isolation - Test users won’t pollute production
- Safety - No risk of affecting real users
- Seed Data - Staging has predictable test data
- Performance - Staging can handle test load without affecting production
- Cleanup - Test users in staging are expected and acceptable
How to Configure Tests for Staging
Option 1: Use Staging Secrets in GitHub Actions Update.github/workflows/tests.yml:
Test User Cleanup in Staging
Staging test users are expected and acceptable:- Test users created during CI/CD runs are normal
- Periodic cleanup (30+ days old) is optional
- Seed data users should remain
Summary
Production
- ✅ Remove all test users - Use cleanup script
- ✅ Only real user signups - No test data
- ✅ Regular cleanup - Monitor for accidental test users
Staging
- ✅ Test users are expected - Normal and acceptable
- ✅ Seed data should exist - For UAT testing
- ✅ Use for CI/CD tests - Recommended over production
- ⚠️ Optional cleanup - Only very old test users (30+ days)
Testing Strategy
- ✅ Run tests in staging - Not production
- ✅ Use staging secrets - Separate from production
- ✅ Test users in staging - Expected and acceptable
- ❌ No test users in production - Clean up immediately
Related Documentation
- User Management Guide:
docs/development/USER_MANAGEMENT_AND_CLEANUP.md - Testing Guide:
docs/testing/TESTING_SETUP_AND_RUN.md - Staging Setup:
docs/development/SUPABASE_MULTI_ENV_SETUP.md - Verification Guide:
docs/development/VERIFICATION_TESTING_GUIDE.md