Skip to content

Conversation

@chihsuan
Copy link
Member

@chihsuan chihsuan commented Nov 6, 2025

Fixes p1762444618534419-slack-CK365S85V

Proposed changes:

This PR fixes issues with the proxy speed module installation introduced in #45243:

  • Add writability checks for the mu-plugins directory before attempting to copy
  • Verify source file existence before copying
  • Use trailingslashit() for proper path handling across different environments
  • Only update version option after successful copy

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you will see a generated comment below with a script to run)?

Jetpack product discussion

n/a

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

n/a

Testing instructions:

Follow the same testing instructions as #45243 (steps 1~6) to verify the proxy speed module is still correctly installed/removed when Jetpack is activated/deactivated.

Additional edge case testing:

  1. Test with read-only mu-plugins directory:

    • Make the wp-content/mu-plugins directory read-only: chmod 555 wp-content/mu-plugins
    • Activate Jetpack
    • Verify the proxy speed module is not added to mu-plugins
    • Check the wp-content/debug.log and verify no errors are logged related to woocommerce-analytics package
    • Restore permissions: chmod 755 wp-content/mu-plugins
  2. Verify file operations work correctly on different server configurations with various filesystem permissions

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the fix/woocomerce-analytics-proxy-speed-copy branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack fix/woocomerce-analytics-proxy-speed-copy

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

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 a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ 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!

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Nov 6, 2025
@chihsuan chihsuan added [Type] Bug When a feature is broken and / or not performing as intended [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Nov 6, 2025
@chihsuan chihsuan requested a review from Copilot November 6, 2025 21:25
@chihsuan chihsuan self-assigned this Nov 6, 2025
@chihsuan chihsuan requested a review from a team November 6, 2025 21:25
@jp-launch-control
Copy link

jp-launch-control bot commented Nov 6, 2025

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/woocommerce-analytics/src/class-woocommerce-analytics.php 0/98 (0.00%) 0.00% 22 💔

Full summary · PHP report · JS report

Coverage check overridden by Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR .

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the WooCommerce Analytics proxy speed module installation by transitioning to the WP_Filesystem API and adding robust error handling throughout the file copy process.

Key Changes:

  • Migrated from native PHP copy() to WP_Filesystem API for better WordPress compatibility
  • Added validation checks for directory writability and source file existence
  • Moved version option update to occur only after successful file copy

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
projects/packages/woocommerce-analytics/src/class-woocommerce-analytics.php Refactored file copy operations to use WP_Filesystem API with additional error handling and path normalization using trailingslashit()
projects/packages/woocommerce-analytics/changelog/fix-woocomerce-analytics-proxy-speed-copy Added changelog entry documenting the fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chihsuan chihsuan force-pushed the fix/woocomerce-analytics-proxy-speed-copy branch from 036cd16 to 02fb505 Compare November 12, 2025 07:31
@kangzj kangzj requested a review from Copilot November 24, 2025 21:04
chihsuan and others added 6 commits November 25, 2025 10:05
…tability and source file existence, improve error logging, and ensure proper file copying.
…ce-analytics-proxy-speed-copy

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@kangzj kangzj left a comment

Choose a reason for hiding this comment

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

Addressed feedback from Copilot and tried to make it more robust too. And now I think it's ready to go!

PS: we might want to work with Atomic team to add the module?

@kangzj kangzj added the Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR label Nov 24, 2025
@kangzj kangzj merged commit 88386db into trunk Nov 24, 2025
96 of 97 checks passed
@kangzj kangzj deleted the fix/woocomerce-analytics-proxy-speed-copy branch November 24, 2025 22:06
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Nov 24, 2025
@chihsuan
Copy link
Member Author

Addressed feedback from Copilot and tried to make it more robust too. And now I think it's ready to go!

PS: we might want to work with Atomic team to add the module?

Thanks for reviewing and merging this! @kangzj Yeah, I think we need to find a way to add the module for Atomic sites. I’ll reach out to the Atomic team to see if they have any suggestions.

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

Labels

Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR [Feature] WooCommerce Analytics [Package] WooCommerce Analytics Enhanced analytics for WooCommerce users [Type] Bug When a feature is broken and / or not performing as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants