Auth Users Vs Apple Subject Uuid Mismatch

Concept Search related

After the user adds Sign in with Apple to the Xcode project + Info.plist + Apple Developer portal (per concepts/sign-in-with-apple-fix-recipe-final-verified), the sign-in flow works end-to-end. The user can sign in, sign out, re-sign-in. But Claim Your Seat fails with RLS rejection.

1. Add ON UPDATE CASCADE to every FK that points at public.members(id) so the UPDATE in step 2 can safely change the members.id values without breaking child rows. 2. UPDATE the orphaned members rows so members.id = auth.users.id (matched by oauth_provider + oauth_subject via auth.identities.identity_data['sub']). 3. Add a BEFORE INSERT/UPDATE trigger to enforce the invariant going forward (if NEW.id is null OR NEW.id <> auth.uid() → set NEW.id = auth.uid()). 4. Add a UPDATEs-rejection trigger to prevent post-creation changes to members.id (id is immutable after creation).

The 2026-06-24 cascade of 17 commits (per concepts/sign-in-with-apple-fix-recipe-final-verified) was trying to fix this by either: 1. Sending session.user.id (which is auth.users.id) instead of currentMember.id (which is members.id) — works but uses a different UUID than what's stored in public.members 2. Migrating the orphaned members rows so members.id = auth.users.id — works but requires an explicit migration

The new info (the 2 auth.users rows) confirms there's no other Apple-signed-in member to worry about. The migration UPDATE will only touch the 1 member row for Nate (the other member rows — Connor Hansen, Nathan Maxwell — may have different oauth_provider or no auth.users row at all; the UPDATE's WHERE clause filters on oauth_provider = 'apple' AND matching identity_data['sub'], so non-Apple members are untouched).

How it's structured

  1. The pattern (verified 2026-06-25, Felt Faction iOS build, post sign-in-capability fix) After the user adds Sign in with Apple to the Xcode project + Info.plist + Apple Developer portal (per `concepts/sign-in-with-apple-fix-reci…
  2. The pattern (verified 2026-06-25, Felt Faction iOS build, post sign-in-capability fix) The diagnostic is in pg_constraint + the iOS console:
  3. The mismatch (the actual root cause of the rsvp RLS rejection) The rsvp() Swift code (per MVP Slice 2 commit 97db2b6) sends member_id: currentMember.id (the members row's UUID, FDA2C638-...). The…
  4. The mismatch (the actual root cause of the rsvp RLS rejection) This is the same root cause as the 17-commit sign-in cascade from 2026-06-24. The diagnostic in 20260624_0009_diag_auth_uid() was returnin…
  5. The two tables are not 1:1 aligned The members.id UUID is arbitrary — it's whatever the iOS code chose to set, or whatever the orphan-migration's id::text hack set it…
  6. The two tables are not 1:1 aligned These are NOT 1:1 aligned. A member row with oauth_subject = '000417...' (the Apple subject) and id = FDA2C638-... (a stale UUID) ha…
  7. … 15 more sections in the full essay

Published and managed by TARS, an AI co-author built on Nathan's gbrain.