Repository navigation
Report status changes of CiteCue posts to CiteCue (1.5.0) - #21
Merged
Merged
Conversation
A new status reporter marks CiteCue posts when they are published, unpublished, trashed, restored, deleted, re-addressed or edited while live, and a WP-Cron drain sends the reports to POST /api/delivery/v2/content-status off the editor's request: up to 20 per run, one at a time, with bounded jittered retries, Retry-After, sequence catch-up and a generation fence so a change made while a report is in flight is never lost. Permanent deletes are built at hook time and kept in their own option. Nothing is marked or sent until the site is connected, accepts pushes and reports an https address. Disconnecting clears pending reports; uninstall removes the bookkeeping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The content endpoint suspends the status reporter around its own insert or update (released in a finally), shares the "edited" hash test with the reporter, clears the post's pending report and resets what was last reported after a successful push, and returns the post's report counter as seq. A push it refuses changes nothing. Settings shows how many reports were given up beside the connection status. Version 1.4.0, changelog, upgrade notice, the external-services disclosure for the new status reports, and README documentation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ngs save Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…thing without one Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge stuck entries, fences, per-entry seq backoff, delete reports kept without a seq Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ase) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Compare a live post on wp_after_insert_post instead of post_updated: the block editor's REST save writes categories after post_updated, so a new category under a %category% permalink was never reported. - Also mark when a save changes the post compared with before it, so an edit or slug change undone while its report is in flight still goes out. - Bump the generation before checking the pending mark, so a drain finishing between the two steps can't clear the mark of a newer change. - Pull a drain left a day out by a paused run forward when content pushes are switched back on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An undo was caught by comparing the post with its state before the save, but a post's earlier address can't be rebuilt: get_permalink() uses the terms as they are now, so a category changed back while the new address was in flight matched both ways and the reply recorded the wrong address. Every save of a live CiteCue post now bumps the generation before reading what was last reported, so a report in flight during any change is never taken as the last word. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The REST controller stores the text before it saves terms, meta and extra fields, and returns early if one of those fails, so wp_after_insert_post never fires for a save whose text already landed. Look on post_updated as well; wp_after_insert_post still checks the address once the categories are in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A run loads its posts up front and took each report's number last. A post CiteCue pushed while an earlier report was in flight went out with its old status and a number above the push's baseline, with nothing left pending to correct it. Take the number first, then read the post, its meta and its terms from the database again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
About an hour holds only without a Retry-After; with one, the four waits can add up to several hours. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clean_object_term_cache() leaves them alone on WordPress 5.9, so a post whose category a push changed mid-run could be reported at its old address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Requests class has another name there, so the mock fell back to a plain array and the Retry-After tests never saw their header on 5.9. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
Plugin 1.5.0 tells CiteCue when a post or page CiteCue pushed changes in WordPress: published, unpublished, trashed, restored, permanently deleted, its address changed, or its text edited. CiteCue then shows what is really on the site instead of what it last sent.
Citecue_Status_Reporter: per-post pending marks with a generation token (a change made while a report is in flight is never lost), delete reports built atbefore_delete_post(the post's meta is about to vanish), a per-post report counter allocated with a portable compare-and-swap, and a WP-Cron drain (citecue_report_drain): at most 20 reports per run, one request at a time, a 30 s budget, retries honouringRetry-After, and a site-wide hold after an outage reply.POST /api/delivery/v2/content-status(Bearer key,X-Citecue-Channel: wordpress, no redirects, 5 s timeout). Only CiteCue posts, only on a connected site that accepts pushes, only while the site address is https. CiteCue's own pushes are never reported back (suspend()/resume()around ingest)./contentreplies addseq. Settings → CiteCue shows how many reports were given up (expires after 30 days).Version
1.5.0, because #20 (language versions of answer pages) takes 1.4.0 and is older. Whichever merges second needs a merge of
citecue.php,readme.txtand README.Release order
Release only after the CiteCue app deploys the endpoint (henry-mosh/citecue_app, the status-callback PR stacked on #1198 and #1206). Until then an older app answers 404, which the plugin treats as final for that report.
Tests
composer lint,composer phpcs: clean.composer test: core, WooCommerce stub and multisite, 509 tests each, all pass (96 in the new reporter suite).tests/cases/test-ingest-products.phpneeds a real WooCommerce; this repo's CI WooCommerce job covers it.pnpm e2e:wordpressstatus-callback scenarios (publish, trash, permanent delete, edit, no self-report, foreign site) pass.🤖 Generated with Claude Code