Skip to content

Conversation

@fgiannar
Copy link
Contributor

@fgiannar fgiannar commented Jan 21, 2026

Closes SYNC-218

Proposed changes:

  • Added a pop_newest() method to remove items from the end of the queue (newest items first)
  • Modified queue storage implementations to support sorting items in descending order
  • Updated the Settings class to remove the two redundant updated_option actions when Dedicated Sync fails to enable
  • Added tests to verify the queue methods and the fix behaviour

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-218

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

No

Testing instructions:

  • Disable Dedicated sync via the JP Debugger - Sync settings section
  • Sabotage the Dedicated Sync flow by modifying this line to echo anything but Dedicated_Sender::DEDICATED_SYNC_VALIDATION_STRING
  • Enable Dedicated sync via the JP Debugger - Sync settings section
  • Note that on trunk we sync the update_option action for jetpack_sync_settings_dedicated_sync_enabled option
  • Confirm this is not the case on current branch

Important: When testing multiple times you'll probably need to remove this transient after each test. In cli run: wp transient delete jetpack_sync_dedicated_sync_spawn_check

@fgiannar fgiannar self-assigned this Jan 21, 2026
@fgiannar fgiannar added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress [Package] Sync labels Jan 21, 2026
Copilot AI review requested due to automatic review settings January 21, 2026 10:58
@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests labels Jan 21, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 21, 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!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: February 3, 2026
    • Code freeze: February 3, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 21, 2026

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/stop-sending-redundant-dedicated_sync_enabled-actions branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/stop-sending-redundant-dedicated_sync_enabled-actions
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/stop-sending-redundant-dedicated_sync_enabled-actions

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

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 addresses an issue where redundant sync actions were being sent when Dedicated Sync failed to enable. The fix removes the two updated_option actions from the sync queue when the Dedicated Sync spawn test fails.

Changes:

  • Added a pop_newest() method to remove items from the end of the queue (newest items first)
  • Modified queue storage implementations to support sorting items in descending order
  • Updated the Settings class to remove the two redundant updated_option actions when Dedicated Sync fails to enable
  • Added tests to verify the queue methods and the fix behavior

Reviewed changes

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

Show a summary per file
File Description
projects/packages/sync/src/class-settings.php Removes the two newest queue items when Dedicated Sync enable fails
projects/packages/sync/src/class-queue.php Adds pop_newest() method and updates fetch_items() to support DESC ordering
projects/packages/sync/src/sync-queue/class-queue-storage-table.php Refactors fetch_items() to accept an order parameter and simplifies SQL query construction
projects/packages/sync/src/sync-queue/class-queue-storage-options.php Refactors fetch_items() to accept an order parameter and simplifies SQL query construction
projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Settings_Test.php Adds test verification that no data is synced when Dedicated Sync fails to enable
projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Queue_Test.php Adds tests for the new pop() and pop_newest() queue methods
projects/packages/sync/changelog/update-stop-sending-redundant-dedicated_sync_enabled-actions Changelog entry for the sync package changes
projects/plugins/jetpack/changelog/update-stop-sending-redundant-dedicated_sync_enabled-actions Changelog entry for the Jetpack plugin changes

@jp-launch-control
Copy link

jp-launch-control bot commented Jan 21, 2026

Code Coverage Summary

Coverage changed in 5 files.

File Coverage Δ% Δ Uncovered
projects/packages/sync/src/class-queue.php 55/193 (28.50%) 4.61% 1 ❤️‍🩹
projects/packages/sync/src/class-settings.php 65/162 (40.12%) 2.87% 1 ❤️‍🩹
projects/packages/sync/src/class-listener.php 33/160 (20.62%) 0.62% -1 💚
projects/packages/sync/src/sync-queue/class-queue-storage-table.php 0/234 (0.00%) 0.00% -5 💚
projects/packages/sync/src/sync-queue/class-queue-storage-options.php 30/96 (31.25%) 15.09% -17 💚

Full summary · PHP report · JS report

Copilot AI review requested due to automatic review settings January 21, 2026 11:55
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 8 out of 8 changed files in this pull request and generated 2 comments.

@fgiannar fgiannar added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Jan 21, 2026
@fgiannar fgiannar requested a review from coder-karen January 21, 2026 13:48
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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 8 out of 8 changed files in this pull request and generated 3 comments.

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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 8 out of 8 changed files in this pull request and generated 4 comments.

Copilot AI review requested due to automatic review settings January 22, 2026 13:49
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 8 out of 8 changed files in this pull request and generated 2 comments.

Copy link
Contributor

@coder-karen coder-karen left a comment

Choose a reason for hiding this comment

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

This tests well for me, thanks for working on this!

@fgiannar fgiannar force-pushed the update/stop-sending-redundant-dedicated_sync_enabled-actions branch from 60930b7 to 0419fff Compare January 23, 2026 05:52
@fgiannar fgiannar merged commit 79d0e31 into trunk Jan 23, 2026
90 checks passed
@fgiannar fgiannar deleted the update/stop-sending-redundant-dedicated_sync_enabled-actions branch January 23, 2026 06:11
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Jan 23, 2026
@github-actions github-actions bot added this to the jetpack/15.5 milestone Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Sync [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants