Repository navigation
feat(cms): mark a page published once its WordPress post is put live, read when the Library opens and daily (#1331) - #1570
Merged
gkhngyk merged 8 commits intoOct 28, 2026
Conversation
…ord and send pages to it as draft posts (ansvisor#1331) Co-Authored-By: Claude Opus 5.5 <[email protected]>
… read when the Library opens and daily (ansvisor#1331) Co-Authored-By: Claude Opus 5.5 <[email protected]>
7 of 12 tasks
…ss-server # Conflicts: # server/src/lib/content-delivery.test.js # supabase/schema.sql
This was referenced Oct 27, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… has ended Since ansvisor#1589 a workspace whose plan has ended can't write, but taking back an outside account's access stays open (COST_STOPPING), as Webflow's disconnect does. WordPress's disconnect revokes the Application Password where the site allows, so it joins the list. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s-published Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
Author
|
Merged #1569's new head in (da8e326). |
gkhngyk
approved these changes
Oct 28, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good, with follow-ups
Reviewed this PR's own change (#1569's head ddc01c9 → da8e326, read as merged on main cfd8a35). It merges clean on main.
What I checked
- Which posts are read. Only the brand's sends to the site connected now (
target_collection = site_url), sent in the last 60 days, each page's latest send, up to 10 when the Library opens and 100 a brand in the daily sweep. A post is read with the connection's own sign-in, through the same https-only, public-address-only client as #1569. - What is marked. A post with status
publishmarks its send (and the page, when that send is its latest) published at the post's link; the link must be http(s), and the column's own check bounds it. A post in the trash, or gone while the site still answers as WordPress, closes its send as "Removed in WordPress"; a site that answers 404 for every post (moved, permalinks set to Plain) closes nothing (answersAsWordPress). A refused sign-in stops the check and marks the connection, only if it is still the one read. - Who can trigger it.
POST /content-drafts/wordpress-statuschecks the brand is in the caller's organization, behindcmsLimiter, and reads a brand at most every two minutes, as Webflow's does. - The daily sweep. Active subscriptions only, at most 1,000 connections, shuffled, with a 10-minute deadline checked between brands; one brand's failure is logged and the next goes on. Three failed reads in a row end a brand's check.
- Send. A send that finds the last post already live marks that send published first, so the publish isn't lost behind the new draft.
- Tests: full server suite on the merged stack (272 files, 3,773 passed); eslint and prettier clean.
Follow-ups
- The deadline is checked between brands only. A site that answers each read slowly but within the 30 s timeout keeps one brand's check going for up to 100 reads (200 when it needs the public read too), so one slow site can hold the sweep well past its 10 minutes and push other brands to the next day. Pass the deadline into
checkWordPressPublishedand check it between posts, and ask for_fields: 'id,status,link'so a post's full content isn't downloaded just to read its status. - A link over 2,048 characters fails the delivery update and ends that brand's check (the error isn't caught per post). Skip such a link instead.
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.
Summary
Send to CMS, phase 2 (#1331): WordPress, part 2 of 3: a post put live in WordPress marks its page Published, as #1509 does for Webflow.
Stacked on #1569 (the WordPress connection and send). Review that one first; this PR's own change is its last commit.
Nothing calls back when a WordPress post goes live, so Ansvisor reads the posts its sends made (
cms/wordpress-status.js):target_collection= its address), stillsent, from the last 60 days. Each page's latest send only, newest first.publishnow was put live after the send. Its delivery is marked published at the post's own link (markDeliveryPublished, as the webhook callback and Webflow do). The draft becomes Published, its tracking starts (CE-013), and its Publish task completes.rest_forbidden_context), so it's read as the public sees it (context=view). A post it can't read either way stays open, counted as a failed read.future), pending or still a draft./wp-json/listswp/v2.updated_at), and the check stops.POST /api/content-drafts/wordpress-statusreads the brand's 10 newest sends. It's for any member, a brand at most every two minutes, as/webflow-statusis.sweepWordPressPublished, beside Webflow's in the daily run). It reads 100 a brand, in a shuffled order, stopping after 10 minutes.A post found live by a send (
cms/wordpress-delivery.js): a page sent again before the check saw its post published goes as a new draft (#1569). Its last send is now marked published at the post's link, so that publish isn't lost behind the new draft. The page itself follows its latest send, that new draft, once it's published.Known limit, as with Webflow: a published post moved back to draft in WordPress leaves its page Published, since a published send isn't read again.
The web isn't in this PR. The Library will call
/wordpress-statusas it calls/webflow-status, alongside the Settings card and the Send dialog's target, in part 3.Related issue
Part of #1331 (phase 2, WordPress). Stacked on #1569.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd server && npx vitest run src/lib/cms/wordpress-status.test.js src/routes/content-drafts-send.test.jsPOST /api/content-drafts/wordpress-status { brandId }: the page comes back inpublishedwith the post's link, and the Library shows it Published.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Server only:
npm run format,npm run lintandnpm test(2,967 tests) inserver/. I ran them again after the pre-push review's fixes. New cases cover a Contributor's published post, a site that 404s everything, a published link that isn't an address, and another workspace's brand. The first two fail without their fix.🤖 Generated with Claude Code