| name | supabase-test-harness |
| description | Supabase test harness patterns including local Supabase setup, test user creation via Auth Admin API, RLS testing, migration testing (db_reset), seed sequences, rate limiting, and environment detection. Use when setting up Supabase testing infrastructure, creating test users, troubleshooting Supabase test failures, or implementing RLS validation. Triggers on: supabase test setup, test user creation, supabase local testing, RLS testing, migration testing, supabase test harness, auth test helpers. |
supabase-test-harness
SUPABASE_TEST_MASTERY::[LOCAL_SETUP+AUTH_ADMIN_API+RLS_VALIDATION+MIGRATION_TESTING+SEED_SEQUENCES]→PRODUCTION_READY
PRIMARY_SOURCE[MANDATORY_FIRST]
SOURCE::.coord/test-context/RULES.md
PRINCIPLE::"POC-proven pattern post-it note - ALWAYS consult BEFORE infrastructure decisions"
CONTAINS::[
supabase_setup[local_env],
test_users[standardized_credentials],
migration_testing[supabase_db_reset],
fail_fast_guards
]
DETAILED_DOCUMENTATION
SUPABASE_HARNESS::.coord/test-context/SUPABASE-TEST-HARNESS.md→[local_setup[docker/cli], test_user_creation[auth_admin_api], RLS_testing, seed_procedures, preview_branch_integration, env_config]
POC_REFERENCE[WHEN_NEEDED]
PROVEN_INFRASTRUCTURE::/Volumes/HestAI-Projects/eav-ops/eav-apps/scripts-web/src/test/
FILES::[
supabase-test-client.ts::"Test client with environment detection, fail-fast guards",
auth-helpers.ts::"Auth utilities with rate limiting (750ms delay)"
]
OPERATIONAL_SCRIPTS::/Volumes/HestAI-Projects/eav-ops/eav-apps/scripts-web/scripts/
FILES::[
create-test-users-via-api.mjs::"Test user creation via Auth Admin API (used by CI)"
]
CRITICAL_PATTERNS[POC_PROVEN]
PATTERN_1::MIGRATION_TESTING::[
USE::supabase_db_reset_local[NOT_db_push],
BECAUSE::"EMERGENCY FIX 2025-10-26 - db push fails with complex trigger functions",
EVIDENCE::POC_ci.yml:105
]
PATTERN_2::TEST_USER_CREATION::[
METHOD::auth_admin_api_via_scripts/create-test-users-via-api.mjs[NOT_SQL],
BECAUSE::"Ensures proper GoTrue internal state (auth.users + auth.identities)",
EVIDENCE::[POC_ci.yml:144-161, POC_scripts/create-test-users-via-api.mjs]
]