Skip to content

PART3: feat(settings): Migrate fxa-settings from GraphQL to direct auth-client (cutover)#19981

Merged
vbudhram merged 1 commit intomainfrom
FXA-12995
Feb 11, 2026
Merged

PART3: feat(settings): Migrate fxa-settings from GraphQL to direct auth-client (cutover)#19981
vbudhram merged 1 commit intomainfrom
FXA-12995

Conversation

@vbudhram
Copy link
Copy Markdown
Contributor

@vbudhram vbudhram commented Feb 2, 2026

Because

  • The fxa-graphql-api service adds unnecessary latency and complexity between fxa-settings and fxa-auth-server
  • GraphQL mutations/queries coupled the frontend to Apollo cache management, making state management harder to reason about
  • Direct auth-client calls simplify the data flow and reduce the dependency surface

This pull request

  • Removes ApolloProvider, ApolloClient, and all GQL mutations/queries from the fxa-settings entrypoint and page containers
  • Replaces GQL calls with direct fxa-auth-client methods (signInWithAuthPW, getCredentialStatusV2,
    sendUnblockCode, etc.)
  • Adds account-storage.ts — unified localStorage-based account state replacing the Apollo InMemoryCache
  • Adds AccountStateContext and
    AuthStateContext React contexts for reactive state management
  • Adds useAccountData hook that fetches account, profile, and attached clients data in parallel via auth-client
  • Renames gql-key-stretch-upgrade to auth-key-stretch-upgrade, now calling auth-client directly
  • Replaces Apollo cache with a no-op shim for remaining legacy references (gql.ts)
  • Removes @apollo/client and graphql from fxa-settings dependencies
  • Removes PageMfaGuardWithGqlTest (GQL-only test page)
  • Updates all Signin, Signup, InlineTotpSetup, and InlineRecoverySetup containers and their tests

Issue

Closes: https://mozilla-hub.atlassian.net/browse/FXA-12995

Checklist

  • My commit is GPG signed
  • Tests pass locally (if applicable)
  • Documentation updated (if applicable)
  • RTL rendering verified (if UI changed)

Other Information

Scope: 90 files changed, ~2,600 insertions, ~2,700 deletions

Breaking changes: The fxa-graphql-api server is no longer required for fxa-settings to function. CSP rules for the GQL endpoint have been removed from content-server configuration.

Legacy shim: gql.ts and cache.ts retain a no-op Apollo cache shim for files not yet migrated (PostVerify, SetPassword, InlineRecoveryKeySetup). These should be cleaned up in a follow-up.

@vbudhram vbudhram self-assigned this Feb 2, 2026
@vbudhram vbudhram force-pushed the FXA-12995 branch 2 times, most recently from d8b0f36 to 5886060 Compare February 6, 2026 04:40
@vbudhram vbudhram marked this pull request as ready for review February 6, 2026 15:16
@vbudhram vbudhram requested a review from a team as a code owner February 6, 2026 15:16
@vbudhram vbudhram changed the title PART3: feat(settings): Migrate fxa-settings from GraphQL to direct auth-client (cutover) PART3: feat(settings): Migrate fxa-settings from GraphQL to direct auth-client (cutover) (WIP) Feb 6, 2026
@vbudhram vbudhram force-pushed the FXA-12995 branch 5 times, most recently from 2c6b6b1 to 2381c6c Compare February 6, 2026 19:33
@vbudhram vbudhram changed the title PART3: feat(settings): Migrate fxa-settings from GraphQL to direct auth-client (cutover) (WIP) PART3: feat(settings): Migrate fxa-settings from GraphQL to direct auth-client (cutover) Feb 6, 2026
@vbudhram vbudhram requested a review from dschom February 6, 2026 19:43
Comment thread packages/functional-tests/tests/settings/changeEmail.spec.ts
Comment thread packages/functional-tests/tests/settings/multitab.spec.ts Outdated
await page.goto(
`${target.contentServerUrl}?context=fx_desktop_v3&service=sync&action=email`
);
await signin.respondToWebChannelMessage(customEventDetail);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we have to do this? It seems like in a fucntional tests stuff like this shouldn't be needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yea, this was surprising to me. Wit the graphql removal, these started to fail, however they were not structured the same way as the other tests which did do this. Its possible that our graphql approach was masking something.

Copy link
Copy Markdown
Contributor

@dschom dschom Feb 9, 2026

Choose a reason for hiding this comment

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

Have we manually tested this flow? A user won't be able to trigger that respondToWebChannelMessage call, which makes me question if this actually works or we lost something important in the migration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Tested this locally and the signin/up works as expected, no hanging.

@vbudhram vbudhram force-pushed the FXA-12995 branch 5 times, most recently from 2a61055 to 3ae556c Compare February 7, 2026 17:51
Comment thread packages/fxa-content-server/server/bin/fxa-content-server.js Fixed
Comment thread packages/fxa-content-server/server/bin/fxa-content-server.js Fixed
Comment thread packages/fxa-settings/src/lib/cache.ts
Comment thread packages/fxa-settings/src/lib/config.ts
Comment thread packages/fxa-settings/src/lib/file-utils-legal.tsx Outdated
Comment thread packages/fxa-settings/src/lib/file-utils-legal.tsx
Comment thread packages/fxa-settings/src/lib/gql.ts
Comment thread packages/fxa-settings/src/models/contexts/AppContext.ts
Comment thread packages/fxa-settings/src/models/contexts/AppContext.ts
Comment thread packages/fxa-settings/src/models/contexts/SettingsContext.ts
Comment thread packages/fxa-settings/src/models/contexts/SettingsContext.ts Outdated
Comment thread packages/fxa-settings/src/models/Account.ts Outdated
Comment thread packages/fxa-settings/src/models/Account.ts Outdated
Comment thread packages/fxa-settings/src/models/Account.ts Outdated
Comment thread packages/fxa-settings/src/models/Account.ts
Comment thread packages/fxa-settings/src/models/Account.ts
Comment thread packages/fxa-settings/src/models/Legal.ts Outdated
Comment thread packages/fxa-settings/src/models/Session.ts
Comment thread packages/fxa-settings/src/pages/InlineTotpSetup/container.tsx Outdated
Comment thread packages/fxa-settings/src/pages/Signin/container.test.tsx Outdated
Comment thread packages/fxa-settings/package.json
Comment thread packages/fxa-settings/package.json
@vbudhram vbudhram force-pushed the FXA-12995 branch 2 times, most recently from ddbcc46 to d727638 Compare February 10, 2026 16:06
@vbudhram vbudhram requested a review from dschom February 10, 2026 20:42
Copy link
Copy Markdown
Contributor

@dschom dschom left a comment

Choose a reason for hiding this comment

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

Let's give it a go! Thanks for all these changes. R+WC

I think this one is still a little funny. We could investigate in a follow up though.

And it seems like we should still remove this to ensures calls stick to the defined types.

@vbudhram vbudhram merged commit f90a86c into main Feb 11, 2026
22 checks passed
@vbudhram vbudhram deleted the FXA-12995 branch February 11, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants