ref(auth): remove unused code - #121268
Open
nora-shap wants to merge 1 commit into
Open
Conversation
Member
Author
|
bugbot run |
Contributor
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 704513e. Configure here.
Member
Author
|
@sentry review |
nora-shap
marked this pull request as ready for review
August 4, 2026 23:41
michelletran-sentry
approved these changes
Aug 5, 2026
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.
TL;DR
The
ConfirmEmailpipeline view contains a returning-user "email override" and an "enter your email" form (ConfirmEmailForm). Both are vestigial.The
ConfirmEmailform began as "let users type an email when GitHub gives none" idea (2015-07), but the/user/emailsfallback (2015-09) covered that case before the form even shipped (2015-10). What remained was a returning-user override that (a) never persisted and (b) fed a login path that ignores the email. It has been effectively inert for its entire ~11-year life, which is why nobody noticed: returning users are matched by GitHub id, so the email value never mattered.Net: this code does not do the thing its shape implies. Removing the override and the form changes no real behavior. This document traces exactly how it got here.
What the code looks like today
Why it doesn't do what it looks like
FetchUseralready guarantees an email. The SSO pipeline steps are [OAuth2Login,OAuth2Callback,FetchUser,ConfirmEmail]. The preceding step,FetchUser, returnspipeline.error(...)if it finds 0 or >1 primary emails. So by the timeConfirmEmailruns,user["email"]is never empty.The override is not persisted. The
elsebranch mutates the local copy but never callsbind_state, so the write never reaches Redis. The next reader (build_identityviafinish_pipeline) re-reads the originalFetchUseremail from the pipeline state.Even then, the collected email is discarded. A returning user resolves to
AuthIdentityHandler.handle_existing_identity, which updates and logs inauth_identity.userby id. It never readsidentity["email"]or writesuser.email. So the form throws awayFetchUser's valid GitHub email, prompts for a replacement, and then that replacement goes nowhere.How we got here (archaeology)
All original logic predates the sentry monorepo — it was authored in the now-archived
getsentry/sentry-auth-githubplugin.a454f012015-07-20 — Initial commit.FetchUserbinds user data; no email logic, noConfirmEmail.28c885c2015-09-20 — "handling hidden emails." Adds the/user/emailsprimary-email fallback toFetchUser. From here on,FetchUseryields an email or hard-errors.0e8b6042015-10-15 — "Handle hidden email addresses / Cleanup forms" IntroducesConfirmEmailexactly as it exists today. Because the/user/emailsfallback had shipped 3 weeks earlier, the form was only reachable via the blank-email-returning-user edge, and the override was a non-persisting local mutation.Why removal is safe
FetchUserguarantees an email or errors). Unaffected.handle_existing_identity; identity email ignored. Without the override they keepFetchUser's GitHub email (still ignored) and log in identically.User.email: today they're shown a pointless form whose result is discarded; after removal they simply log in by id. Strictly no worse.handle_unknown_identity): removal is actually better — resolution usesFetchUser's real GitHub email instead of a form-typed one.