Repository navigation
feat(content): mark a page Published at its live address from the API (CE-013, part 1: server) - #1510
Merged
Merged
Conversation
…o CMS ansvisor#1331, phase 2 part 1: Webflow connection) A brand connects its Webflow site with a site token, kept by Composio as an API-key connected account under the brand's own Composio user, picks the collection pages go to and which of its fields takes the body, meta title, meta description and JSON-LD. 00283 adds brand_cms_connections (members read; the server writes for admins and managers). Routes under /api/cms/brands/:brandId/webflow connect, list collections and fields with a suggested map, save the map and disconnect. The token is never stored, logged or sent back. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…refusals narrowly (pre-push review) - A new token is a second Composio account until the first is removed, so connect with allowMultiple; once the new one is saved, the brand's other Webflow accounts go (forgetWebflowAccounts), and a disconnect removes them all, keeping the row when Composio can't. - Writes are tied to the account the request read: a map checked with a token replaced meanwhile isn't saved (409 changed), a late refusal marks only its own token, and a disconnect leaves a token connected meanwhile. - Only a 401 or a missing Composio account is auth_failed; a 403 is no_access and changes nothing; a successful read connects a refused connection again. - A collection's fields are given only for one on a site the token reaches. - A missing brand answers not_found; a required field can't be the JSON-LD's. - Unused exports dropped; composio.test.js covers the Webflow helpers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ction as draft items (Send to CMS ansvisor#1331, phase 2 part 2: Webflow send) POST /api/content-drafts/send takes target 'webflow': each page becomes a draft item in the brand's collection (00283) by its field map, or updates the item its last send made there (a new one when it was deleted in Webflow). Webflow's rich text has no tables, so a table goes as a list; images wait for workspace files (CHAT-06); the meta description falls back to the page's opening words; JSON-LD goes as its JSON to its own field. The same 200 a day, 25 per send and pause apply. 00284 adds the delivery's target and the item's collection, and reserve_content_deliveries takes the target ('webhook' by default, so the earlier API still works). A token Webflow refuses marks the connection auth_failed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… as they are (pre-push review) - A table cell keeps its paragraphs, items and lines a space apart, and its links; a table a figure wraps is kept, a table in a cell read once; words or items outside a block become paragraphs; comments go; a picture counts as one image. - A slug with nothing Latin left falls back to the draft's id, the same on every send, not the delivery's. - 00284: a second Webflow send of a page while one is queued is refused under the cap's lock (in_progress), so two sends can't make two items. - The item's id is kept even when the delivery's row was written meanwhile. - A batch stops once Webflow refuses the token, closing the rest. - The webhook callback answers only for webhook deliveries. - An emptied JSON-LD field clears the item's old one; every "<" in it is escaped; the opening words stay within 160 characters. - A taken slug says what to do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… in Settings › Integrations (Send to CMS ansvisor#1331, phase 2 part 3: Webflow card) A Webflow card under the product catalog: admins and managers paste the brand's site token (sent from the browser to the API's proxy once, never through a server action), pick the site and collection pages go to, and which field takes the page content, meta title, meta description and JSON-LD (the collection's suggested map first), replace the token and disconnect; members see where pages go. A refused token asks for a new one; a connection changed meanwhile is read again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…CMS (Send to CMS ansvisor#1331, phase 2 part 4: send target) Once Settings has the brand's Webflow collection ready, the editor's and the Library's Send dialogs offer where pages go: Webflow (a draft item in the collection, the first choice) or the workflow's webhook, remembered per brand in this browser. A Webflow send says whether the item was made or updated and what Webflow's rich text couldn't keep (tables as lists, images not yet); its refusals are named; the Library marks a page sent there as a draft item in Webflow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ow isn't ready (pre-push review) - A brand's Webflow that can't be read holds the send, with Try again, instead of reading as no Webflow and sending to the webhook. - Webflow connected but not ready (its token refused, no collection) shows in the picker, off, with what to do; the webhook is then picked in view. - The description is neutral until the target is read. - The bulk dialog clears a refusal when the target changes, and says a page (not "this page") is already on its way to Webflow. - A collection without a name reads as "your collection". - Tests: a send held while reading, a failed read and Try again, the remembered choice read back, not-ready Webflow, the last send's line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… there (Send to CMS ansvisor#1331, phase 2 part 6: Webflow published) Nothing calls back when a Webflow item goes live, so the API reads the items its sends made: each page's latest send to Webflow not seen live yet (up to 25 a brand, the last 60 days), and marks a live one published at its address on the site (its custom domain or webflow.io host, the collection's slug and the item's). The Library asks once as it opens for a brand with pages in Webflow (any member, a brand at most every two minutes), and a daily sweep reads every connected brand. Marking a page published is shared with the webhook's callback (content-published.js). A token refused while reading marks the connection. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ed it after the send (pre-push review)
- A live page sent again stays sent until Webflow publishes it again: the
item counts only when its lastPublished is at or after the send.
- An item deleted in Webflow closes its send (Removed in Webflow), so the
page's next send makes a new item and the check stops reading it.
- One item's failure doesn't stop the check; three in a row do.
- The Library reads a brand's 10 newest sends; the daily sweep reads up to
100 a brand, its brands shuffled so the deadline leaves out others daily.
- A site's host is the custom domain published to last, else webflow.io.
- An item wrapped as { item } is read; logs carry the error's code.
- The Library's reload isn't lost when its filter changes meanwhile.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (CE-013, part 1: server)
POST /api/content-drafts/:draftId/publish { url } lets any member of the
brand's workspace mark a page Published at the http(s) address it's live
at: the draft gets published_url / published_at (the server's columns)
and a "publish" version in History, and a linked action gets the live page
to be measured on and, once every page it names is live, its Publish task
done. The answer says whether the address is on the brand's domains. The
CMS paths and this share markDraftPublished and liveAddress.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Publish only when all its work is live (pre-push review) - The live address goes to payload.publishedPages (by draft), read beside payload.pages by basketScope, so the pages an action works through (and Ready's check of them) stay as they were; only an address on the brand's domains is measured, and a page published again moves. - Publish is done once the action's work is live: a published create draft for a Create task, a published optimize draft for each page an Optimize or Refresh task names; archived drafts don't count. - Only open tasks (todo, in progress) are completed, skip_reason cleared; a skipped one stays. - The payload is written only as read, read again when another write landed first. - The page stays published when the action's part fails (logged), and a page its CMS published tells its action too (markDraftPublished). - Tests run on tables whose filters apply. Co-Authored-By: Claude Opus 5.5 <[email protected]>
7 of 12 tasks
gkhngyk
reviewed
Oct 25, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good.
What I checked:
- Who can call it. It sits behind the API's sign-in and its general limiter. The draft is read by id, and access is checked on the draft's own brand, so another workspace's draft answers 403 and a missing or archived one answers 404 (both tested). Any member can call it. That matches the Library's status menu and what members can already change on drafts, actions and tasks, so no role gains anything.
published_urlis still written only by the server (00262). - Addresses. It takes http(s) only, with no user or password, up to 2,048 characters.
liveAddressis now shared with the webhook callback. Nothing fetches the address: it's stored, its host is matched against the brand's domains for the action (onBrandDomain), and it's shown as a link. So there's no SSRF path. If part 2's Live page tab ever fetches it, that should go throughsafe-fetch. - What it changes. On the draft:
published, the address and the time, plus a "publish" version in History (content_draft_snapshotskips it when History's latest version is already this page). On a linked action of the same brand that isn't deleted:payload.publishedPages[draftId], only for an address on the brand's domains. It moves when the page is published again and is dropped when the new address is off the domains. It's written only ifupdated_athasn't changed since the read, and tried again otherwise.- Open Publish tasks are completed,
skip_reasonis cleared, and each gets anaction_eventsentry. Skipped tasks stay skipped. - If the action's part fails, that's logged, and the page stays published.
- What it starts. Nothing runs in the background, and no trigger reacts to a completed task. The action's measurement still starts only when a person closes it.
basketScopereads the live page in both windows, with each page counted once, so before and after stay comparable.payload.pagesis untouched, so the drawer and Ready's checks are unchanged. generate.js never rewrites a payload, sopublishedPagesstays. - CMS paths. The webhook callback (live today) and the Webflow check go through the same
markDraftPublished. So a workflow's publish now completes a linked action's Publish task too, and the callback answers as before when the action's part fails.
Low, follow-up (part 2 is a fine time):
server/src/lib/content-published.js:136-152:workPublishedreads drafts, not tasks. That gets two cases wrong:- A page published without Mark ready completes Publish while the action's Create or Optimize task stays open, even though Publish depends on them. That happens when the page is sent straight to a CMS, or marked published at an address. Fix: complete the page's own task too, as Mark ready does (by the draft's method), or leave Publish open until those tasks are done.
- A Create or Optimize task someone skipped still needs its draft to be live, so Publish never completes on its own. Fix: count only the work whose task isn't skipped.
web/src/lib/actions/content-drafts.ts:1498-1499: moving a published page back to Draft or In review reopens only the tasks Ready completed. The Publish task this route completed stays done, andpublishedPageskeeps the address, so the action goes on measuring a page the person took back. Fix: reopen the Publish task whose latest event names the draft, asreopenDraftTasksreads events, and drop the draft'spublishedPagesentry.
7 of 12 tasks
…-settings # Conflicts: # server/.env.example # supabase/schema.sql
…sed parts by their labels, tell members a refused token stops sends (review)
- A saved part whose field was deleted or changed type in Webflow is left
out when the fields arrive, so what's saved is what the pickers show.
- The API's problems name a part by its label ("Meta title: …"), in a
list read out as an alert; the token hint describes its field.
- With the token refused, a member reads that pages can't go to Webflow
until an admin or manager pastes a new one.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…_webhook for a Webflow not ready, and move between targets with the arrow keys (review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ebflow, in case it wasn't (review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, and don't hold Publish for skipped work (review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
… so, and keep Try again off while sending (pre-push review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ction's pages as the web does (pre-push review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
Author
|
Thanks. Both are fixed: the server part here (7e29233), the unpublish part in #1511 (093a2d2). #1509's new head is merged in (dbe2d82, no conflicts).
Server: format, lint, |
gkhngyk
approved these changes
Oct 25, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good.
What I checked:
- Earlier follow-up 1: Done (7e29233, be57be3).
- A page published without Mark ready now completes its own task, as Mark ready does (
ownTasks,server/src/lib/content-published.js:205-219). That's Create for a create draft, and Optimize or Refresh for an optimize draft.- On an action that names several pages, it waits until each page has a ready or published draft. That's the web's
completeDraftTasksrule. - The action's drafts are read after this draft is saved as published, so it counts itself.
- On an action that names several pages, it waits until each page has a ready or published draft. That's the web's
- Skipped work no longer holds up Publish (
workPublished,:153-166). A skipped task of the page's own stays skipped (TASK_DONE), and so does a skipped Publish task (OPEN_TASKS). - Named pages.
payload.pagesis read the way the web'sactionPagesreads it (namedPages,:141-145), so a stray entry can't hold up Publish for good. An action's page and its draft'ssource_urlare the same string:- the drawer starts a page's draft with the page it lists;
- an action made from a draft names that draft's
source_url.
- A page published without Mark ready now completes its own task, as Mark ready does (
- Races.
- Changed meanwhile. A task is completed only if its status is still the one read (
completeTasks,:174-196). Only a row that actually changed gets a History entry and counts. So a task skipped in the drawer meanwhile stays skipped, and two publishes at once complete a task only once. - Two pages live at once. Say two pages of one action go live together (two callbacks, or the Webflow check and Mark published). Each saves its own draft before it reads the action's drafts, so at least one of them sees both live and completes Publish.
- The action row.
actions.updated_atis bumped once, after the writes.setLivePagestill writes the payload only whileupdated_atis unchanged.
- Changed meanwhile. A task is completed only if its status is still the one read (
- Reopening.
- Each completion names the draft (
{ taskId, to: 'completed', draftId }). Taking the page back therefore reopens its own task throughreopenDraftTasks, as it does after Ready.
- Each completion names the draft (
- Earlier follow-up 2: Done in #1511 (093a2d2, 591b0a3). A published page moved back to Draft or In review reopens the Publish task, whichever page's publish completed it, and leaves
publishedPages. - Merges. 64c95ed and dbe2d82 change nothing beyond merging their parents. The PR contains #1509's new head and main, and merges cleanly.
- Before the API is deployed. This PR is server-only, so nobody sees a change until the API goes out. After that, a webhook callback (live today) also completes a linked action's Create or Optimize task when a workflow publishes the page.
Low (description only):
- The description's "The Publish task" section doesn't mention the page's own task. Add a line saying that any publish (Mark published, the webhook callback, the Webflow check) also completes the page's Create, Optimize or Refresh task, as Mark ready does. Then the squash message records the change on the live webhook path.
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
CE-013 "Published state with live URL and citation tracking", part 1: server. The spec (§6, item 22) reads: "Published (user gives the live URL; tracking starts)"; §15, item 68: "publishing starts its impact measurement".
Where it sits: stacked on #1509, because it shares
lib/content-published.jswith Send to CMS's published paths. Merge the #1503–#1509 chain first. Part 2 (web: the Mark published dialog, and the Live page tab measuring the address) follows. No migration.Today: the Library's status menu flips
statustopublishedwith no address. The editor's Published button is disabled. The Live page tab measures only an optimized page'ssource_url, so a created page is never measured.POST /api/content-drafts/:draftId/publish { url }invalid_url.liveAddressis shared with the webhook callback.status: published,published_urlandpublished_at(the server's columns, 00262), and keeps a "publish" version in History (00215).{ publishedUrl, publishedAt, taskCompleted, onBrandDomain }. An address off the brand's domains is kept, but its numbers can't be read, so the web says so.A linked action, the same whether a person publishes the page or a CMS does (webhook callback, Webflow check):
payload.publishedPages(keyed by draft), whichbasketScopereads besidepayload.pages, once each. This is the measurement from-content-draft.js points to ("a new page has its address only then").payload.pagesstays the list of pages the action works through, so the drawer's "Pages to optimize" and Ready's check of them are unchanged.publish_content) is completed once all of the action's work is live, mirroring how Ready completes its tasks:skip_reasonis cleared; a task someone skipped stays skipped.action_events,task_status, with the address).completed_at), asvalidate.jsdoes today.Related issue
Content Editor spec (Drive), CE-013. Builds on #1331's published paths (#1509).
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
server/, runnpx vitest run src/lib/content-published.test.js src/routes/content-drafts-publish.test.js src/routes/webhook-content-draft-callback.test.js src/lib/action-center/basket-metrics.test.js. The publish tests run on in-memory tables whose filters apply.POST /api/content-drafts/<id>/publishwith{ "url": "https://<brand domain>/blog/x" };publishedPages, and its Publish task is completed, with an entry in its History;onBrandDomain: false, and it leavespublishedPages.Deploy order
After #1503–#1509, then the API. Nothing calls this route until part 2.
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/): no web changeyarn typecheckpasses (run fromweb/): no web changeyarn format:checkpasses (run fromweb/): no web changeA pre-push review found these. Their fixes are the last commit:
payload.pages, which would have shown a phantom page to optimize and blocked Ready;Server:
npm run format,npm run lintandnpm test(2,670 passed) pass.🤖 Generated with Claude Code