Skip to content

Prepare OAuth debugger foundations for future learning lessons#1676

Open
chelojimenez wants to merge 1 commit intopnpfrom
codex/oauth-debugger-foundations
Open

Prepare OAuth debugger foundations for future learning lessons#1676
chelojimenez wants to merge 1 commit intopnpfrom
codex/oauth-debugger-foundations

Conversation

@chelojimenez
Copy link
Copy Markdown
Contributor

@chelojimenez chelojimenez commented Mar 26, 2026

Summary

  • extract a reusable useOAuthFlowController hook from OAuthFlowTab and move flow orchestration, callback handling, modal timing, reset behavior, and token extraction into it
  • add a shared OAuthFlowExperience shell plus a small capability/config layer so server-backed debugger flows and future fixed-profile learning flows can reuse the same UI without route wiring yet
  • keep the existing debugger behavior intact, preserve shared OAuth step metadata as the canonical source, and keep the profile modal as the thin app-specific adapter surface
  • add regression, controller, and presentation coverage for the debugger tab, the new controller, and capability-gated experience rendering

Testing

  • npx vitest run client/src/components/oauth/__tests__/useOAuthFlowController.test.tsx client/src/components/oauth/__tests__/OAuthFlowExperience.test.tsx client/src/components/__tests__/OAuthFlowTab.test.tsx

Notes

  • foundation-only change; no new Learning tab routes, lessons, or sidebar items are included here

Note

Medium Risk
Moderate risk because OAuth flow orchestration and callback handling were refactored into a new hook and the debugger UI was re-composed, which could subtly affect auth modal timing, reset behavior, or token application despite aiming to preserve behavior.

Overview
Refactors the OAuth debugger tab to use a new useOAuthFlowController hook for state-machine orchestration, OAuth callback processing (window message/BroadcastChannel), reset behavior, and token extraction, reducing OAuthFlowTab to app wiring + PostHog events.

Introduces a reusable OAuthFlowExperience layout with capability-gated actions via oauthFlowShared (e.g., supporting future fixed-profile lesson flows without editing/apply/refresh controls), and updates OAuthFlowLogger to respect these capability flags.

Simplifies OAuthAuthorizationModal to only manage the popup lifecycle (callback listening moved to the controller), adds comprehensive unit tests for the tab/controller/experience, and updates test setup to mock HTMLElement.scrollTo.

Written by Cursor Bugbot for commit 101a66d. This will update automatically on new commits. Configure here.

@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Mar 26, 2026
@chelojimenez
Copy link
Copy Markdown
Contributor Author

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@dosubot dosubot bot added the enhancement New feature or request label Mar 26, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

if (strategy === "cimd") return "CIMD (URL-based)";
if (strategy === "dcr") return "Dynamic (DCR)";
return "Pre-registered";
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New shared export duplicates existing local function

Low Severity

The newly exported describeRegistrationStrategy in oauthFlowShared.ts is identical to the existing local describeRegistrationStrategy in OAuthProfileModal.tsx. Since this PR specifically extracts shared utilities, OAuthProfileModal could import from the shared module instead of maintaining its own copy.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant