Skip to content

Conversation

@codeunia-dev
Copy link
Owner

@codeunia-dev codeunia-dev commented Sep 15, 2025

  • Replace create_oauth_profile RPC calls with profileService.getProfile() in auth callback
  • Ensure consistent profile creation across OAuth flow and complete-profile page
  • Maintain auto ID generation (CodeUnia ID and username generation)
  • Fix rollback mechanism to use same approach as complete-profile page
  • Remove dependency on potentially missing create_oauth_profile RPC function
  • Add proper error handling for profile creation failures
  • Ensure graceful fallback to complete-profile page on any errors

This ensures the rollback mechanism works consistently and uses the same profileService approach that handles auto ID generation properly.

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of account setup during OAuth sign-in. Users are now consistently guided to Complete Profile when needed, reducing edge-case failures on first login and ensuring a smoother onboarding experience.
  • Chores
    • Removed the environment variable template file from the repository.

- Replace create_oauth_profile RPC calls with profileService.getProfile() in auth callback
- Ensure consistent profile creation across OAuth flow and complete-profile page
- Maintain auto ID generation (CodeUnia ID and username generation)
- Fix rollback mechanism to use same approach as complete-profile page
- Remove dependency on potentially missing create_oauth_profile RPC function
- Add proper error handling for profile creation failures
- Ensure graceful fallback to complete-profile page on any errors

This ensures the rollback mechanism works consistently and uses the same
profileService approach that handles auto ID generation properly.
@vercel
Copy link

vercel bot commented Sep 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
codeunia Ready Ready Preview Comment Sep 15, 2025 5:18am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 15, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Removes the .env.example template file. Updates app/auth/callback/page.tsx to replace direct RPC-based profile creation with a service-based profileService.getProfile check across all OAuth flow branches, preserving existing redirect logic to /complete-profile and logging behavior.

Changes

Cohort / File(s) Change Summary
Auth callback flow
app/auth/callback/page.tsx
Replaced RPC-based profile creation/check with profileService.getProfile(userId) across initial/retry/final branches; added service import; retained redirect to /complete-profile on missing profile; added/updated console logs; no public API changes.
Template removal
.env.example
Deleted environment variables template file; no runtime or API changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant R as Next.js Route<br/>/auth/callback
  participant A as Supabase Auth
  participant P as profileService
  participant Nav as Router

  U->>R: Hit OAuth callback
  R->>A: Retrieve session/user
  alt Session present
    R->>P: getProfile(userId)
    alt Profile exists
      R->>Nav: Redirect based on completeness
    else Profile missing or error
      Note right of R: Log outcome/error
      R->>Nav: Redirect to /complete-profile
    end
  else No session
    R->>A: Retry session retrieval
    alt Session obtained
      R->>P: getProfile(userId)
      alt Profile exists
        R->>Nav: Redirect based on completeness
      else Missing/error
        R->>Nav: Redirect to /complete-profile
      end
    else Final attempt
      R->>Nav: Redirect to /login
    end
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

A hop, a bop, through auth we glide,
Profiles checked by service-side.
The env file’s gone—less clutter to see,
Yet flows still bound for /complete-profile, whee!
Thump-thump logs, then onward we go—
Ears up high for the redirect show. 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/oauth-profile-completion

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b0a651a and 6db17d6.

📒 Files selected for processing (2)
  • .env.example (0 hunks)
  • app/auth/callback/page.tsx (4 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeunia-dev codeunia-dev merged commit ad5e59b into main Sep 15, 2025
3 of 4 checks passed
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