|
| 1 | +# PR_26166_165-auth-test-user-cleanup |
| 2 | + |
| 3 | +## Branch Validation |
| 4 | + |
| 5 | +PASS |
| 6 | + |
| 7 | +- Current branch: `main` |
| 8 | +- Expected branch: `main` |
| 9 | +- Local branches found: `main` |
| 10 | +- `docs_build/dev/PROJECT_INSTRUCTIONS.md` read before execution. |
| 11 | + |
| 12 | +## Scope Summary |
| 13 | + |
| 14 | +PASS |
| 15 | + |
| 16 | +- Added DEV-only Supabase Auth test-account cleanup. |
| 17 | +- Cleanup is limited to Supabase-auth users whose email matches `codex-*` or `playwright-*` at `example.test`. |
| 18 | +- Cleanup deletes Supabase Auth users, matching `users` rows, and matching `user_roles` rows. |
| 19 | +- Added explicit audit-reference reassignment guard for shared account rows that still reference a test user as `createdBy` or `updatedBy`. |
| 20 | +- Added reusable cleanup script: `npm run cleanup:supabase-dev-auth-test-users`. |
| 21 | +- No UAT or PROD enablement was added. |
| 22 | +- No product-data provider cutover was added; product data remains Local DB. |
| 23 | +- No password tables were added. |
| 24 | +- No browser-owned auth/provider logic was added. |
| 25 | +- No silent fallback was added. |
| 26 | +- No `.env.local` or secret values were changed or committed. |
| 27 | + |
| 28 | +## Requirement Checklist |
| 29 | + |
| 30 | +- PASS - Treat PR_165 as one separate BUILD unit only. |
| 31 | +- PASS - Main branch only; current branch was `main`. |
| 32 | +- PASS - Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` before work. |
| 33 | +- PASS - Add DEV-only auth test user cleanup. |
| 34 | +- PASS - Delete Supabase Auth user, `users` row, and `user_roles` rows for matching test accounts only. |
| 35 | +- PASS - Add reusable DEV cleanup pattern for later PRs. |
| 36 | +- PASS - No UAT/PROD enablement. |
| 37 | +- PASS - Do not commit secrets or `.env.local`. |
| 38 | +- PASS - Clean up Codex-created test data before packaging. |
| 39 | +- PASS - Run `npm run validate:supabase-dev`. |
| 40 | +- PASS - Run targeted auth/session validation. |
| 41 | +- PASS - Playwright impacted: targeted auth/session Playwright run completed. |
| 42 | +- PASS - Do not run full samples smoke. |
| 43 | +- PASS - Create `codex_review.diff`, `codex_changed_files.txt`, PR-specific report, validation notes, and cleanup report. |
| 44 | + |
| 45 | +## Validation Lane Report |
| 46 | + |
| 47 | +Executed lanes: |
| 48 | + |
| 49 | +- contract: `node --check` for changed runtime/script/test files. |
| 50 | +- contract: `node --test tests/dev-runtime/SupabaseDevAuthTestUserCleanup.test.mjs` |
| 51 | +- contract: `node --test tests/dev-runtime/SupabaseProviderContractStub.test.mjs` |
| 52 | +- integration/runtime: `npm run validate:supabase-dev` |
| 53 | +- targeted Playwright auth/session: `npx playwright test tests/playwright/account/SupabaseSignInSession.spec.mjs --project=playwright --workers=1 --reporter=list` |
| 54 | +- cleanup/live DEV: dry-run, delete with explicit audit user, final dry-run confirmation. |
| 55 | + |
| 56 | +Skipped lanes: |
| 57 | + |
| 58 | +- Full samples smoke: SKIP by request and no samples were in scope. |
| 59 | +- Admin DB Viewer validation: SKIP for PR_165 because no Admin DB Viewer behavior changed. |
| 60 | +- Targeted provider/API validation for migrated product areas: SKIP for PR_165 because no product areas were migrated. |
| 61 | +- `npm run test:workspace-v2`: SKIP because no Project Workspace, toolState, or workspace runtime behavior changed. The command name is legacy; user-facing language remains Project Workspace. |
| 62 | + |
| 63 | +## Validation Results |
| 64 | + |
| 65 | +- PASS - `node --check src/dev-runtime/auth/provider-contract-stubs.mjs` |
| 66 | +- PASS - `node --check src/dev-runtime/testing/supabase-dev-auth-test-user-cleanup.mjs` |
| 67 | +- PASS - `node --check scripts/cleanup-supabase-dev-auth-test-users.mjs` |
| 68 | +- PASS - `node --check tests/dev-runtime/SupabaseDevAuthTestUserCleanup.test.mjs` |
| 69 | +- PASS - `node --test tests/dev-runtime/SupabaseDevAuthTestUserCleanup.test.mjs` (5 tests passed) |
| 70 | +- PASS - `node --test tests/dev-runtime/SupabaseProviderContractStub.test.mjs` (29 tests passed) |
| 71 | +- PASS - `npm run validate:supabase-dev` (overall PASS; DEV direct PostgreSQL TLS warning remains advisory: `SELF_SIGNED_CERT_IN_CHAIN`) |
| 72 | +- PASS - `npx playwright test tests/playwright/account/SupabaseSignInSession.spec.mjs --project=playwright --workers=1 --reporter=list` (1 test passed) |
| 73 | +- PASS - `npm run cleanup:supabase-dev-auth-test-users -- --dry-run --json` after cleanup confirmed zero candidates. |
| 74 | + |
| 75 | +## Manual Validation Notes |
| 76 | + |
| 77 | +- Confirmed live DEV cleanup dry-run found seven matching Supabase-auth test accounts and one shared account audit dependency. |
| 78 | +- Confirmed delete mode required an explicit surviving non-test DEV audit user key before reassignment. |
| 79 | +- Confirmed delete mode removed seven matching test `users` rows and six matching `user_roles` rows. |
| 80 | +- Confirmed one older candidate had an already-missing Supabase Auth account; cleanup reported `authUserNotFound=true` and still removed the matching `users` row after audit reassignment. |
| 81 | +- Confirmed the final dry-run returned `testDataCandidates: 0`. |
| 82 | +- Confirmed skipped non-test users were not deleted. |
| 83 | +- Confirmed targeted Playwright sign-in still resolves Supabase-backed auth/session through the local API with `GAMEFOUNDRY_DB_PROVIDER=local-db`. |
| 84 | + |
| 85 | +## Playwright V8 Coverage |
| 86 | + |
| 87 | +- Report: `docs_build/dev/reports/playwright_v8_coverage_report.txt` |
| 88 | +- Guardrail: `docs_build/dev/reports/coverage_changed_js_guardrail.txt` |
| 89 | +- Runtime JS changes were server/dev-runtime oriented and were not collected by browser V8 coverage; missing changed runtime JS coverage is WARN/advisory per project instructions. |
| 90 | + |
| 91 | +## Required Artifacts |
| 92 | + |
| 93 | +- `docs_build/dev/reports/PR_26166_165-auth-test-user-cleanup_report.md` |
| 94 | +- `docs_build/dev/reports/PR_26166_165-auth-test-user-cleanup_cleanup_report.md` |
| 95 | +- `docs_build/dev/reports/codex_review.diff` |
| 96 | +- `docs_build/dev/reports/codex_changed_files.txt` |
| 97 | +- `tmp/PR_26166_165-auth-test-user-cleanup_delta.zip` |
0 commit comments