Skip to content

Conversation

@coder-karen
Copy link
Contributor

@coder-karen coder-karen commented Dec 4, 2025

Fixes SYNC-176

Proposed changes:

  • On some sites, site code/localization can change the checkout duration and preprocessing duration (cd and pd params in the /jetpack-sync-actions REST url) to include commas, which is then rejected as invalid numbers (400 rest_invalid_param).
  • In the Jetpack debugger Incremental Sync section this shows as sync errors, specifically jetpack_sync_send_error_rest_invalid_param, mentioning Invalid parameter(s): cd, pd
  • As a note, while it's unclear what caused the reported issue (see Linear link above), this fix will prevent the issue if those param encodings are modified up to and including jetpack_sync_send_data_query_args.
  • This fix only includes checks for commas to keep things as simple as possible for now.

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'll see a generated comment below with a script to run)?

Jetpack product discussion

SYNC-176

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

No.

Testing instructions:

To replicate the issue on trunk (on a self-hosted site, with Jetpack connected):

  • Add the following code snippet via a code snippets plugin to force-edit the cd and pd query params via the jetpack_sync_send_data_query_args filter to use commas instead of dots:
add_filter( 'jetpack_sync_send_data_query_args', function ( $args ) {
	if ( isset( $args['cd'] ) ) {
		$args['cd'] = str_replace( ',', '.', (string) $args['cd'] );
	}
	if ( isset( $args['pd'] ) ) {
		$args['pd'] = str_replace( ',', '.', (string) $args['pd'] );
	}
	return $args;
}, 20 );
  • Make a tiny edit to a post, or any small action that will be synced.
  • Observe the 'incremental sync' section of the Jetpack debugger for the site, and you should see jetpack_sync_send_error_rest_invalid_param errors.
  • Visit Logstash to confirm that a 400 status is reported for the endpoint, and confirm that the cd and pd values are using encoded commas (where the comma becomes %2C): 271d7819c28f463515c4a76ee48e0f7c-logstash (replace the request URL blog ID with your own).

To test the fix:

  • Apply this PR, and follow the same steps as above. There should not be any errors in the debugger and Logstash should show a success 200 status for the synced action.

@coder-karen coder-karen self-assigned this Dec 4, 2025
@coder-karen coder-karen added [Type] Bug When a feature is broken and / or not performing as intended [Status] In Progress labels Dec 4, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 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 or WordPress.com Site Helper), and enable the update/sync-class-actions-normalize-duration-params branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/sync-class-actions-normalize-duration-params
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/sync-class-actions-normalize-duration-params

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 Dec 4, 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!

@jp-launch-control
Copy link

jp-launch-control bot commented Dec 4, 2025

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/sync/src/class-actions.php 176/400 (44.00%) 0.42% 0 💚

Full summary · PHP report · JS report

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

Labels

[Package] Sync [Status] In Progress [Tests] Includes Tests [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.

2 participants