Agents Manager: Make is_enabled() a public static method#47302
Conversation
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>
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 1 file.
|
There was a problem hiding this comment.
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()fromprivatetopublic static - Changed
is_block_editor()fromprivatetoprivate static - Updated some internal
$this->is_enabled()and$this->is_block_editor()calls to useself::
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.
There was a problem hiding this comment.
Maybe this is worth adding some tests in Agents_Manager_Test? Seems like new public methods we could easily cover with unit tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
aaronfc
left a comment
There was a problem hiding this comment.
Looks good and makes sense to me.
Summary
Agents_Manager::is_enabled()fromprivatetopublic staticso external consumers (e.g. Big Sky plugin) can call it directly instead of duplicating the filter-based enablement logic.is_block_editor()private staticsince it uses no instance state (called byis_enabled()).$this->is_enabled()calls toself::is_enabled().Testing instructions
\A8C\FSE\Agents_Manager::is_enabled()is callable statically from external code (e.g. viawp shellor 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