feat(integrations): add ActionScheduler group handling#4559
feat(integrations): add ActionScheduler group handling#4559miguelpeixe merged 27 commits intotrunkfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces Action Scheduler “group” namespacing for Newspack so scheduled actions can be attributed and queried per integration/subsystem, and adds helper APIs to query those actions.
Changes:
- Assign integration-specific Action Scheduler groups (e.g.
newspack-integration-{$integration_id}) for retries and async contact pulls. - Move other subsystems to dedicated groups (e.g.
newspack-webhooks,newspack-sync) and update affected scheduling calls/tests. - Add a new
Newspack\Action_Schedulerutility class plus new query helpers on Integrations/Integration.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit-tests/reader-activation-sync.php | Updates assertions to look for per-integration AS groups. |
| tests/unit-tests/integrations/class-test-integrations.php | Adds unit tests for group-resolution helpers and filter behavior. |
| includes/reader-activation/sync/class-contact-sync.php | Schedules integration retry actions under integration-specific groups. |
| includes/reader-activation/sync/class-contact-sync-admin.php | Schedules bulk admin sync actions under a dedicated newspack-sync group. |
| includes/reader-activation/integrations/class-integration.php | Adds get_action_group() and get_scheduled_actions() convenience methods. |
| includes/reader-activation/integrations/class-contact-pull.php | Schedules async pulls under integration-specific groups and dedupes by that group. |
| includes/reader-activation/class-integrations.php | Adds group helpers, handler->group filter, and integration-scoped scheduled action querying. |
| includes/data-events/class-webhooks.php | Moves webhook AS actions to newspack-webhooks group. |
| includes/data-events/class-data-events.php | Adds filterable handler group resolution and uses it for handler retries/default dispatch group. |
| includes/class-newspack.php | Ensures the new Action Scheduler helper file is included. |
| includes/class-action-scheduler.php | Introduces a DB-backed helper for listing groups by prefix and querying actions by group(s). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
chickenn00dle
left a comment
There was a problem hiding this comment.
Looks good! Thanks @miguelpeixe
|
Hey @miguelpeixe, good job getting this PR merged! 🎉 Now, the Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label. If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label. Thank you! ❤️ |
* feat(access-control): init premium newsletters wizard pages * feat: adapt existing access control components for premium newsletters * chore: remove redundant unnecessary component * chore: rename variable for clarity * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * chore: remove unnecessary REST route * refactor: use tokenfield instead of checkboxes for newsletter lists * feat: add advanced settings modal * chore: rename config key for accuracy and set default to true * chore(icons): replace lockDoor with contentLocked and emailPremium icons * fix: premium newsletter UI fixes * fix: show SectionHeader secondaryActions as dropdown menu * fix: alignment of items in SectionHeader * feat: link gate titles to edit pages for convenience * fix: remove margin if form-token-field is the only child * feat: rename menu item * fix: move Gate Priority to menu instead of separate action * fix: proposed new page layout for Institutions wizard * fix: revert proposed Institutions page layout * refactor: reorganize some Content_Gate class methods into new subclasses * fix: advanced settings updates * chore: update translation files [skip ci] * feat(color-picker): simplify component to use basecontrol (#4581) * chore: update translation files [skip ci] * feat(components): add CardFeature component (#4583) * chore: update translation files [skip ci] * build(deps): bump google/auth from 1.42.0 to 1.50.1 (#4590) Bumps [google/auth](https://github.com/googleapis/google-auth-library-php) from 1.42.0 to 1.50.1. - [Release notes](https://github.com/googleapis/google-auth-library-php/releases) - [Changelog](https://github.com/googleapis/google-auth-library-php/blob/main/CHANGELOG.md) - [Commits](googleapis/google-auth-library-php@v1.42.0...v1.50.1) --- updated-dependencies: - dependency-name: google/auth dependency-version: 1.50.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feat(integrations): add ActionScheduler group handling (#4559) * chore: update translation files [skip ci] * fix: don't clear content rule tokens from state when switching options * fix: error handling for async requests * fix: error handling via Notice in all access control view components --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Thomas Guillot <thomas@automattic.com> Co-authored-by: matticbot <sysops+ghmatticbot@automattic.com> Co-authored-by: Thomas Guillot <thomasguillot@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Miguel Peixe <miguel.peixe@automattic.com>
…4589) * feat(access-control): init premium newsletters wizard pages * feat: adapt existing access control components for premium newsletters * chore: remove redundant unnecessary component * chore: rename variable for clarity * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * chore: remove unnecessary REST route * refactor: use tokenfield instead of checkboxes for newsletter lists * feat: add advanced settings modal * chore: rename config key for accuracy and set default to true * chore(icons): replace lockDoor with contentLocked and emailPremium icons * fix: premium newsletter UI fixes * fix: show SectionHeader secondaryActions as dropdown menu * fix: alignment of items in SectionHeader * feat: link gate titles to edit pages for convenience * fix: remove margin if form-token-field is the only child * feat: rename menu item * fix: move Gate Priority to menu instead of separate action * fix: proposed new page layout for Institutions wizard * fix: revert proposed Institutions page layout * feat(access-control): filter available lists by content restrictions * fix: potential fatal; move filter callback to Premium_Newsletters class * refactor: reorganize some Content_Gate class methods into new subclasses * fix: advanced settings updates * chore: update translation files [skip ci] * feat(color-picker): simplify component to use basecontrol (#4581) * chore: update translation files [skip ci] * feat(components): add CardFeature component (#4583) * chore: update translation files [skip ci] * build(deps): bump google/auth from 1.42.0 to 1.50.1 (#4590) Bumps [google/auth](https://github.com/googleapis/google-auth-library-php) from 1.42.0 to 1.50.1. - [Release notes](https://github.com/googleapis/google-auth-library-php/releases) - [Changelog](https://github.com/googleapis/google-auth-library-php/blob/main/CHANGELOG.md) - [Commits](googleapis/google-auth-library-php@v1.42.0...v1.50.1) --- updated-dependencies: - dependency-name: google/auth dependency-version: 1.50.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feat(integrations): add ActionScheduler group handling (#4559) * chore: update translation files [skip ci] * fix: don't clear content rule tokens from state when switching options * fix: error handling for async requests * fix: error handling via Notice in all access control view components * feat: auto-signup and remove readers from lists based on subscription * refactor: no need for namespace due to use statement * fix: filter user ID when rendering premium newsletter lists * fix: delete renamed wizard file * test: add unit tests for premium newsletters * fix: remove Registered Access options for newsletters * refactor: use evaluate_rules instead of custom logic for newsletter gates * fix: use Content_Restriction_Control::is_post_restricted in maybe_add_or_remove_lists * feat: debounce premium list updates via scheduled events * feat: also schedule access check for email domain + reader data updates * test: add tests for reader data and whitelisted email domains * chore: update access check delay to 10 minutes * chore: only filter restricted lists on front-end * Update includes/content-gate/class-premium-newsletters.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: add user ID to post/gate map cache * Update includes/reader-activation/class-reader-activation.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: avoid recursive data event loop for `reader_data_updated` * fix: return empty array when no gates are found * test: add tests for data event listeners * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: fix docblock * test: avoid fatal in case _get_cron_array() returns false * refactor: simplify queue processing with recurring events * test: fix unit tests * chore: fix outdated inline comment * chore: fix outdated inline comment * fix: better control of newspack_content_restriction_control_user_id filter * chore: outdated docblock * refactor: feedback from PR * refactor: use cron only for recurring access checks * refactor: remove redundant Data Event listeners * test: fix failing unit test * test: remove failing test --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Thomas Guillot <thomas@automattic.com> Co-authored-by: matticbot <sysops+ghmatticbot@automattic.com> Co-authored-by: Thomas Guillot <thomasguillot@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Miguel Peixe <miguel.peixe@automattic.com>
# [6.37.0-alpha.1](v6.36.1...v6.37.0-alpha.1) (2026-04-02) ### Bug Fixes * **card-settings-group:** change default actionType from chevron to none ([#4610](#4610)) ([00505ed](00505ed)) * **post-date:** preserve classic theme markup and fix archive titles ([#4602](#4602)) ([c5fb825](c5fb825)) * remove removal of block visibility ([#4595](#4595)) ([9396379](9396379)) ### Features * **access-control:** filter available lists by content restrictions ([#4589](#4589)) ([959127f](959127f)), closes [#4581](#4581) [#4583](#4583) [#4590](#4590) * **access-control:** premium newsletters UI ([#4577](#4577)) ([6f8c891](6f8c891)), closes [#4581](#4581) [#4583](#4583) [#4590](#4590) * **author-profile-social:** add support for colors, block spacing, brand style ([#4509](#4509)) ([21cf4c9](21cf4c9)) * campaigns wizard light UI refresh ([#4588](#4588)) ([6078c4b](6078c4b)) * **color-picker:** simplify component to use basecontrol ([#4581](#4581)) ([ff677ea](ff677ea)) * **components:** add CardFeature component ([#4583](#4583)) ([5aabb18](5aabb18)) * **content-gate:** institution management ui ([#4582](#4582)) ([ae88750](ae88750)) * **content-gate:** institutional access redirect and loading UX ([#4593](#4593)) ([548d236](548d236)) * **content-gate:** institutions ([#4574](#4574)) ([49b0c05](49b0c05)) * **content-gate:** personalized institutional access verification page ([#4596](#4596)) ([0eed591](0eed591)) * **image-upload:** simplify component to use basecontrol; remove info prop ([#4580](#4580)) ([d51eb54](d51eb54)) * **integrations:** add ActionScheduler group handling ([#4559](#4559)) ([411732a](411732a)) * **integrations:** promoted fields for content gate and campaign segmentation ([#4601](#4601)) ([f943df2](f943df2)) * **newspack-ui:** add stack layout and color utility classes ([#4600](#4600)) ([1934067](1934067)) * **post-date:** centralize date features from theme into plugin ([#4579](#4579)) ([19f15eb](19f15eb)) * **sync:** prevent stale data on retry, improve logging and error handling ([#4562](#4562)) ([5467f34](5467f34)) * **tags:** add private tags feature ([#4507](#4507)) ([06d7711](06d7711)) * **yoast:** add primary category utility and settings toggle ([#4563](#4563)) ([4b396c3](4b396c3))
|
🎉 This PR is included in version 6.37.0-alpha.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
# [6.37.0](v6.36.3...v6.37.0) (2026-04-13) ### Bug Fixes * **card-settings-group:** change default actionType from chevron to none ([#4610](#4610)) ([00505ed](00505ed)) * **post-date:** preserve classic theme markup and fix archive titles ([#4602](#4602)) ([c5fb825](c5fb825)) * remove removal of block visibility ([#4595](#4595)) ([9396379](9396379)) ### Features * **access-control:** filter available lists by content restrictions ([#4589](#4589)) ([959127f](959127f)), closes [#4581](#4581) [#4583](#4583) [#4590](#4590) * **access-control:** premium newsletters UI ([#4577](#4577)) ([6f8c891](6f8c891)), closes [#4581](#4581) [#4583](#4583) [#4590](#4590) * **author-profile-social:** add support for colors, block spacing, brand style ([#4509](#4509)) ([21cf4c9](21cf4c9)) * campaigns wizard light UI refresh ([#4588](#4588)) ([6078c4b](6078c4b)) * **color-picker:** simplify component to use basecontrol ([#4581](#4581)) ([ff677ea](ff677ea)) * **components:** add CardFeature component ([#4583](#4583)) ([5aabb18](5aabb18)) * **content-gate:** institution management ui ([#4582](#4582)) ([ae88750](ae88750)) * **content-gate:** institutional access redirect and loading UX ([#4593](#4593)) ([548d236](548d236)) * **content-gate:** institutions ([#4574](#4574)) ([49b0c05](49b0c05)) * **content-gate:** personalized institutional access verification page ([#4596](#4596)) ([0eed591](0eed591)) * **image-upload:** simplify component to use basecontrol; remove info prop ([#4580](#4580)) ([d51eb54](d51eb54)) * **integrations:** add ActionScheduler group handling ([#4559](#4559)) ([411732a](411732a)) * **integrations:** promoted fields for content gate and campaign segmentation ([#4601](#4601)) ([f943df2](f943df2)) * **newspack-ui:** add stack layout and color utility classes ([#4600](#4600)) ([1934067](1934067)) * **post-date:** centralize date features from theme into plugin ([#4579](#4579)) ([19f15eb](19f15eb)) * **sync:** prevent stale data on retry, improve logging and error handling ([#4562](#4562)) ([5467f34](5467f34)) * **tags:** add private tags feature ([#4507](#4507)) ([06d7711](06d7711)) * **yoast:** add primary category utility and settings toggle ([#4563](#4563)) ([4b396c3](4b396c3))
|
🎉 This PR is included in version 6.37.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |

All Submissions:
Changes proposed in this Pull Request:
Separates Newspack's AS actions into dedicated groups so each integration and subsystem can be identified and queried. Because AS has a separate
wp_actionscheduler_groupstable, we can safely find existing groups using a wildcard search before querying the actions table with indexed groups.newspack-integration-{$integration_id}, covering handler retries, sync retries, and async contact pulls*newspack-webhooks, bulk admin syncs usenewspack-sync*The first run of a data event handler cannot be in an integration group because a single data event dispatch runs all handlers in a single AS action. Only retries spin an action for a single handler. The same goes for syncs, which don't run as an AS action until it requires a retry.
How to test the changes in this Pull Request:
newspack-integration-espgroup rather than the genericnewspackgroup.get_scheduled_actions()and other methods withwp shell:Other information: