Skip to content

Random Redirect: test existing function compatibility - #51041

Open
chrisbliss18 wants to merge 3 commits into
trunkfrom
agent/random-redirect-function-conflict-test
Open

Random Redirect: test existing function compatibility#51041
chrisbliss18 wants to merge 3 commits into
trunkfrom
agent/random-redirect-function-conflict-test

Conversation

@chrisbliss18

@chrisbliss18 chrisbliss18 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

  • Add regression coverage for the Random Redirect function conflict fixed by Random Redirect: only declare the redirect function when nothing else has #51037.
  • Run the compatibility check in a separate PHP process so a theme or plugin implementation can declare and hook jetpack_matt_random_redirect() before Jetpack loads its module.
  • Require Jetpack's module twice to verify repeated loads remain idempotent: the existing implementation is preserved and the callback is not registered again.
  • Expand behavior coverage for bare requests, invalid post-type fallback, POST requests, and unpublished posts.

This PR is stacked on #51037 so its test suite remains green. It can be retargeted to trunk after that PR merges.

Related product discussion/links

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

No.

Testing instructions

  1. Start and install the Jetpack Docker environment if needed:

    jp docker up -d
    jp docker install
  2. Run the Random Redirect tests:

    jp docker phpunit jetpack -- --filter=Random_Redirect_Test
  3. Confirm all 12 tests pass, including test_loads_with_existing_random_redirect_function.

Red/green behavior was also verified directly with the standalone fixture:

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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 agent/random-redirect-function-conflict-test branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack agent/random-redirect-function-conflict-test

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 github-actions Bot added the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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!


Jetpack 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.

@chrisbliss18
chrisbliss18 requested a review from haqadn August 4, 2026 20:21
@chrisbliss18 chrisbliss18 added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Aug 4, 2026
@chrisbliss18
chrisbliss18 marked this pull request as ready for review August 4, 2026 20:21
@cursor

cursor Bot commented Aug 4, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@jp-launch-control

jp-launch-control Bot commented Aug 4, 2026

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/modules/theme-tools/random-redirect.php 39/51 (76.47%) 1.96% -1 💚

Full summary · PHP report · JS report

haqadn
haqadn previously approved these changes Aug 4, 2026

@haqadn haqadn left a comment

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.

Looks good and tests well. Great job on the additional coverage.

Base automatically changed from fix/random-redirect-function-conflict to trunk August 4, 2026 21:11
@chrisbliss18
chrisbliss18 dismissed haqadn’s stale review August 4, 2026 21:11

The merge-base changed after approval.

@haqadn
haqadn force-pushed the agent/random-redirect-function-conflict-test branch from 0447bae to 09ac1a8 Compare August 4, 2026 21:11
@haqadn
haqadn force-pushed the agent/random-redirect-function-conflict-test branch from 09ac1a8 to 2b9666c Compare August 4, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress [Status] Needs Review This PR is ready for review. [Tests] Includes Tests Unit Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants