Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Pathname-only hard loads still trigger the client-info error guard before PairSuccess renders.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Migrates /oauth/success/:clientId from Backbone to the React PairSuccess flow.
Changes:
- Adds an unconditional React route group and removes the Backbone route.
- Handles scope-less OAuth success integrations.
- Adds trailing-slash and integration tests.
File summaries
| File | Description |
|---|---|
oauth-web-integration.ts |
Bypasses permission parsing for success flows. |
oauth-web-integration.test.ts |
Tests empty permissions. |
integration-factory.ts |
Marks success-flow integrations. |
integration-factory.test.ts |
Tests factory behavior. |
integration-factory-flags.ts |
Extracts client IDs with trailing slashes. |
integration-factory-flags.test.ts |
Tests trailing-slash parsing. |
react-app/index.js |
Adds the React route group. |
get-oauth-success.js |
Disables the server Backbone fallback. |
router.js |
Removes the client Backbone route. |
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| throw new OAuthError('INVALID_PARAMETER'); | ||
| } | ||
| integration.data.clientId = clientId; | ||
| integration.isOAuthSuccessFlow = true; |
LZoog
left a comment
There was a problem hiding this comment.
I think we should probably update that one function name and can we add a Storybook page for this in React? Otherwise just want to spot check locally and can r+
|
|
||
| function getRoutesExcludingOAuthSuccessReact({ oauthRoutes }, routeNames) { | ||
| return oauthRoutes.featureFlagOn | ||
| function getRoutesExcludingOAuthSuccessReact( |
There was a problem hiding this comment.
This function is named getRoutesExcludingOAuthSuccessReact but is now getting oauthSuccessRoutes? Should this be updated to just getOAuthRoutes?
| }>({ loading: true }); | ||
|
|
||
| const urlQueryData = new UrlQueryData(new ReachRouterWindow()); | ||
| // A hard load of `/oauth/success/:clientId` carries no query params. |
There was a problem hiding this comment.
(Fine to ignore)
Was going to leave a nit about removing the comment but I guess even though the client ID is always in the URL, it probably had it as a query param at some point? So ehh I guess we can leave this comment (just thinking out loud)
| } | ||
| ); | ||
| }, | ||
| 'oauth/success/:client_id(/)': createViewHandler(ReadyView, { |
There was a problem hiding this comment.
(Fine to ignore)
We've been saving these for the removal issues but I see this:
Removes the oauth/success/:client_id(/) entry from app/scripts/lib/router.js. The views/ready.js import stays, because other routes still use it.
So 👍 seems fine
## Because - A hard load of `/oauth/success/:client_id` was still served by Backbone. - The React page needs the client id, but that URL has no query parameters. ## This pull request - Adds an `oauthSuccessRoutes` group in `server/lib/routes/react-app/index.js`, so Express sends the route to React. The group is hardcoded on, because Backbone no longer serves the route. - Removes the `oauth/success/:client_id` entry from `app/scripts/lib/router.js`. `views/ready.js` stays, because six other Backbone routes use it. - Adds `getOAuthSuccessClientId` in `src/lib/oauth/success-route.ts`. The integration factory, `useClientInfoState`, and `OAuthWebIntegration` read the client id from the pathname. The helper also accepts a trailing slash. - Sets `isOAuthSuccessFlow` on `OAuthWebIntegration`. An empty scope now gives an empty permission list instead of an error. - Renames `getRoutesExcludingOAuthSuccessReact` to `getBackboneOAuthSuccessRouteNames` in `get-oauth-success.js`, from review feedback. The old name described an exclusion, not the route names it returns. No behaviour change. ## Issue that this pull request solves Closes: FXA-6642

Because
/oauth/success/:client_idwas still served by Backbone.This pull request
oauthSuccessRoutesgroup inserver/lib/routes/react-app/index.js, so Express sends the route to React. The group is hardcoded on, because Backbone no longer serves the route.oauth/success/:client_identry fromapp/scripts/lib/router.js.views/ready.jsstays, because six other Backbone routes use it.getOAuthSuccessClientIdinsrc/lib/oauth/success-route.ts. The integration factory,useClientInfoState, andOAuthWebIntegrationread the client id from the pathname. The helper also accepts a trailing slash.isOAuthSuccessFlowonOAuthWebIntegration. An empty scope now gives an empty permission list instead of an error.getRoutesExcludingOAuthSuccessReacttogetBackboneOAuthSuccessRouteNamesinget-oauth-success.js, from review feedback. The old name described an exclusion, not the route names it returns. No behaviour change.Issue that this pull request solves
Closes: FXA-6642
Checklist
Put an
xin the boxes that applyHow to review (Optional)
react-app/index.js,get-oauth-success.js,success-route.ts.fxa-settings.views/ready.jsmust stay for the other Backbone routes.Screenshots (Optional)
None. The page renders the same React screen as before.
Other information (Optional)
fxa-settingssuites this branch touches pass locally: 101 tests, 0 failures.npx eslint app serverinpackages/fxa-content-server: exit 0.npx nx lint fxa-content-serverdid not finish. Itslint-gleanstep builds a Python venv and the sandbox has no network. The eslint half ran directly, as shown above.getBackboneOAuthSuccessRouteNamesand the default export: 5 passed, 0 failed. No test file was added.fxa-content-serverhas onlytests/functionaland no unit test target.get-frontend.jsandget-frontend-pairing.jskeep the oldergetRoutesExcluding*names. This pull request does not touch them.