Skip to content

Gate New Stats behind remote feature flag#22996

Draft
adalpari wants to merge 4 commits into
trunkfrom
feat/new-stats-remote-flag
Draft

Gate New Stats behind remote feature flag#22996
adalpari wants to merge 4 commits into
trunkfrom
feat/new-stats-remote-flag

Conversation

@adalpari

@adalpari adalpari commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Description

The New Stats experience was previously gated by a local experimental
feature flag (ExperimentalFeatures.Feature.NEW_STATS), toggled both from the
experimental-features settings screen and from in-app "Try new stats" /
"Disable new stats" controls.

This PR replaces that local flag with a new remote feature flag,
android_new_stats, so the rollout can be controlled server-side. The remote
flag is the single source of truth for routing (which Stats screen opens by
default) and defaults to false when the remote value is unavailable (offline /
not yet fetched).

The in-app switch controls are kept so users can move between the classic
and new experiences, with one rule tied to the remote flag: when
android_new_stats is on, the new experience is the rollout default and the
user is locked into it (no "Disable new stats" action). When the flag is
off, both directions are available. The controls are now plain navigation —
they no longer persist any local flag, so the remote flag remains the routing
source of truth.

Changes

  • New remote flag: added NewStatsFeatureConfig (@Feature("android_new_stats", false))
    and the NEW_STATS buildConfigField. The @Feature annotation auto-registers
    the default in the KSP-generated RemoteFeatureConfigDefaults.
  • Gating read swapped: ListItemActionHandler now decides new vs. classic
    Stats via newStatsFeatureConfig.isEnabled() (test updated accordingly).
  • Local flag removed: dropped the NEW_STATS entry from ExperimentalFeatures
    (it disappears from the experimental-features settings screen automatically).
  • "Try new stats" kept on the classic screen: the toolbar menu
    (res/menu/stats_toolbar_menu.xml) and the "new Stats experience" suggestion
    dialog in StatsFragment remain. Selecting them now simply launches
    NewStatsActivity (no local flag write).
  • "Disable new stats" kept on the new screen, gated on the remote flag: the
    overflow action in NewStatsActivity is shown only when
    newStatsFeatureConfig.isEnabled() is false. When the remote flag is true
    the action is hidden, so users on the rollout cannot switch back. Selecting it
    launches the classic StatsActivity (no local flag write).
  • Retained the supporting suggestion prefs (AppPrefs/AppPrefsWrapper), base
    English strings, and the STATS_NEW_STATS_ENABLED/STATS_NEW_STATS_DISABLED
    analytics events used by these controls.

Testing instructions

Remote flag off (default):

  1. Build & install the Jetpack debug app on a WordPress.com or Jetpack-connected site.
  2. Open My Site → Stats.
  • Verify the classic Stats screen opens.
  • Verify the "Try new stats" toolbar menu item is present, and the "A new Stats experience" suggestion dialog appears on first eligible launch.
  • Tap "Try new stats" (or "Try it out") → verify the new Stats screen opens.
  • In the new Stats screen, verify the overflow "Disable new stats" action is present and returns you to the classic Stats screen.
  1. Open Me → App Settings → Experimental Features (debug).
  • Verify "New Stats" is no longer listed.

Remote flag on:

  1. Force-enable the flag locally by setting NEW_STATS to "true" in WordPress/build.gradle (or enable android_new_stats via remote config), then rebuild.
  2. Open My Site → Stats.
  • Verify the new Stats screen opens directly.
  • Verify the overflow "Disable new stats" action is not shown (user is locked into New Stats).

Replace the local NEW_STATS experimental flag with a server-controlled
remote feature flag so the New Stats rollout can be managed remotely.
Because the remote flag is read-only, the manual opt-in/opt-out toggles
are removed and the flag is now the single source of truth.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dangermattic

dangermattic commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot

wpmobilebot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
Build TypeDebug
Versionpr22996-555b307
Build Number1496
Application IDcom.jetpack.android.prealpha
Commit555b307
Installation URL5uaeniluh2898
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
Build TypeDebug
Versionpr22996-555b307
Build Number1496
Application IDorg.wordpress.android.prealpha
Commit555b307
Installation URL5pvoiqn87f838
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

Copy link
Copy Markdown
Contributor

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

adalpari and others added 2 commits June 17, 2026 12:44
…rrors

The previous commit removed the New Stats opt-in/opt-out strings from the
default locale but left them in the translation files, causing 204
ExtraTranslation lint errors. Remove the orphaned translations.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.54545% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.46%. Comparing base (0225fe2) to head (555b307).
⚠️ Report is 1 commits behind head on trunk.

Files with missing lines Patch % Lines
.../wordpress/android/ui/newstats/NewStatsActivity.kt 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #22996      +/-   ##
==========================================
- Coverage   37.46%   37.46%   -0.01%     
==========================================
  Files        2325     2326       +1     
  Lines      125221   125224       +3     
  Branches    17160    17162       +2     
==========================================
  Hits        46913    46913              
- Misses      74502    74505       +3     
  Partials     3806     3806              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Re-add the "Try new stats" toolbar menu and suggestion dialog on the
classic Stats screen, and the "Disable new stats" overflow on the new
Stats screen. The latter is shown only when the android_new_stats remote
flag is off, so users on the rollout cannot switch back. Controls are
plain navigation now; the remote flag remains the routing source of truth
(no local ExperimentalFeatures flag is reintroduced).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants