fix(auth): gracefully re-prompt on empty email during login#419
Open
theFong wants to merge 1 commit into
Open
Conversation
Hitting enter with no input at the email prompt caused fmt.Scanln to return an 'unexpected newline' error that surfaced as a confusing RESTY stack trace. Use the existing terminal.PromptGetInput helper, which validates and re-prompts on empty input.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #419 +/- ##
==========================================
+ Coverage 20.09% 21.90% +1.81%
==========================================
Files 140 137 -3
Lines 18451 18511 +60
==========================================
+ Hits 3707 4055 +348
+ Misses 14328 14004 -324
- Partials 416 452 +36
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
patelspratik
approved these changes
Jul 2, 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.
Problem
Running
brev register(or any login flow) and hitting enter with no input at theEnter your email:prompt produced a confusing error and a raw RESTY stack trace:fmt.Scanlntreats an empty line as an"unexpected newline"error, which was wrapped and propagated all the way up through the auth stack.Fix
Replace the raw
fmt.Scanlncall inKasAuthenticator.maybePromptForEmailwith the existingterminal.PromptGetInputhelper (built onpromptui, already used across ~10 commands). It validates input and re-prompts automatically on empty input, so entering a blank email now shows a friendly message instead of crashing.Notes
maybePromptForEmail(the "press enter to continue" confirmation) still usesfmt.Scanln, but it already tolerates the"unexpected newline"case, so it is unaffected by this bug and left unchanged to keep the diff focused.