Skip to content

fix(desktop): carry typed OAuth failure reasons from main-process producers - #4887

Draft
orangeCatDeveloper wants to merge 1 commit into
apache:mainfrom
orangeCatDeveloper:fix/oauth-failure-reasons
Draft

fix(desktop): carry typed OAuth failure reasons from main-process producers#4887
orangeCatDeveloper wants to merge 1 commit into
apache:mainfrom
orangeCatDeveloper:fix/oauth-failure-reasons

Conversation

@orangeCatDeveloper

@orangeCatDeveloper orangeCatDeveloper commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary

subscriptionResultMessage localized OAuth login failures by matching English Host prose with regexes. One of the three regex families — did not present OAuth|no matching OAuth presentation — described failures Desktop produces itself: the presentation timeout and the absent-request throw in runtime-host-oauth-presentation.ts. Matching your own prose is a contract you cannot see break; rewording either sentence silently drops the branch.

Those producers now throw a typed OAuthPresentationError, and get-auth-url maps it alongside the Host's operation codes onto the failure envelope:

  • operation_conflictlogin_in_progress
  • OAuthPresentationErrorpresentation_failed
  • operation_unavailableexperimental_disabled (unchanged)

The renderer catalog maps the two new reasons per locale and the presentation regex is deleted. The enrollment is disabled and already in progress prose fallbacks stay: the first covers Hosts older than these codes, and the second still has a live producer in presentation.expect, which throws a plain error. The ad-hoc loginConflict / browserPresentFailed keys fold into resultCodes with the same wording.

Refs #2672

Verification

apps/desktop full dist suite        2489 pass / 0 fail
apps/desktop typecheck (4)          0 errors
renderer architecture ratchet       passes against the base
npm run format:check                clean

Not run: Electron e2e against a live Host login flow.

AI use

  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code — traced the producer→presenter path, implemented the typed error and reason mapping, removed the regex, added the tests, and wrote this description.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — login-conflict and browser-presentation failures render catalog copy through typed reasons instead of English prose matching.

@github-actions github-actions Bot added the effort/XL Under 2500 readable lines label Sep 6, 2026
@orangeCatDeveloper
orangeCatDeveloper force-pushed the fix/oauth-failure-reasons branch 5 times, most recently from 794d684 to bf801eb Compare September 8, 2026 19:48
get-auth-url maps the Host's operation_conflict to a typed
login_in_progress reason and Desktop-owned presentation failures to
presentation_failed, so the renderer stops matching English prose. The
did-not-present / no-matching-request regex goes away; the
enrollment-disabled and already-in-progress fallbacks stay for Host
versions that predate the typed codes.

Generated-by: Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XL Under 2500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant