Skip to content

Provision app user rows on signup - #2

Closed
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-correctness-bugs-11c5
Closed

Provision app user rows on signup#2
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-correctness-bugs-11c5

Conversation

@cursor

@cursor cursor Bot commented May 15, 2026

Copy link
Copy Markdown

Bug and impact

New signups created a Supabase Auth identity but did not create the corresponding users row in the application database. Any subsequent authenticated profile or write flow using that Supabase user id could return USER_NOT_FOUND or fail FK-backed writes such as meal logs.

Root cause

AuthService.signUp returned tokens after Supabase signup and started ML training, but never persisted the app user row required by downstream Prisma relations.

Fix

Upsert the users row during signup using the Supabase user id, email, and display name before returning success or starting post-signup ML training.

Validation

  • pnpm --filter @snacktrack/backend test -- auth.test.ts passes.
  • DATABASE_URL=postgresql://localhost:5432/snacktrack_test DIRECT_URL=postgresql://localhost:5432/snacktrack_test pnpm --filter @snacktrack/backend build passes.
  • Full backend tests were run after building shared types and generating Prisma; 47/48 tests passed, with the existing health test failing because ML health is not mocked and no local ML service is running.
Open in Web View Automation 

Co-authored-by: Vasanth Panuganti <vpanuga2@asu.edu>
@vasanthpanuganti
vasanthpanuganti deleted the cursor/critical-correctness-bugs-11c5 branch June 11, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants