Skip to content

Commit b1ebe9d

Browse files
committed
Cut over users roles and user_roles to auth provider identity contract - PR_26166_145-supabase-users-roles-cutover
1 parent 7b026f1 commit b1ebe9d

37 files changed

Lines changed: 2034 additions & 646 deletions
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# PR_26166_145-supabase-users-roles-cutover
2+
3+
## Branch Validation
4+
- PASS: current branch `main`.
5+
- Expected branch: `main`.
6+
7+
## Requirement Checklist
8+
- PASS: Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` before changes.
9+
- PASS: Browser continues to use backend API routes only; no browser Supabase/local-db switching was added.
10+
- PASS: Identity ownership is explicit in the provider contract for `users`, `roles`, and `user_roles` through `identityOwnership`.
11+
- PASS: Supabase Auth selected path reads identity rows server-side while `GAMEFOUNDRY_DB_PROVIDER=local-db` keeps product data on Local DB.
12+
- PASS: No games/assets/objects/controls/palettes/tags/workspace/tool metadata/product tables were migrated.
13+
- PASS: DEV static ULID exception remains documented for User 1, User 2, User 3, and DavidQ admin only.
14+
- PASS: Ownership fields are declared for identity records: `key`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`.
15+
- PASS: `users.key` remains the authoritative ownership reference.
16+
- PASS: No browser-generated authoritative keys were added.
17+
- PASS: No password tables or local password storage were added.
18+
- PASS: No secrets or `.env` files were added.
19+
- PASS: No silent fallback was added; selected providers are authoritative and missing identity/role rows fail visibly.
20+
21+
## Implementation Summary
22+
- `src/dev-runtime/auth/provider-contract-stubs.mjs`: added `identityOwnership` contract fields describing auth-owned identity tables, owner provider, reader provider, product DB provider, ownership fields, static DEV user exception, and no browser-owned keys.
23+
- `src/dev-runtime/server/local-api-router.mjs`: added provider-aware async session helpers for Supabase Auth selected with Local DB product data; session routes now resolve identity through server-side Supabase identity table reads.
24+
- `tests/dev-runtime/SupabaseProviderContractStub.test.mjs`: added coverage for identity ownership contract, Supabase selected identity lookup, role lookup, user_roles lookup, missing-user diagnostics, and missing-role diagnostics.
25+
26+
## Validation Lane Report
27+
- PASS: changed-file syntax checks:
28+
- `node --check src/dev-runtime/auth/provider-contract-stubs.mjs`
29+
- `node --check src/dev-runtime/server/local-api-router.mjs`
30+
- `node --check tests/dev-runtime/SupabaseProviderContractStub.test.mjs`
31+
- PASS: targeted auth identity validation:
32+
- `node --test tests/dev-runtime/SupabaseProviderContractStub.test.mjs`
33+
- Result: 21 passed.
34+
- PASS: Supabase selected path with Local DB product data:
35+
- Test env used `GAMEFOUNDRY_AUTH_PROVIDER=supabase-auth` and `GAMEFOUNDRY_DB_PROVIDER=local-db` against a fake Supabase service.
36+
- Validated `users`, `roles`, and `user_roles` REST reads through server-side provider contract.
37+
- PASS: missing-user visible failure:
38+
- `POST /api/session/user` with a missing user key returns an unauthenticated session with actionable diagnostic.
39+
- PASS: missing-role visible failure:
40+
- `POST /api/session/user` with `user_roles.roleKey` pointing to a missing role returns an unauthenticated session with actionable diagnostic.
41+
- PASS: workspace-v2 validation:
42+
- `npm run test:workspace-v2`
43+
- Result: 5 Playwright tests passed.
44+
- PASS: diff guardrail:
45+
- `git diff --check`
46+
- Result: no whitespace errors; line-ending warnings only.
47+
48+
## Playwright / V8 Coverage
49+
- Playwright impacted: Yes.
50+
- PASS: `npm run test:workspace-v2` passed.
51+
- PASS: `docs_build/dev/reports/playwright_v8_coverage_report.txt` generated for changed runtime JavaScript files using targeted Node V8 coverage from auth identity tests.
52+
53+
## Impacted Lanes
54+
- Auth/session provider contract lane.
55+
- Local API session route lane.
56+
- Workspace-v2 Playwright validation lane because runtime auth/session behavior changed.
57+
58+
## Skipped Lanes
59+
- Samples smoke: SKIP. This PR changes auth/session provider contracts only and does not alter sample runtime behavior.
60+
- Full product DB migration validation: SKIP. Requirement explicitly keeps non-auth product data on Local DB and forbids product table migration.
61+
62+
## Manual Validation Notes
63+
- Start dev server with `GAMEFOUNDRY_AUTH_PROVIDER=supabase-auth` and `GAMEFOUNDRY_DB_PROVIDER=local-db`.
64+
- Ensure Supabase URL, anon key, and service-role key are present in local environment only.
65+
- Call `/api/providers/contract` and verify `identityOwnership.ownerProviderId=supabase-auth`, `readerProviderId=supabase-postgres`, and `productDatabaseProviderId=local-db`.
66+
- Call `/api/session/users` and verify identity users resolve through server API.
67+
- Call `/api/session/user` with a valid seeded DEV user key and verify role slugs resolve from `user_roles` and `roles`.
68+
- Call `/api/local-db/snapshot` and verify product tables remain Local DB-backed.
69+
70+
## Changed Files
71+
See `docs_build/dev/reports/codex_changed_files.txt` for the generated changed-file list.
Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,37 @@
1-
# git status --short (excluding .env files)
2-
M .gitignore
3-
M docs_build/dev/reports/codex_changed_files.txt
4-
M docs_build/dev/reports/codex_review.diff
5-
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
6-
M docs_build/dev/reports/playwright_v8_coverage_report.txt
7-
M src/dev-runtime/server/local-api-router.mjs
8-
M tests/dev-runtime/SupabaseProviderContractStub.test.mjs
9-
?? docs_build/dev/reports/PR_26166_144-supabase-auth-preflight-selection-fix.md
10-
?? docs_build/dev/reports/supabase-preflight-report.md
11-
12-
# git ls-files --others --exclude-standard (excluding .env files)
13-
docs_build/dev/reports/PR_26166_144-supabase-auth-preflight-selection-fix.md
14-
docs_build/dev/reports/supabase-preflight-report.md
15-
16-
# git diff --stat (excluding .env files and review artifacts)
17-
.gitignore | 2 +
18-
.../dev/reports/coverage_changed_js_guardrail.txt | 1 -
19-
.../dev/reports/playwright_v8_coverage_report.txt | 2 -
20-
src/dev-runtime/server/local-api-router.mjs | 95 +++++++++++++++-
21-
.../SupabaseProviderContractStub.test.mjs | 125 ++++++++++++++++++++-
22-
5 files changed, 219 insertions(+), 6 deletions(-)
1+
docs_build/dev/reports/codex_changed_files.txt
2+
docs_build/dev/reports/codex_review.diff
3+
docs_build/dev/reports/coverage_changed_js_guardrail.txt
4+
docs_build/dev/reports/dependency_gating_report.md
5+
docs_build/dev/reports/dependency_hydration_reuse_report.md
6+
docs_build/dev/reports/execution_graph_reuse_report.md
7+
docs_build/dev/reports/failure_fingerprint_report.md
8+
docs_build/dev/reports/filesystem_scan_reduction_report.md
9+
docs_build/dev/reports/incremental_validation_report.md
10+
docs_build/dev/reports/lane_compilation_report.md
11+
docs_build/dev/reports/lane_deduplication_report.md
12+
docs_build/dev/reports/lane_input_validation_report.md
13+
docs_build/dev/reports/lane_manifests/workspace-contract.json
14+
docs_build/dev/reports/lane_runtime_optimization_report.md
15+
docs_build/dev/reports/lane_snapshot_report.md
16+
docs_build/dev/reports/lane_snapshots/workspace-contract.json
17+
docs_build/dev/reports/lane_warm_start_report.md
18+
docs_build/dev/reports/lane_warm_starts/workspace-contract.json
19+
docs_build/dev/reports/monolith_trigger_removal_report.md
20+
docs_build/dev/reports/persistent_lane_manifest_report.md
21+
docs_build/dev/reports/playwright_discovery_ownership_report.md
22+
docs_build/dev/reports/playwright_discovery_scope_report.md
23+
docs_build/dev/reports/playwright_structure_audit.md
24+
docs_build/dev/reports/playwright_v8_coverage_report.txt
25+
docs_build/dev/reports/PR_26166_145-supabase-users-roles-cutover.md
26+
docs_build/dev/reports/retry_suppression_report.md
27+
docs_build/dev/reports/slow_path_pruning_report.md
28+
docs_build/dev/reports/static_validation_report.md
29+
docs_build/dev/reports/targeted_file_manifest_report.md
30+
docs_build/dev/reports/test_cleanup_performance_report.md
31+
docs_build/dev/reports/test_cleanup_routing_report.md
32+
docs_build/dev/reports/testing_lane_execution_report.md
33+
docs_build/dev/reports/validation_cache_report.md
34+
docs_build/dev/reports/zero_browser_preflight_report.md
35+
src/dev-runtime/auth/provider-contract-stubs.mjs
36+
src/dev-runtime/server/local-api-router.mjs
37+
tests/dev-runtime/SupabaseProviderContractStub.test.mjs

0 commit comments

Comments
 (0)