Repository navigation
Updated statsX flag to trafficAnalyticsAlpha - #23029
Conversation
ref https://linear.app/ghost/issue/PROD-53/ ref https://ghost.slack.com/archives/C07HTEJMR2R/p1745343216833259?thread_ts=1744898981.417349&cid=C07HTEJMR2R Renamed flags to make more sense. trafficAnalytics for beta users, trafficAnalyticsAlpha for features we're developing for that beta.
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughThe changes in this pull request focus on renaming a feature flag across multiple codebases. Specifically, the feature flag identifier for the "Stats redesign" or related analytics features has been changed from 'statsX' to 'trafficAnalyticsAlpha'. This update is consistently applied in several locations: the advanced labs settings UI, the conditional logic for displaying the "Web stats" link in the post analytics header, the feature flag tracking in the FeatureService class, the template logic for rendering the AdminX Posts component, and the list of recognized alpha features. No other logic, UI elements, or feature descriptions are altered, and there are no changes to exported or public API signatures except for the renaming of the feature property in the FeatureService class. Possibly related PRs
Suggested labels
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
apps/admin-x-settings/src/components/settings/advanced/labs/AlphaFeatures.tsx(1 hunks)ghost/admin/app/components/posts/analytics.hbs(1 hunks)ghost/admin/app/services/feature.js(1 hunks)ghost/admin/app/templates/posts-x.hbs(1 hunks)ghost/core/core/shared/labs.js(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (14)
- GitHub Check: Ghost-CLI tests
- GitHub Check: Admin-X Settings tests
- GitHub Check: Unit tests (Node 22.13.1)
- GitHub Check: Database tests (Node 20.11.1, sqlite3)
- GitHub Check: Unit tests (Node 20.11.1)
- GitHub Check: Regression tests (Node 20.11.1, sqlite3)
- GitHub Check: Database tests (Node 22.13.1, mysql8)
- GitHub Check: Unit tests (Node 18.12.1)
- GitHub Check: Regression tests (Node 20.11.1, mysql8)
- GitHub Check: Database tests (Node 20.11.1, mysql8)
- GitHub Check: Database tests (Node 18.12.1, mysql8)
- GitHub Check: Lint
- GitHub Check: i18n
- GitHub Check: Admin tests - Chrome
🔇 Additional comments (4)
ghost/core/core/shared/labs.js (1)
51-51: Flag renamed consistently with PR objective.The feature flag has been correctly renamed from 'statsX' to 'trafficAnalyticsAlpha' in the ALPHA_FEATURES array, which aligns with the PR objective to better distinguish between beta features and alpha features under development.
apps/admin-x-settings/src/components/settings/advanced/labs/AlphaFeatures.tsx (1)
41-41: Feature flag updated correctly in settings UI.The feature flag name has been updated from 'statsX' to 'trafficAnalyticsAlpha' while maintaining the same feature title and description. This ensures the labs settings UI reflects the renamed flag consistently.
ghost/admin/app/templates/posts-x.hbs (1)
1-1: Feature flag condition updated appropriately.The feature flag condition for rendering the AdminX::Posts component has been correctly updated to use 'trafficAnalyticsAlpha' instead of 'statsX'.
ghost/admin/app/components/posts/analytics.hbs (1)
38-38: Feature flag in conditional check properly renamed.The feature flag has been correctly updated in the conditional check that controls the visibility of the "Web stats" link. This maintains the existing permission requirements (admin user and stats config enabled) while using the renamed flag.
| @feature('contentVisibilityAlpha') contentVisibilityAlpha; | ||
| @feature('postsX') postsX; | ||
| @feature('statsX') statsX; | ||
| @feature('trafficAnalyticsAlpha') trafficAnalyticsAlpha; |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Add new trafficAnalyticsAlpha feature flag
The introduction of @feature('trafficAnalyticsAlpha') trafficAnalyticsAlpha; properly aligns with the renaming of the old statsX flag. Please double-check that all statsX references (in code, tests, docs, etc.) have been purged and that any documentation or configuration schemas have been updated to reflect this change.
Suggested verification:
🏁 Script executed:
#!/bin/bash
# Ensure no residual 'statsX' references remain
rg -n "statsX" -C2 .Length of output: 498
Update Remaining Snapshot Test Reference for statsX
The new @feature('trafficAnalyticsAlpha') trafficAnalyticsAlpha; addition looks good, but there’s still a leftover statsX entry in your e2e snapshot tests. Please update it to use the new flag (or remove it if no longer needed) so your tests reflect the change:
• File: ghost/core/test/e2e-api/admin/__snapshots__/config.test.js.snap
– Line 29: replace "statsX": true with the appropriate "trafficAnalyticsAlpha": true entry (and update the surrounding snapshot if needed).
After updating, run your tests to regenerate the snapshot and ensure there are no more statsX references anywhere.
no refs ## Evidence that the component is unused `PostAnalyticsView` is not exported by the private Admin package, and repository-wide searches for both its symbol and module path find no importer. Admin-only Knip reported `apps/admin/src/posts/analytics/components/post-analytics-view.tsx` as an unused file before this removal and stopped reporting it afterward. The Admin build uses explicit routes and entry points; no dynamic import or glob references this path. ## History and intentionality Documented facts: - ad52284 introduced the component as the loading/empty/content wrapper in the first React post-analytics skeleton. #22978 explains that the work began a better breakdown of post statistics, initially focused on web analytics for one post. - 54d993b replaced that static wrapper in the main page with real post and traffic data. #22986 says this made the previously static skeleton usable for beta users. - 26de9ed later reused the component only as the loading screen for a duplicated `withFeatureFlag` wrapper. #23270 documents that the wrapper prevented the Newsletter tab from redirecting before the alpha setting had loaded, and explicitly called the duplication temporary. - #23029 documents the rollout model: `trafficAnalytics` selected beta users, while `trafficAnalyticsAlpha` selected features still under development for that beta. - f0a33b8 intentionally moved Newsletter analytics out of alpha. Its diff replaced the protected route with the direct `Newsletter` route and made the sidebar links unconditional; #23294 states that purpose directly. Production therefore stopped reaching the wrapper, and consequently `PostAnalyticsView`, on May 12, 2025. Given the documented flag semantics, this was an intentional promotion to the analytics beta rather than an accidental bypass. - fb0790b later restored the alpha flag for other design work but did not restore Newsletter's route guard, corroborating that Newsletter's promotion was deliberate. - 566f8a9 removed the now-unreachable wrapper and its tests. #29686 identifies those files as duplicated dead code with no live importers. That deletion removed the component's last source or test importer on July 30, 2026. Inference: leaving `PostAnalyticsView` behind in that last cleanup was an incomplete leaf cleanup. No historical source explicitly describes the omission, but the dead-code PR's stated intent, the current zero-reference result, and Knip's independent unused-file report support that conclusion. ## Removal Deleted the 33-line orphaned component. It had no dedicated tests, export, dependency, configuration, or documentation to remove. Its `EmptyStatView` and `PostAnalyticsContent` dependencies remain used by live analytics screens. ## Verification - `pnpm exec knip --workspace @tryghost/admin --include files --reporter compact --no-progress` (the removed file is absent; four pre-existing acceptance setup/config entries remain) - `pnpm --dir apps/admin lint` - `pnpm --dir apps/admin typecheck` - `pnpm --dir apps/admin test:unit` (135 files, 1,604 tests) - `pnpm nx run @tryghost/admin:build` - `pnpm nx run-many -t test --exclude @tryghost/e2e --exclude ghost-admin --exclude @tryghost/koenig-lexical` (35 projects, including 8,000 Ghost tests) `pnpm check` completed repository-wide lint and documentation checks, but its aggregate test phase could not run Koenig Lexical's browser suite in this environment: Chromium was denied Mach port registration and the configured Firefox executable is absent. The broader test run above excludes only that environment-blocked package and passed.
ref https://linear.app/ghost/issue/PROD-53/
ref https://ghost.slack.com/archives/C07HTEJMR2R/p1745343216833259?thread_ts=1744898981.417349&cid=C07HTEJMR2R
Renamed flags to make more sense. trafficAnalytics for beta users, trafficAnalyticsAlpha for features we're developing for that beta.