feat(ai-module): implement AI_Module — register generate-summary ability (#98)#108
Merged
Conversation
1267389 to
0248db7
Compare
An error occurred while trying to automatically change base from
feat/email-module-97
to
develop
May 19, 2026 16:56
…ity (#98) AI_Module::boot() defers the sybgo/generate-summary ability registration to the 'init' hook at priority 5 so __() evaluates after the text domain loads. Removes the now-redundant init_abilities() method from Sybgo — both abilities are owned by their respective modules (Event_Module and AI_Module). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Module Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22b7f7a to
c5d904f
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
AI_Module::boot()now owns thesybgo/generate-summaryWordPress 7 Ability registration, removing the last domain-specific responsibility fromSybgo::init_abilities()— which is now deleted. All five feature modules are functionally wired for their ability registrations.Closes #98
Type of change
Detailed scenario
What was tested
No manual testing performed for this sub-task. The change is a pure internal code reorganization: the
sybgo/generate-summaryability was previously registered insideSybgo::init_abilities()via an anonymous closure and is now registered insideAI_Module::boot()via a public named class. The external behaviour (which WP7 ability is registered, its label, permission, and execute callback logic) is identical.Automated coverage: 4 new unit tests in
AIModuleTestverify the deferred registration pattern, that the ability name and args are correct, and that the execute callback returnsnullwhen the AI summariser is unavailable or no frozen report exists.How to test
sybgo/generate-summaryability is registered:wp ability list --fields=name,label | grep sybgosybgo/generate-summarywith label "Generate Weekly Summary" is present.Ability_Manager).cd wp-plugin && vendor/bin/phpunit --testsuite Unit --filter AIModuleTestExpected: 4 tests, all green.
Affected Features & Quality Assurance Scope
sybgo/generate-summaryregistration timing and registration pathSybgo::init()orchestration (removal ofinit_abilities()call and method)Technical description
Documentation
AI_Module::boot()wraps the ability registration inadd_action('init', ..., 5)so that__()evaluates after thesybgotext domain loads (calling__()duringplugins_loadedon WP 6.7+ triggers_doing_it_wrong()→trigger_error(), which would be captured by Error_Tracker and pollute event counts).Ability_Manager::init()is deferred toinitat priority 20 fromSybgo::init(), guaranteeing that all modules'register()calls at priority 5 complete before the manager wires abilities into WP.With this PR,
Sybgo::init_abilities()is fully empty and has been removed along with its call ininit().See wp-plugin/docs/development.md — new "WP7 Ability API Registrations" section documents both registered abilities and the priority ordering rationale.
New dependencies
None.
Risks
None identified. The ability registration logic and execute callback are byte-for-byte identical to the removed
init_abilities()closure — only the ownership and testability change.Mandatory Checklist
Code validation
Code style
Unticked items justification
Manual validation in "What was tested" is not applicable: this is a pure internal reorganisation with no UI change. The existing E2E test suite covers the AI summary button end-to-end; the unit tests cover the registration path directly.
Additional Checks