fix(taskmind): surface the real Gmail sign-in error instead of a blanket "cancelled" - #164
Merged
Conversation
…ket "cancelled" GmailAuth.tokenFromConsent swallowed the consent ApiException into null, so SourcesViewModel.onConsentResult couldn't tell a genuine user-cancel from a real error — both showed "Gmail connection cancelled." That hid an ApiException: 8 (INTERNAL_ERROR) from an OAuth-project/propagation issue after the debug-keystore signing switch (#155), making it undiagnosable from the app. - New GmailConsentResult (Token/Cancelled/Failed) from GmailAuth.consentResult(): distinguishes a true user-cancel (CANCELED / null data) from a failure and carries a reason. - GMS-free gmailConsentErrorMessage(statusCode): actionable hints for the codes we hit (10 = SHA-1 not registered; 8 = Cloud OAuth setup/propagation) and the raw code otherwise. - onConsentResult surfaces that message instead of the blanket "cancelled". New GmailConsentErrorTest (pure JVM). Full unit suite green; adversarial review (consent-result correctness + ViewModel regression) found 0 issues. Closes #163
SMK1705
added a commit
that referenced
this pull request
Jul 4, 2026
Reconcile with #164 (Gmail error-surfacing via the Identity Authorization API), which merged first. This branch supersedes it: the GoogleAuthUtil token path replaces Identity.getAuthorizationClient(), so the consentResult/GmailConsentResult machinery and the GmailConsentError helper (+ its test) are now dead code and are removed. Kept #162's SHA-1 setup note in the GmailAuth header.
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.
Closes #163.
When Gmail authorization failed at the consent step,
GmailAuth.tokenFromConsentswallowed theApiExceptionintonull, soSourcesViewModel.onConsentResultcouldn't distinguish a genuine user-cancel from a real error — both showed "Gmail connection cancelled." That hid anApiException: 8(INTERNAL_ERROR) caused by an OAuth-project/propagation issue after the debug-keystore signing switch (#155), making it undiagnosable from the app itself.Fix
GmailConsentResult(Token / Cancelled / Failed) returned byGmailAuth.consentResult(data)— distinguishes a true user-cancel (CANCELEDstatus / null data) from a failure and carries a reason.gmailConsentErrorMessage(statusCode)— a pure, Play-services-free formatter with actionable hints for the two codes actually seen (10= this build's SHA-1 isn't registered;8= Cloud OAuth setup still propagating / missing Gmail API, scope, or test user) and the raw code otherwise. Kept GMS-free so it's unit-testable on the plain JVM.SourcesViewModel.onConsentResultnow shows that message instead of the blanket "cancelled".Result
A real failure now reads e.g. "Gmail sign-in failed (error 8): the Google Cloud OAuth setup may still be propagating…" — self-diagnosing, instead of a misleading "cancelled".
Tests & review
GmailConsentErrorTest(pure JVM) covers the 10 / 8 / no-token / other-code messages. Full unit suite green. Adversarial review across consent-result correctness + ViewModel regression: 0 findings (success and genuine-cancel paths unchanged).