Skip to content

Conversation

@sbarbosa
Copy link
Contributor

Part of ADS-626

Proposed changes:

We are working to reduce the initial delay users experience in Blaze when they first connect their site to Jetpack.
This PR handles the "advise campaign" call in the Blaze flow and provides additional post information to WPCOM, allowing users to promote content sooner.

  • Add a new handler for the /templates/advise/campaign/:urn endpoint that provides additional information to WPCOM when the site is still syncing post information.
  • Whitelists the root controller /dsp/api/v1/advise, which we are going to start using in the near future.

Other information:

This is part of a broader effort to improve the initial delay time for the Blaze Ads plugin. We plan to also change the /templates/article endpoint and the /campaigns endpoint (which are the ones we require additional post information for).

Jetpack product discussion

N/A

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

No

Testing instructions:

  • Create an ephemeral site with the Jetpack plugin, and also Jetpack Beta pointing to this branch (Don't connect it to Jetpack yet)
  • Create a new post and add some content (you can a featured image if you like, but it will work either way).
  • Get the Post ID and generate this URL:
    https://{SITE_HOST}/wp-admin/tools.php?page=advertising#!/advertising/posts/promote/post-{POST_ID}/{SITE_HOST}
    One example: https://helpful-tiger-mountain.jurassic.ninja/wp-admin/tools.php?page=advertising#!/advertising/posts/promote/post-5/helpful-tiger-mountain.jurassic.ninja
  • Open the generated URL in another tab, then open the browser network inspector and filter requests by advise (You will get an access error on the page, that's fine)
  • Now, on a different tab, go and connect your site with Jetapck
  • After the connection is done, go to the previous tab with the access error and refresh the page
  • You should see an answer now from the /templates/advise endpoint, and in the answer, the prop sync_ready: false should appear.

This happens when we execute the local version of the article template that we included in this PR. You won't be able to continue the flow, because we still need to change other endpoints, but this test should be enough to test the change

@sbarbosa sbarbosa self-assigned this Jan 15, 2026
@sbarbosa sbarbosa added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress [Package] Blaze Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR labels Jan 15, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 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 add/local-handling-of-blaze-advise-endpoint branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/local-handling-of-blaze-advise-endpoint
bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/local-handling-of-blaze-advise-endpoint

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

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!

@jp-launch-control
Copy link

jp-launch-control bot commented Jan 15, 2026

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/blaze/src/class-dashboard-rest-controller.php 0/605 (0.00%) 0.00% 69 💔

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 .

Base automatically changed from add/local-handling-of-blaze-article-endpoint to trunk January 19, 2026 14:03
@sbarbosa sbarbosa marked this pull request as ready for review January 19, 2026 14:53
Copilot AI review requested due to automatic review settings January 19, 2026 14:53
@sbarbosa sbarbosa added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Jan 19, 2026
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 adds local handling for the Blaze "advise campaign" endpoint to reduce initial delay when users first connect their site to Jetpack. When posts aren't yet synced via Jetpack Sync, the endpoint reads local database data and provides additional post information to WPCOM, allowing users to promote content sooner.

Changes:

  • Add handler for /templates/advise/campaign/:urn endpoint that provides post data locally when sync is not ready
  • Add handler for /advise/campaign/:urn endpoint with similar local fallback logic
  • Whitelist the root /dsp/api/v1/advise controller for future use

Reviewed changes

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

File Description
projects/packages/blaze/src/class-dashboard-rest-controller.php Adds new REST route registrations and handler methods for advise campaign endpoints with local fallback when Jetpack Sync is not ready
projects/packages/blaze/changelog/add-local-handling-of-blaze-advise-endpoint Adds changelog entry describing the improvement to post promotion speed

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

@EkaterinaStancheva EkaterinaStancheva left a comment

Choose a reason for hiding this comment

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

The code looks good to me! 👍 I tested it, and it works as described! Thank you!

Just to clarify - Based on the PR description, I see that /dsp/api/v1/advise is being whitelisted for future use. Do we plan to move to /advise/campaign/ and remove /templates/advise/campaign/ in the future?

@sbarbosa
Copy link
Contributor Author

The code looks good to me! 👍 I tested it, and it works as described! Thank you!

Just to clarify - Based on the PR description, I see that /dsp/api/v1/advise is being whitelisted for future use. Do we plan to move to /advise/campaign/ and remove /templates/advise/campaign/ in the future?

Yes, that's the idea. When the /advice functionality was implemented, they temporarily put it behind the templates controller because it was already whitelisted in Jetpack (and they didn't want to wait for a Jetpack release to launch it for all users).

The main problem was that we didn't create the corresponding Jetpack PR that whitelists the /advise controller. After we merge this PR and wait for a good amount of time for the sites to upgrade the Jetpack version, we will be able to switch the call in the clients.

@sbarbosa sbarbosa merged commit 1b3714c into trunk Jan 20, 2026
71 checks passed
@sbarbosa sbarbosa deleted the add/local-handling-of-blaze-advise-endpoint branch January 20, 2026 12:32
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Jan 20, 2026
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 [Package] Blaze [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