Remove the `setupFlowRefresh` feature flag
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 383
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 77
Description
## Feature Description
Once the Setup Flow Refresh feature has been successfully launched, we should strip out the feature flag from the codebase, and remove related unused code.
**IMPORTANT: This issue is not eligible for release until SFR has been released and we've had time to receive any initial feedback from our user base. I.e., at a minimum it should be included in the release after the one which includes issue https://github.com/google/site-kit-wp/issues/12966.**
---------------
_Do not alter or remove anything below. The following sections will be managed by moderators only._
## Acceptance criteria
- The `setupFlowRefresh` feature flag, all references to it, and all execution paths that are taken when the flag is false are removed from the codebase.
- Legacy tests and stories are removed.
- No regressions are introduced to the new setup flow.
## Implementation Brief
- [ ] In `feature-flags.json`:
- Remove the `setupFlowRefresh` entry. Keep `setupFlowRefreshPhase4`.
- [ ] PHP: collapse each `Feature_Flags::enabled( 'setupFlowRefresh' )` check to its enabled branch and remove the disabled branch and now-dead code:
- `includes/Core/User/User.php` (two checks).
- `includes/Core/Admin/Screens.php` (remove the `! Feature_Flags::enabled( … )` branch).
- `includes/Core/Authentication/Google_Proxy.php`: always use `SETUP_V3_URI`, remove the disabled branches, and remove the now-unused `SETUP_URI` (v2) constant if it has no remaining references.
- `includes/Core/Authentication/Clients/OAuth_Client.php` (remove the `! Feature_Flags::enabled( … )` branch).
- `includes/Modules/Analytics_4.php` and `includes/Modules/Analytics_4/Datapoints/Create_Account_Ticket.php`: collapse the checks and update the comments that reference the flag.
- Grep the rest of `includes/` for any remaining `setupFlowRefresh` references (including doc comments) and clean them up.
- [ ] JS/TS: collapse every `useFeature( 'setupFlowRefresh' )` (~32) and `isFeatureEnabled( 'setupFlowRefresh' )` (~4) usage to always-true. Remove the flag variable, the conditional, and the false-branch JSX/markup. Where it's combined with `setupFlowRefreshPhase4`, reduce to the phase4 check alone. Affected areas include (non-exhaustive, so work from a full grep):
- `assets/js/components/setup/SetupUsingProxyWithSignIn/` (`index.js`, `Splash.js`), `assets/js/components/setup/SetupUsingProxyViewOnly/index.js`, `assets/js/components/dashboard-splash/`, `assets/js/components/ActivateAnalyticsCTA.js`.
- `assets/js/components/key-metrics-setup/`, `assets/js/components/user-input/` (`UserInputPreview.js`, `UserInputEditModeContent.js`, `UserInputPreviewGroup/index.tsx`).
- `assets/js/modules/analytics-4/components/` (setup, settings, common, e.g. `SetupMain.js`, `SettingsEdit.js`, `AccountCreate`).
- [ ] Delete components that exist **only** for the `setupFlowRefresh`-off path, and simplify their callers to render the refreshed component unconditionally:
- `assets/js/components/setup/SetupUsingProxyWithSignIn/LegacySplashContent.js`. `Splash.js` currently picks `SplashContent` vs `LegacySplashContent` via `setupFlowRefreshEnabled`, so make it always render `SplashContent`.
- Confirm via reference search before deleting any other component (e.g. legacy footer/markup branches in key-metrics-setup / user-input) that it is reachable only when the flag is false.
- Do **not** delete these similarly-named fallbacks, which are gated by *other* conditions rather than `setupFlowRefresh`: `SetupUsingProxyViewOnly/LegacySplashViewOnlyContent.js` (gated by `setupFlowRefreshPhase4`, which stays), and `assets/js/modules/analytics-4/components/common/AccountCreateLegacy.js` and `assets/js/components/legacy-setup/` (`SetupUsingGCP`), both gated by `isUsingProxy() === false`.
- [ ] Storybook:
- For setup screens with both a base `index.stories.js` (flag-off) and an `index-setupFlowRefresh.stories.js` (flag-on), such as `SetupUsingProxyWithSignIn/`: delete the flag-off story and promote the flag-on story to the default (rename `index-setupFlowRefresh.stories.js` to `index.stories.js` and drop its `features: [ 'setupFlowRefresh' ]` parameter).
- Remove `features: [ 'setupFlowRefresh' ]` from any other stories that opted in (behavior is now default).
- Keep `setupFlowRefreshPhase4` stories (e.g. `SetupUsingProxyViewOnly/index-setupFlowRefreshPhase4.stories.js`).
- Drop `SetupFlowRefresh` from story exports and `storyName`s in `Header.stories.js`, `TourTooltips.stories.js`, `ActivateAnalyticsCTA/index.stories.js`, `adminbar/AdminBarWidgets.stories.js` and `wp-dashboard/WPDashboardActivateAnalyticsCTA.stories.js`, and retitle `index-setupFlowRefresh.stories.js` to `Setup / Using Proxy With Sign-in`.
- Trim the stories that become duplicates, keeping whichever of the pair has a `scenario` so VRT coverage isn't lost. Check the rendered output matches first. Pairs to check: `HeaderWithHelpMenu` / `HeaderWithHelpMenuSFR`, `TourTooltips`'s `Default` / `SetupFlowRefresh`, and the `WithSetupFlowRefresh*` stories against `Ready` / `CompleteActivation` (wp-dashboard), `AnalyticsInactive*` (adminbar) and `Default` (ActivateAnalyticsCTA).
- Update/remove the corresponding VRT reference images in `tests/backstop/reference/` for any renamed, deleted or trimmed story. Renaming a story also renames its images.
### Test Coverage
- Across the affected JS test files (~26) and PHP tests: remove the `setupFlowRefresh`-disabled test cases and any tests covering deleted legacy components.
- For tests that enabled the flag to exercise the new flow (`features: [ 'setupFlowRefresh' ]` in JS, `enable_feature( 'setupFlowRefresh' )` in PHP), drop the opt-in and keep the assertions, since the behavior is now the default.
- Drop the flag from test names: the "when setupFlowRefresh is enabled" clauses in the JS tests and the `_with_setupFlowRefresh_enabled` suffixes in `ScreensTest.php`.
- Update snapshots affected by the removed branches.
- Ensure the remaining suites pass and continue to cover the (now-unconditional) refreshed setup flow.
## QA Brief
This change removes the `setupFlowRefresh` feature flag and the code that only ran while it was disabled. The flag has been force-enabled for all users since 1.183.0, so **nothing should look or behave differently**. The aim is to confirm that, not to verify a new feature. `setupFlowRefreshPhase4` is unaffected and should continue to behave as it does today.
Testing against `develop` first and then the PR branch, on the same site, makes differences obvious — any difference is a bug.
### Setup flow
- On a fresh site with Site Kit activated but not connected, the splash screen shows the refreshed design with the progress indicator and "Exit setup" in the header, and "Exit setup" returns to the WordPress dashboard.
- Complete the flow through to the dashboard: the Site Kit Service screens show the correct number of progress segments (incrementing as you advance), and the Search Console and Analytics setup screens appear with their help menus. The setup URL carries `showProgress=true`.
- You land on the **Site Kit** dashboard with the "Welcome to Site Kit" modal — "Initial setup complete!", offering "Start tour" and "Maybe later". The redirect carries `notification=initial_setup_success`, which is what triggers that modal.
- The Analytics setup screen's CTA reads "Set up", and the Key Metrics setup screen renders, including its error state.
- Sign in as a secondary admin on a site another admin has already configured: the splash screen shows "Let's get started!" with the shared-services description, and "Skip sign-in and view limited dashboard" goes to the dashboard.
- As a view-only user, the view-only splash screen is unchanged.
### Analytics account creation
- Create a *new* Analytics account during setup: you are returned to the Key Metrics setup screen with the progress indicator.
- Trigger an account creation error (for example cancel at the terms of service step): the error appears inline on the Analytics setup screen, not as an `error_code` on the dashboard.
- Create an account from Settings → Analytics instead: the error returns you to the Analytics settings edit screen.
### Dashboard and widgets
- The Key Metrics widget area appears on the Site Kit dashboard, and the "Select metrics" link opens the metrics panel.
- Where Analytics is not connected, the Activate Analytics CTA appears in the WordPress admin bar, the WordPress dashboard widget, and the Search Funnel widget, and its button reads "Set up Analytics" (or "Complete setup" where Analytics is active but not connected). Clicking it starts activation.
- Disconnect Analytics and reload the Site Kit dashboard: the Key Metrics area still renders, showing "Analytics is disconnected" with "Connect Analytics" and "Maybe later". Search Console tiles keep their data; Analytics-backed tiles fall back to "Add a metric". "Connect Analytics" starts setup and "Maybe later" dismisses the notice.
- Dashboard tours still run, and the tour tooltips look unchanged — check the step counter ("1 / 3"), the button styles, and the close icon.
- The help menu (the `?` in the header) shows "Browse documentation", "Get free support", "Send feedback", plus contextual items such as "Get help with AdSense". "Fix common issues" must **not** appear — it was the old-design item. "Start a feature tour" appears only on the Site Kit dashboard (not Settings), and only once the relevant module has finished gathering data.
### Settings
- Settings → the "Personalized metrics" card appears when Analytics is connected, and its "Select metrics" and questionnaire behaviour is unchanged.
- **One intentional change:** this card previously waited for two gathering-data requests before rendering, and no longer does, so it may appear slightly sooner on a slow connection. The card itself, and when it appears, should be identical — only the loading placeholder is shorter.
- The audiences ("Display visitor groups in dashboard") card is not shown on the Settings screen. It has not been shown since 1.183.0; this PR deletes the component behind it.
### Regression checks on an existing site
- On a site already connected before updating, the dashboard shows no unexpected setup CTAs, welcome modal, or notices.
- A user who had previously hidden the Key Metrics widget sees the "Key metrics are back on your dashboard" notice above the tiles, with "Select metrics" and "Got it". "Got it" dismisses it for good.
### Flag removal
- `setupFlowRefresh` no longer appears among the available feature flags, and cannot be enabled by any means.
- `setupFlowRefreshPhase4` still behaves exactly as before — in particular the view-only splash screen and the Analytics activation error notice.
## Changelog entry
-
Contributor guide
Assessment
This issue has not been assessed yet.