Skip to content

beta: Improve plugin page interaction#48490

Open
anomiex wants to merge 1 commit intotrunkfrom
update/beta-dont-hide-when-dev-is-only-version
Open

beta: Improve plugin page interaction#48490
anomiex wants to merge 1 commit intotrunkfrom
update/beta-dont-hide-when-dev-is-only-version

Conversation

@anomiex
Copy link
Copy Markdown
Contributor

@anomiex anomiex commented May 4, 2026

Proposed changes

Previously, when a -dev version is not active, it was always being hidden from the plugin page. This caused a few confusing interactions if there wasn't a non-dev version of the plugin also installed: you can't see it to delete it if you want to clean up your filesystem, and Core's plugin dependency feature might show a dependency from the hidden plugin.

This PR changes it to only hide the -dev version if the non-dev version is also present.

That causes another odd interaction: if you delete the non-dev version, then the dev version unexpectedly shows up. The sensible thing to do in that case is to delete the dev version when the non-dev version gets deleted; this PR hooks 'deleted_plugin' to do just that.

Related product discussion/links

p1777903294786299-slack-C05Q5HSS013

Does this pull request change what data or activity we track or use?

No

Testing instructions

  • Most straightforward way to test is to install release versions of WooCommerce and one or the other of WooPayments or WooCommerce Stripe Gateway, then install bleeding edge or a PR branch of both WooPayments and WooCommerce Stripe Gateway.
    • Verify only one copy of each plugin shows up in plugins.php.
    • Deactivate WooPayments and WooCommerce Stripe Gateway. Verify exactly one copy of each plugin shows up in plugins.php: release version for the one with that available, and bleeding edge for the one where that's the only version.
    • Delete each via the plugins.php UI, verifying that the release-version one doesn't come back with bleeding-edge after having deleted the former.

Previously, when a -dev version is not active, it was always being
hidden from the plugin page. This caused a few confusing interactions if
there wasn't a non-dev version of the plugin also installed: you can't
see it to delete it if you want to clean up your filesystem, and Core's
plugin dependency feature might show a dependency from the hidden
plugin.

This PR changes it to only hide the -dev version if the non-dev version
is also present.

That causes another odd interaction: if you delete the non-dev version,
then the dev version unexpectedly shows up. The sensible thing to do in
that case is to delete the dev version when the non-dev version gets
deleted; this PR hooks 'deleted_plugin' to do just that.
@anomiex anomiex self-assigned this May 4, 2026
@anomiex anomiex added the [Status] Needs Review This PR is ready for review. label May 4, 2026
@anomiex anomiex requested a review from a team as a code owner May 4, 2026 15:51
@github-actions github-actions Bot added the [Plugin] Beta For serving live branches and the beta versions. https://github.com/automattic/jetpack-beta label May 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Beta plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

Copy link
Copy Markdown
Contributor

@tbradsha tbradsha left a comment

Choose a reason for hiding this comment

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

I believe it's mostly working as intended.

  • When I deactivated a dev version of the plugin, the Plugins page then shows the release version of the plugin.
  • Activating again keeps the release version of the plugin.
  • Deleting it does indeed delete the dev version as well.
  • When I delete (via the filesystem) the release version, the dev version continues to show in the Plugins page. Deactivating it and reactivating it preserves its state in the Beta plugin.

I did see one weird issue. If I have a dev version of Beta active and delete the release version of Beta in the filesystem, then deactivate Beta from the plugins page, the dev version is removed from the filesystem. I'm guessing that's unrelated to this PR.

Out of scope, but it'd be nice if when there's ONLY the dev version installed, I could install the release version.

if ( ! $wp_filesystem ) {
return;
}
$working_dir = dirname( $plugin->dev_plugin_path() );
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.

But what if the $wp_filesystem is non-functional now?

if ( ! $deleted ) {
return;
}
$plugin = Plugin::get_plugin( dirname( $plugin_file ) );
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.

This confused me: the plugin is deleted, but then we're going to grab the plugin info? Turns out it's pulling from a cache that persists after the plugin itself is deleted.


add_filter( 'all_plugins', array( $this, 'update_all_plugins' ) );

add_filter( 'deleted_plugin', array( $this, 'maybe_delete_dev_plugin_too' ), 10, 2 );
Copy link
Copy Markdown
Contributor

@tbradsha tbradsha May 5, 2026

Choose a reason for hiding this comment

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

Semantics comment...it's an action, not a filter:
https://developer.wordpress.org/reference/hooks/deleted_plugin/

Suggested change
add_filter( 'deleted_plugin', array( $this, 'maybe_delete_dev_plugin_too' ), 10, 2 );
add_action( 'deleted_plugin', array( $this, 'maybe_delete_dev_plugin_too' ), 10, 2 );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Plugin] Beta For serving live branches and the beta versions. https://github.com/automattic/jetpack-beta [Pri] Normal [Status] Needs Review This PR is ready for review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants