Skip to content

5.8.4: batched sync, namespace forward-alias, and community fixes - #71

Open
michtio wants to merge 10 commits into
v5from
fix/5.8.4-backports
Open

5.8.4: batched sync, namespace forward-alias, and community fixes#71
michtio wants to merge 10 commits into
v5from
fix/5.8.4-backports

Conversation

@michtio

@michtio michtio commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Based on the 5.8.3 tag (which sits ahead of v5); fast-forward v5 to 5.8.3 before merging so the site-aware Cockpit collection fix is retained.

Backport round for 5.8.4 on the 5.8.x (v5) line. Reviewed and cherry-picked with original authorship where the change came from a contributor PR; adapted or fixed on top where noted.

Namespace

  • Forward-compatibility alias for the 5.9.0 craftpulse\typesense namespace. A Composer files-autoload shim aliases craftpulse\typesense\* to the current percipiolondon\typesense\*, so integrators can migrate their imports and config/typesense.php references now and stay working on 5.8.x. No deprecation is logged on this line (the craftpulse names are the forward target). README + CHANGELOG document the two-way alias guarantee.

Queue

  • Batched document sync (Batch document sync jobs #70, @timkelty). Moves sync onto BaseBatchedJob. Reviewed against the author's four stated failure modes and confirmed each holds: flush/create side effects run once in before() (not per reloaded batch), processed IDs live in a public property that survives queue serialization across spawned jobs, loadData() returns an empty Batchable on missing client/collection, and the query is cloned and stably ordered by id. Expected to resolve Phantom Pending Task Appearing On Craft Cloud #69.

Fixes

  • Events only bind when an API key is set (Only add Craft events if the API key is set #63, @jamie-s-white). Avoids a save-time error on a fresh install. Adapted on merge: the guard now wraps the current cockpit-aware element filtering (which postdates the PR) and keeps the null-entry guard, rather than the PR's plain instanceof Entry check which would have regressed cockpit element support.
  • Delete documents in .all collections (Add the ability to delete documents if the .all syntax is used #64, @jamie-s-white). The delete handler now falls back to the section.all collection, matching the save path, so documents in an .all-defined collection are removed.
  • update-schema console command (Update schema console command #61, @jamie-s-white). Drops and recreates each configured collection's fields from config. Follow-up commit makes the destructive behavior explicit (help text + a confirmation prompt, --force to skip) per the author's own suggestion, and removes a dead CP URL rule the PR added (it pointed at a non-existent web action; the feature is console-only).
  • Null-entry guard when applying a draft (Error applying draft #67, reported by @mikeymeister). The after-restore / after-move handler could pass a query miss to a non-nullable handleSave() and throw. Guarded, matching the sibling delete path.
  • Control-panel action URLs / CRAFT_BASE_CP_URL (Admin Panel Sync/Flash Buttons not respecting CRAFT_BASE_CP_URL - using frontend SITE_URL instead #68, reported by @vardumper). Confirmed the Sync/Flush actions build URLs with cpUrl(), so they respect CRAFT_BASE_CP_URL and post to the control-panel domain (resolving the reported CORS failure when the CP is on a separate domain). Already correct on this line; verified and credited.

Not included

Verification

The 5.8.x line has no Pest suite. Verified: composer install in the branch, php -l on every changed file, and a line-by-line review of each cherry-pick against this codebase's actual call sites and conventions (old percipiolondon namespace, old code style). The batched-sync serialization behavior was verified against Craft's BaseBatchedJob/__sleep source; the forward alias was verified resolving at runtime.

No release tag is included.

Michael Thomas and others added 10 commits March 27, 2026 14:17
Register a Composer files-autoload fallback that aliases craftpulse\typesense\*
class names to their existing percipiolondon\typesense\* counterparts, so
integrators can migrate their imports and config/typesense.php references to the
future namespace today and keep working on 5.8.x. No deprecation is logged on
this line: the craftpulse names are the forward target, and the percipiolondon
names remain fully supported until 5.9.0. Documents the two-way alias guarantee
in the README.
The after-restore / after-move handler queried the element per site and passed
the result straight to handleSave(), whose signature is non-nullable, so a query
that found nothing (for example when applying a draft) threw a TypeError. Guard
the call with an entry check, matching the existing guard on the sibling query
path. Reported by @mikeymeister.
Wrap the element event registration (and the delete event) so they only bind
when an API key is configured, avoiding a save-time error on a fresh install
before the plugin is set up.

Adapted from the original PR to fit the current codebase: the API-key guard now
wraps the cockpit-aware element filtering (Entry plus the cockpit element types)
that postdates the PR, and keeps the null-entry guard on the restore/move
re-query, rather than the PR's plain instanceof Entry check which would have
regressed cockpit element support.

Authored-by preserved from PR #63.
(cherry picked from commit 41c67bd)
Following @jamie-s-white's own note that the new command is destructive, the
update-schema action now documents that it drops and recreates every configured
collection's fields (shown in ./craft help) and prompts for confirmation unless
--force is passed, so the data loss is deliberate rather than a surprise. Also
drop the dead CP URL rule the PR added (typesense/update-schema pointed at a
collections/update-schema web action that does not exist); the feature is a
console command.
Document the 5.8.4 round: the forward-compatibility namespace alias and the
5.9.0 namespace-move heads-up, the batched document sync rework (#70, resolves
null entry (#67), .all-collection deletes (#64), events before configuration
(#63), and the control-panel action URL / CRAFT_BASE_CP_URL confirmation (#68).
Credits @timkelty, @jamie-s-white, @mikeymeister, and @vardumper.
@michtio
michtio force-pushed the fix/5.8.4-backports branch from 8d7cce8 to 39a088f Compare July 16, 2026 15:24
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.

Phantom Pending Task Appearing On Craft Cloud

3 participants