Skip to content

fix(taskmind): surface the real Gmail sign-in error instead of a blanket "cancelled" - #164

Merged
SMK1705 merged 2 commits into
mainfrom
fix/gmail-error-surfacing
Jul 3, 2026
Merged

fix(taskmind): surface the real Gmail sign-in error instead of a blanket "cancelled"#164
SMK1705 merged 2 commits into
mainfrom
fix/gmail-error-surfacing

Conversation

@SMK1705

@SMK1705 SMK1705 commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Closes #163.

When Gmail authorization failed at the consent step, GmailAuth.tokenFromConsent swallowed the ApiException into null, so SourcesViewModel.onConsentResult couldn't distinguish a genuine user-cancel from a real error — both showed "Gmail connection cancelled." That hid an ApiException: 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 by GmailAuth.consentResult(data) — distinguishes a true user-cancel (CANCELED status / 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.onConsentResult now 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).

…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
SMK1705 merged commit 793b181 into main Jul 3, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in TaskMind Roadmap Jul 3, 2026
@SMK1705
SMK1705 deleted the fix/gmail-error-surfacing branch July 3, 2026 19:27
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Gmail sign-in shows a blanket 'cancelled' that hides the real OAuth error

1 participant