Extract Ability_Manager as a WP7 ability registration utility#91
Merged
Conversation
This was referenced May 18, 2026
71493b9 to
5763c91
Compare
…tion utility Part of EPIC #86. Closes #88. - Move Ability_Manager into wp-plugin/class-ability-manager.php - Pure registration utility: register(name, args) + init() - Guard wp_register_ability existence (WP7+ only) - Defer __() evaluation to 'init' hook to avoid WP 6.7+ early-textdomain _doing_it_wrong() notices being captured by Error_Tracker - Add AbilityManagerTest unit tests - Update architecture docs
5763c91 to
ee308cf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Extracts the WordPress 7 Ability API wiring out of
class-sybgo.phpinto a dedicatedAbility_Managerclass.Ability_Manageris a pure registration utility: callers declare abilities viaregister(), andinit()handles the WP7 API wiring. Wiring declarations (callbacks, labels, permissions) live in a newSybgo::init_abilities()private sub-method, which acts as the composition root for WP7 abilities.Closes #88
Type of change
Detailed scenario
What was tested
No manual testing required — this is a pure internal refactor with no user-visible behaviour change. The plugin initialises identically on WP < 7 (no abilities registered) and on WP 7+ (both abilities wired on
wp_abilities_api_init). Verified by running the unit test suite: all 42 tests pass.How to test
wp_register_ability): confirmsybgo/generate-summaryandsybgo/track-eventsare registered on thewp_abilities_api_initaction.vendor/bin/phpunit --testsuite Unit— all tests pass.Affected Features & Quality Assurance Scope
class-sybgo.php)sybgo_init_api)Technical description
Documentation
Ability_Manager(wp-plugin root) accumulates ability definitions in a private$abilitiesarray viaregister(string $name, array $args). Wheninit()is called, it checks forwp_register_abilityviafunction_existsand, if present, hooks a closure onwp_abilities_api_initthat loops over$abilitiesand callswp_register_ability()for each.The public extensibility API (
sybgo_init_api) and ability registration are both handled bySybgo::init_abilities(), a new private sub-method ofSybgo::init(). This follows the same pattern asinit_event_tracking()—Sybgo::init()remains a thin orchestrator that delegates to private sub-methods.Architecture notes in
lib/docs/ai-transport.mdupdated to referenceAbility_Managerinstead of the removedSybgo::register_abilities(). Project structure inwp-plugin/docs/development.mdupdated.Class responsibilities
Ability_Managerinit()Sybgo::init_abilities()sybgo_init_api(), declares both abilities with closures, callsAbility_Manager::init()New dependencies
None.
Risks
None identified. This is a pure internal refactor — no public API, hook names, or user-visible behaviour changes.
Mandatory Checklist
Code validation
Code style
Unticked items justification
N/A — all items applicable and ticked.
Additional Checks
Observability and error handling are not applicable:
Ability_Manageris a registration utility with no I/O operations.