Skip to content

feat(cms): mark a page published once its Framer item is live on the site (#1331) - #1579

Merged
gkhngyk merged 39 commits into
ansvisor:mainfrom
cihan-gyk:feature/cms-framer-published
Oct 28, 2026
Merged

gkhngyk merged 39 commits into
ansvisor:mainfrom
cihan-gyk:feature/cms-framer-published

Conversation

@cihan-gyk

@cihan-gyk cihan-gyk commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Send to CMS, phase 2 (#1331): Framer, part 3: a page sent to Framer becomes Published once its item is live on the site. Server only, as Webflow's (#1509) and WordPress's (#1570) checks are.

Stacked on #1576 (send), which is stacked on #1575 (connect). This PR's own change is its last commit.

Framer doesn't call anyone back when an item goes live, and a non-draft item is live only once the site is published. So Ansvisor reads it.

lib/cms/framer.js readPublished reads everything over one connection:

  • the collection's items, with their slug, draft state and updatedAt;
  • the site's production publish: its address and when it was deployed;
  • the collection's detail page path (WebPageNode with the collection's collectionId, not a draft; the shortest if there are several).

lib/cms/framer-status.js, built as wordpress-status.js:

  • Which sends: each page's latest send to the connected collection, still sent, from the last 60 days. The 10 newest are read when the Library opens (POST /api/content-drafts/framer-status, every member, once per brand every 2 minutes). Up to 100 per brand are read in the daily sweep (active subscriptions, shuffled, 10-minute deadline).

  • When a page is published: all of these must hold.

    • The item isn't a draft.
    • There's a production publish, deployed after the send.
    • The item's updatedAt isn't later than that publish. Without that, an item taken out of draft after the last publish would read as live too early.
    • The detail page's path has exactly one parameter, :slug.

    The page is then marked published at the site's address plus that path, with the item's slug, through markDeliveryPublished, as for the other CMSs.

  • Removed: an item gone from the collection closes its send as "Removed in Framer". Sending the page again makes a new item.

  • Waiting: no production publish, no detail page, a path in another form, or a collection that's gone all leave the send as it is, and the next check reads it again.

  • Errors: a refused key, or one that can't be read, marks the connection auth_failed. Other errors are logged by name and code, and the next check tries again.

Not documented by Framer, so the code is careful:

  • deploymentTime's unit. It's read as milliseconds, with a value below 1e11 taken as seconds. A time more than 10 minutes ahead is read as no publish at all, so a wrong guess never marks anything.
  • The detail page path's form. /blog/:slug is assumed; any other form marks nothing and is logged once per check.
  • Whether Framer moves an item's updatedAt when it's taken out of draft. The check relies on it to tell an item that went live from one undrafted after the last publish.

All three are worth a look in the real-project test (send → publish the site → take the item out of draft → check).

The address goes through liveAddress (content-published.js), as the webhook callback's does: https only here, at most 2,048 characters. One that fails is logged and skipped, and the next send goes on.

Next: the web (the Settings card, and the Send dialog's target with the Library reading /framer-status), then the docs.

Related issue

Part of #1331 (phase 2, Framer). Stacked on #1576 → #1575.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. cd server && npx vitest run src/lib/cms/framer-status.test.js src/lib/cms/framer.test.js src/routes/content-drafts-send.test.js
  2. With a real project (gkhngyk): send a page to Framer (feat(cms): send pages to a brand's Framer collection as draft items (#1331) #1576), take its item out of draft and publish the site. Then POST /api/content-drafts/framer-status { brandId }: the page is marked published at https://<site>/<collection path>/<slug>.
    • Delete the item in Framer and check again: the send reads "Removed in Framer".

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Server only:

  • npm run format, npm run lint and npm test (3,112 tests) passed in server/.
  • After the pre-push review's fixes, I ran prettier, eslint and the CMS and route tests again: 13 files, 176 tests. The fixes change only Framer's files.

The review's fixes:

  • the updatedAt rule;
  • the 10-minute bound on the publish time;
  • the address through liveAddress;
  • separate logs for a path without :slug, an empty slug and an address that can't be kept;
  • tests for each, plus a failure partway through (it stops the check, as WordPress's does).

Follow-ups for a separate PR:

  • the three CMS checks share most of their code (markRefused, closeRemoved, the latest-send loop, the sweep, the status routes);
  • a send could keep the project's id beside the collection's, for a project duplicated in Framer.

🤖 Generated with Claude Code

cihan-gyk and others added 9 commits October 27, 2026 10:18
…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]>
…ss-server

# Conflicts:
#	server/src/lib/content-delivery.test.js
#	supabase/schema.sql
Node 20 is end of life since 2026-04-30, and Framer's official Server API
package (framer-api, for Send to CMS ansvisor#1331) needs Node 22 or later for its
global WebSocket. Node 24 is LTS until April 2028. The Dockerfile, CI's
server job and the server README move to 24; the web job stays on 20.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…#1331)

Framer's official Server API (framer-api, needs Node 22+): a brand's
project connects with an API key made in it, sealed as WordPress's
sign-in is. 00295 adds provider 'framer' (site_id = project id) and the
'framer' delivery target, and reserve_content_deliveries keeps one queued
send per page for it too. Routes check the project, list the user's own
collections with their fields, save the collection and field map (title
to text, page to formatted text, required fields refused as for Webflow)
and disconnect (Framer has no API to revoke a key).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nsvisor#1331)

writeItem adds a draft item (draft: true) or updates the one the page's
last Framer send made in that collection, keeping its state; the new id is
read back by slug among new items, a clashing slug stops the send, and a
draft with the page's slug and title left by a send that broke halfway is
taken back. framer-items.js keeps tables (Framer's rich text has them),
leaves media out and counts it, and maps title, page, meta and JSON-LD to
the brand's fields. content-delivery.js gains the 'framer' target.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…site (ansvisor#1331)

framer-status.js reads each page's latest Framer send (Library open and a
daily sweep): an item out of draft, with a production publish after the
send and after the item's last change, is published at the site's address
plus the collection page's path with its slug; an item gone closes its
send as "Removed in Framer". readPublished reads items, the publish and
the detail page over one connection. POST /api/content-drafts/framer-status.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 27, 2026
cihan-gyk and others added 8 commits October 28, 2026 03:07
… 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]>
… 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 and
WordPress's disconnects do. Framer's disconnect deletes the project's API
key, so it joins the list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's product blocks (ansvisor#1607) are a grid of linked cards; Framer's formatted
text has no grid, so the cards ran together in one paragraph. They now go as
Webflow's do (productsAsList): a list, a product an item, its name linked and
its price after it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Merged #1576's new head in (ecedbf6), no conflicts. Checks: typecheck on every web tip, the server suite at #1579 (3,522 tests), and the whole web suite (4,438 tests) and yarn build at #1580.

gkhngyk added a commit that referenced this pull request Oct 28, 2026
* fix(cms): give a Webflow item sent again a date when it has none

Follow-up from #1600 (item 1). Only a new item was given the day it's
sent; an item sent again kept its date. So a brand that maps an optional
date later, or makes its date required in Webflow, kept an empty date on
every item sent before, and a send again left it empty.

When the field map gives a date, sendToWebflow now reads the item before
updating it (getItem, which says which fields hold a value) and, when its
date is empty, sends today's with the update. An item that can't be read
is updated without a date, as before; without a date field nothing is
read.

The Send to CMS guide's field table lists the Date field (#1507's
follow-up) and says an item sent again keeps its date, or gets one.

fieldDataFor (webflow-items.js) is unchanged, so this doesn't meet the
Framer PRs' edit at its end (#1576, #1579).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(cms): say which Webflow items are given the day they're sent

Review follow-up. The comment above createItem still said only a new item
is given the day it's sent, but an item sent again with an empty date now
gets it too. It names both now. Comment only; webflow-items.js untouched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(cms): keep a Webflow item's date when the read didn't see its fields

---------

Co-authored-by: Cihan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Gökhan Geyik <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Merged main (cfd8a35) through #1576; server.js keeps both the card-match and the Framer published sweep imports.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, with follow-ups

Reviewed this PR's own change: #1576's head 1ea6030 → ecedbf6 (the merge of #1576 into 75ad38a), 7 server files. On main (cfd8a35) it has one small conflict, in server/src/server.js's imports: main added import { sweepShoppingCardMatches } from './lib/catalog/card-match.js'; on the line where this PR adds import { sweepFramerPublished } from './lib/cms/framer-status.js';. Keep both.

What I checked

  • What's read. Only the brand's sends to the collection connected now: status sent, with an item id, from the last 60 days, each page's latest. That's up to 10 when the Library opens and 100 in the daily sweep, all in one connection to the project with #1575's 30 s timeout. No outbound request goes to the site: the live address is built from Framer's published address (https only) and the collection's detail-page path, with the item's slug encoded. It's kept only when it's https and ≤ 2,048 characters (liveAddress).
  • What's marked. An item is marked published only when all of these hold: it isn't a draft, the site was published after the send and after the item's last change, and the path has exactly one :slug. A publish time that reads as more than ten minutes ahead marks nothing (the unit guess), and a draft state Framer doesn't give counts as a draft. An item gone from the collection closes its send ("Removed in Framer"), only while that send is still sent.
  • Who can trigger it. POST /content-drafts/framer-status checks the brand is in the caller's organization, sits behind cmsLimiter, and reads a brand at most every two minutes, as Webflow's and WordPress's do. A refused key marks the connection only if it's still the one read.
  • The daily sweep. Active subscriptions only, at most 1,000 connections, shuffled, with a 10-minute deadline. Each brand is one connection bounded at about 35 s (30 s use + 5 s close), so the deadline is overrun by one brand at most. One brand's failure is logged by name and code, and the next goes on.
  • Tests: framer-status.test.js and the send route tests pass. Full server suite on the stack: 3,809 passed. They also pass under Node 20.

Follow-ups

  1. Reading the whole collection. readPublished reads every item, with all its fields (each page's full body), to find at most 100. Like #1576's follow-up: read only the items asked for, if framer-api allows it.
  2. framerChecked grows by one entry per brand checked and is never pruned, as Webflow's map is. That's fine at today's size; a sweep of old entries (or an LRU) belongs with the other two.

@gkhngyk
gkhngyk merged commit e56261b into ansvisor:main Oct 28, 2026
4 of 5 checks passed
@github-actions github-actions Bot removed the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 28, 2026
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.

2 participants