Conversation
Resolving a local User for an email address -- creating the Clerk account and the linked User record if either is missing -- comes up in any flow that has an email before it has a user (an order, an API request, an invite). app/factories/clerk.py covers the dev/seed variant of this, but there was no general helper for application code. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GsmJFxRzjUGoXsVqEoPcYG
T04STER
force-pushed
the
feat/clerk-user-helpers
branch
from
September 8, 2026 09:22
d85cd83 to
facb870
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pulls up a small set of Clerk user helpers from a downstream project, as requested in review there.
app/helpers/clerk.pyadds three functions:clerk_user_exists(email)— whether a Clerk account already exists for an emailget_or_create_clerk_user(email, *, password=None)— the Clerk-side get-or-createget_or_create_user_from_email(email)— resolves a localUser, creating both the Clerk account and the linked record if either is missingResolving a local
Userfrom an email comes up in any flow that has an email before it has a user (an order, an API request, an invite), and it needs to be idempotent so it can be called repeatedly for the same address.app/factories/clerk.pyalready covers the dev/seed variant of this; this is the general one for application code.Both public entry points use the
get_or_create_prefix so the naming stays consistent across the module.No existing files are touched — it imports only
app.log,app.configuration.clerk.clerk, andapp.models.user.User, all of which the template already has.🤖 Generated with Claude Code
https://claude.ai/code/session_01GsmJFxRzjUGoXsVqEoPcYG