Skip to content

Agents Manager: Make is_enabled() a public static method#47302

Merged
jom merged 2 commits intotrunkfrom
update/agents-manager-is-enabled-static
Feb 25, 2026
Merged

Agents Manager: Make is_enabled() a public static method#47302
jom merged 2 commits intotrunkfrom
update/agents-manager-is-enabled-static

Conversation

@jom
Copy link
Member

@jom jom commented Feb 24, 2026

Summary

  • Changes Agents_Manager::is_enabled() from private to public static so external consumers (e.g. Big Sky plugin) can call it directly instead of duplicating the filter-based enablement logic.
  • Also makes is_block_editor() private static since it uses no instance state (called by is_enabled()).
  • Updates internal $this->is_enabled() calls to self::is_enabled().

Testing instructions

  1. On a site with Agents Manager active (proxied Simple or WoA), verify it loads correctly in:
    • wp-admin (standard admin pages)
    • Block editor (new post/page)
    • Frontend (logged in as editor)
  2. Verify \A8C\FSE\Agents_Manager::is_enabled() is callable statically from external code (e.g. via wp shell or a test plugin).

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

No, this is a pure visibility/signature change with no new data handling.

🤖 Generated with Claude Code

Allow external consumers (e.g. Big Sky) to call Agents_Manager::is_enabled()
directly instead of duplicating the filter-based enablement logic.

Also makes is_block_editor() static since it uses no instance state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 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 (WordPress.com Site Helper), and enable the update/agents-manager-is-enabled-static branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/agents-manager-is-enabled-static

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 Feb 24, 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!

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Feb 24, 2026
@jp-launch-control
Copy link

jp-launch-control bot commented Feb 24, 2026

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/jetpack-mu-wpcom/src/features/agents-manager/class-agents-manager.php 232/345 (67.25%) 0.29% -1 💚

Full summary · PHP report

@jom jom marked this pull request as ready for review February 25, 2026 11:23
Copilot AI review requested due to automatic review settings February 25, 2026 11:23
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 makes the Agents_Manager::is_enabled() method public static to allow external consumers (like the Big Sky plugin) to check enablement without duplicating filter logic. It also makes is_block_editor() private static for consistency since it uses no instance state.

Changes:

  • Changed is_enabled() from private to public static
  • Changed is_block_editor() from private to private static
  • Updated some internal $this->is_enabled() and $this->is_block_editor() calls to use self::

Reviewed changes

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

File Description
projects/packages/jetpack-mu-wpcom/src/features/agents-manager/class-agents-manager.php Modified method signatures to static and updated several internal calls to use static syntax
projects/packages/jetpack-mu-wpcom/changelog/update-agents-manager-is-enabled-static Added changelog entry documenting the API change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this is worth adding some tests in Agents_Manager_Test? Seems like new public methods we could easily cover with unit tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

On it!

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

@aaronfc aaronfc left a comment

Choose a reason for hiding this comment

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

Looks good and makes sense to me.

@jom jom merged commit d5e744f into trunk Feb 25, 2026
69 checks passed
@jom jom deleted the update/agents-manager-is-enabled-static branch February 25, 2026 12:28
@github-actions github-actions bot removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Status] In Progress labels Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants