Skip to content

feat: batch sync content using action scheduler#247

Open
Kallyan01 wants to merge 31 commits into
mainfrom
feat/as-batch-sync-content
Open

feat: batch sync content using action scheduler#247
Kallyan01 wants to merge 31 commits into
mainfrom
feat/as-batch-sync-content

Conversation

@Kallyan01

@Kallyan01 Kallyan01 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

What

Implements a full asynchronous batch sync/reindex system using Action Scheduler. Reindexing no longer runs synchronously in a single request; it now fans out into parent/child jobs that process in the background with progress tracking, retry logic, cancellation, and job history.

Why

The existing synchronous reindex blocked PHP execution and timed out on large sites with many posts or many child sites, which could not reliably complete a reindex. Moving to Action Scheduler lets each sync batch run independently, survive failures via exponential-backoff retries, and report real-time progress back to the admin UI.

Related Issue(s):

How

AI Disclosure

Took the help of the Claude Sonnet 4.6 model to verify future scalability issues and testcases.

Testing Instructions

Validate the reindexing process using a large dataset and ensure that the entire reindex operation completes successfully without failures.

Screenshots

image image image

Additional Info

Checklist

  • I have read the Contribution Guidelines.
  • I have read the Development Guidelines.
  • I have added necessary tests to cover my changes.
  • I have updated the project documentation as needed.
  • My code has detailed inline documentation.
  • My code is tested to the best of my abilities.
  • My code passes all lints, tests, and checks.
Open WordPress Playground Preview

Kallyan01 and others added 26 commits June 18, 2026 02:42
… in CI

Strauss 0.27.0 validates the GitHub OAuth token format, but the
GITHUB_TOKEN provided by GitHub Actions uses the ghs_* format
(contains underscores) which fails Strauss's regex validation.

Fix: run `composer install --no-scripts` to skip post-install-cmd,
then run `composer run prefix-namespaces` in a separate step with
`COMPOSER_AUTH: '{}'` to prevent Strauss from reading the invalid token.

Applies to both reusable-phpcs.yml and reusable-phpstan.yml.

Co-authored-by: Kallyan01 <48629100+Kallyan01@users.noreply.github.com>
…nd PHP compatibility

- Add mock for /re-index/status fetch that fires on component mount
- Update re-index modal test to use Close button and check dialog removal
- Mock fetchHistory calls for modal open and reindex handler flows
- Fix add_option deprecated empty string autoload parameter (use false)
- Guard direct SQL query with prepare result type check
- Update PHPStan types and ActionScheduler stub
- Use COMPOSER_HOME isolation for strauss to avoid CI token validation failure
- Upgrade strauss from 0.27.0 to 0.27.3
- Use overlayClassName on Modal with CSS :has() instead of wrapper div blur
- Fix CSS formatting inconsistencies
@Kallyan01 Kallyan01 changed the title Feat/as batch sync content feat: batch sync content using action scheduler Jun 18, 2026
@Kallyan01 Kallyan01 marked this pull request as ready for review June 19, 2026 10:22
@codecov-commenter

codecov-commenter commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 47.86280% with 988 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.34%. Comparing base (e28eaad) to head (76563ae).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
inc/Modules/Scheduler/Job_Scheduler.php 24.82% 321 Missing ⚠️
inc/Modules/Schema/Job_Repository.php 0.00% 231 Missing ⚠️
inc/Modules/Scheduler/Job_REST_Controller.php 71.55% 200 Missing ⚠️
inc/Modules/Jobs/Abstract_Job.php 65.51% 60 Missing ⚠️
inc/Modules/Jobs/Reindex_Job.php 3.27% 59 Missing ⚠️
inc/Modules/Jobs/Sync_Job.php 13.04% 40 Missing ⚠️
uninstall.php 0.00% 24 Missing ⚠️
inc/Modules/Schema/Job_Schema.php 0.00% 17 Missing ⚠️
inc/Modules/Rest/Search_Controller.php 89.04% 16 Missing ⚠️
inc/Modules/Scheduler/Bootstrap.php 0.00% 10 Missing ⚠️
... and 2 more
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##               main     #247       +/-   ##
=============================================
- Coverage     86.46%   67.34%   -19.12%     
- Complexity      543      969      +426     
=============================================
  Files            22       31        +9     
  Lines          1988     3859     +1871     
=============================================
+ Hits           1719     2599      +880     
- Misses          269     1260      +991     
Flag Coverage Δ
unit 67.34% <47.86%> (-19.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
inc/Main.php 100.00% <100.00%> (ø)
inc/Modules/Jobs/Registry.php 100.00% <100.00%> (ø)
inc/Modules/Search/Index.php 88.69% <83.33%> (-1.40%) ⬇️
inc/Modules/Search/Watcher.php 66.66% <47.05%> (-33.34%) ⬇️
inc/Modules/Scheduler/Bootstrap.php 0.00% <0.00%> (ø)
inc/Modules/Rest/Search_Controller.php 82.75% <89.04%> (+4.03%) ⬆️
inc/Modules/Schema/Job_Schema.php 0.00% <0.00%> (ø)
uninstall.php 0.00% <0.00%> (ø)
inc/Modules/Jobs/Sync_Job.php 13.04% <13.04%> (ø)
inc/Modules/Jobs/Reindex_Job.php 3.27% <3.27%> (ø)
... and 4 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Kallyan01 Kallyan01 requested a review from justlevine June 19, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants