Skip to content

Moved Newsletter tab out of alpha for Stats and Posts - #23294

Merged
9larsons merged 1 commit into
mainfrom
remove-alpha-news
May 12, 2025
Merged

9larsons merged 1 commit into
mainfrom
remove-alpha-news

Conversation

@9larsons

Copy link
Copy Markdown
Contributor

no ref

Removed feature flag for listing these tabs in the Stats and Posts apps.

no ref

Removed feature flag for listing these tabs in the Stats and Posts apps.
@9larsons
9larsons enabled auto-merge (squash) May 12, 2025 18:53
@coderabbitai

coderabbitai Bot commented May 12, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes across multiple files remove feature flag checks that previously controlled the visibility and access to "Newsletter" or "Newsletters" analytics features. Code responsible for importing and using feature flag logic, such as higher-order components and conditional rendering based on the labs.trafficAnalyticsAlpha flag, has been commented out or deleted. As a result, "Newsletter" analytics routes and sidebar links are now always rendered and accessible, regardless of any feature flag settings. No changes were made to the signatures or exports of public entities in any of the affected components.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/posts/src/views/PostAnalytics/components/Sidebar.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react-hooks".

(The package "eslint-plugin-react-hooks" was not found when loaded as a Node module from the directory "/apps/posts".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react-hooks@latest --save-dev

The plugin "eslint-plugin-react-hooks" was referenced from the config file in "apps/posts/.eslintrc.cjs".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

apps/stats/src/routes.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react-hooks".

(The package "eslint-plugin-react-hooks" was not found when loaded as a Node module from the directory "/apps/stats".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react-hooks@latest --save-dev

The plugin "eslint-plugin-react-hooks" was referenced from the config file in "apps/stats/.eslintrc.cjs".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

apps/posts/src/routes.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react-hooks".

(The package "eslint-plugin-react-hooks" was not found when loaded as a Node module from the directory "/apps/posts".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react-hooks@latest --save-dev

The plugin "eslint-plugin-react-hooks" was referenced from the config file in "apps/posts/.eslintrc.cjs".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

  • 1 others

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f9bded and 8f73abc.

📒 Files selected for processing (5)
  • apps/posts/src/routes.tsx (2 hunks)
  • apps/posts/src/views/PostAnalytics/components/Sidebar.tsx (2 hunks)
  • apps/stats/src/routes.tsx (2 hunks)
  • apps/stats/src/views/Stats/layout/Sidebar.tsx (2 hunks)
  • ghost/admin/app/components/posts/analytics.hbs (0 hunks)
💤 Files with no reviewable changes (1)
  • ghost/admin/app/components/posts/analytics.hbs
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Admin tests - Chrome
  • GitHub Check: Unit tests (Node 20.11.1)
  • GitHub Check: Unit tests (Node 22.13.1)
  • GitHub Check: Lint
🔇 Additional comments (4)
apps/posts/src/views/PostAnalytics/components/Sidebar.tsx (1)

3-4: Successfully removed feature flag gating for Newsletter tab

The removal of code that checked for the labs.trafficAnalyticsAlpha feature flag ensures the Newsletter tab is now permanently available for all users. This change corresponds with the PR's objective of moving the Newsletter functionality out of alpha.

Also applies to: 11-12, 30-35

apps/posts/src/routes.tsx (1)

6-6: Successfully removed feature flag protection for Newsletter route

Good job removing the feature flag protection and updating the route to directly render the Newsletter component. Keeping the commented-out example code provides helpful documentation for future feature flag implementations.

Also applies to: 10-12, 38-38

apps/stats/src/views/Stats/layout/Sidebar.tsx (1)

3-4: Successfully removed feature flag gating for Newsletters sidebar link

The commented-out code for feature flag checking and unconditional rendering of the Newsletters link is consistent with the PR objective of moving Newsletter functionality out of alpha status.

Also applies to: 10-11, 23-28

apps/stats/src/routes.tsx (1)

7-7: Successfully removed feature flag protection for Newsletters route

You've correctly removed the feature flag protection and updated the route to directly render the Newsletters component. The change is consistent with the PR objective and matches the pattern applied in the other modified files.

Also applies to: 12-13, 40-40

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@9larsons
9larsons disabled auto-merge May 12, 2025 18:54
@9larsons
9larsons enabled auto-merge (squash) May 12, 2025 18:54
@9larsons
9larsons merged commit f0a33b8 into main May 12, 2025
@9larsons
9larsons deleted the remove-alpha-news branch May 12, 2025 18:59
cmraible added a commit that referenced this pull request Aug 20, 2026
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.
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.

1 participant