Skip to content

Blaze: extract campaign preparer (ADS-1036)#48570

Open
j6ll wants to merge 2 commits intoadd/ads-953-blaze-create-campaign-abilityfrom
add/ads-1036-campaign-preparer
Open

Blaze: extract campaign preparer (ADS-1036)#48570
j6ll wants to merge 2 commits intoadd/ads-953-blaze-create-campaign-abilityfrom
add/ads-1036-campaign-preparer

Conversation

@j6ll
Copy link
Copy Markdown
Member

@j6ll j6ll commented May 6, 2026

Fixes ADS-1036

Proposed changes

  • Extract prepare-campaign target resolution, default derivation, prefill payload construction, and prefill URL creation into Campaign_Preparer.
  • Keep Blaze_Abilities focused on registration, permissions, guardrails, and MCP-specific message formatting.
  • Add focused preparer tests for structured output, target hard stops, overrides, and language/country normalization.

Related product discussion/links

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

No. This refactors existing prepare-campaign behavior behind the same public response and does not add tracking.

Testing instructions

  • From projects/packages/blaze, run composer run phpunit -- --filter Campaign_Preparer_Test.
  • From projects/packages/blaze, run composer run phpunit -- --filter Blaze_Abilities_Test.
  • From projects/packages/blaze, run composer run phpunit -- --filter 'Campaign_Preparer_Test|Blaze_Abilities_Test'.
  • From the repo root, run php -l projects/packages/blaze/src/class-campaign-preparer.php && php -l projects/packages/blaze/src/abilities/class-blaze-abilities.php && php -l projects/packages/blaze/tests/php/Campaign_Preparer_Test.php.

Note: I also ran the full Blaze package PHPUnit suite locally; the preparer and ability tests passed, but the full suite hit the existing Dashboard_Test::test_load_admin_scripts style assertion because ignored local projects/packages/blaze/dist/build.min.* files make the dashboard load local assets instead of CDN assets in this checkout.

@j6ll j6ll added [Status] Needs Review This PR is ready for review. Enhancement Changes to an existing feature — removing, adding, or changing parts of it labels May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 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/ads-1036-campaign-preparer branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/ads-1036-campaign-preparer
bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/ads-1036-campaign-preparer

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
Copy Markdown
Contributor

github-actions Bot commented May 6, 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!

@jp-launch-control
Copy link
Copy Markdown

jp-launch-control Bot commented May 6, 2026

Code Coverage Summary

Cannot generate coverage summary while tests are failing. 🤐

Please fix the tests, or re-run the Code coverage job if it was something being flaky.

Full summary · PHP report · JS report

@j6ll
Copy link
Copy Markdown
Member Author

j6ll commented May 6, 2026

Quick ADS-1036 test/status pass — 2026-05-06

Local focused Blaze tests pass:

cd projects/packages/blaze
composer phpunit -- tests/php/Campaign_Preparer_Test.php tests/php/abilities/Blaze_Abilities_Test.php
# OK (20 tests, 103 assertions)

Status notes:

  • PR is open and non-draft.
  • Linear ADS-1036 is already in review, which still looks like the right status.
  • CI is not fully settled/green yet. The WP Cloud wpcomsh PHPUnit job failed before running tests with: Unable to run a basic wp command! Something is wrong with the site.
  • The main Tests workflow was still in progress when checked; it already showed failures for PHP 7.3 WP latest and PHP 7.4 WP latest with WooCommerce, but GitHub would not expose failed logs until the run completes.

Next action: wait for the remaining CI logs/rerun signal before marking ADS-1036 complete. ADS-1044 is now the right follow-up for the broader audience targeting options contract.

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

Labels

Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Package] Blaze [Status] Needs Review This PR is ready for review. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant