Repository navigation
fix(mcp): read a draft's live page at the address it was published at, as the Live page tab does - #1554
Conversation
…, as the Live page tab does (ansvisor#1548 review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good, with follow-ups.
What I checked:
-
Scope. One commit on main (307670b, which is also the merge-base). It touches four web files.
-
The same page as the Live page tab.
- The tab measures
liveUrl ?? draft.sourceUrl(_side-panel.tsx:552-554).liveUrlstarts as the draft'spublished_url ?? null(content-drafts.ts:259,_draft-editor.tsx:411). getContentImpactFornow measurespublished_url ?? source_url(content.ts:386), andDRAFT_COLUMNSselects the column (:41).- 00262's check holds
published_urlto null or an http(s) address, so??never stops at an empty string. - A draft with neither address gets
no_page. The tab shows its "new page" or "published, no address" text in the same case.
- The tab measures
-
An optimize draft republished at a new address is read at that address, as the tab reads it. One published at its own address reads the same page as before.
-
REST mirror. The route calls the same function. Its 409 and the tool's error carry the same new message. Nothing read the old message. The tab has its own string with the same words, and that hasn't changed.
-
Organization.
draftForhasn't changed:brands!innerfiltered on the key'sorganization_id.- A key of another organization gets null, which means a 404 or "Draft not found", and the RPC isn't called.
- The RPC still gets the draft's own brand.
published_urlis used only as the page to measure. It isn't returned.
-
Tests. Without the change, the new test fails on all three of its checks:
- the select has no
published_url; - the
createdraft returnsno_pageand makes no RPC call; - the optimize draft is measured at
source_url.
The old
no_pagetest still holds, since both addresses are null there. - the select has no
-
#1548's docs then hold. "As the Live page tab reads it" (
SKILL.md:269-274, guide:306) and "Once the page is live" (:662) now cover a published new page. "A draft of a new page, not live yet, has none" stays true. -
Merge. On main it's a fast-forward. It shares no files with #1548 and merges cleanly with it, in either order.
-
Before the API deploy. Web only, and no migration: 00262 is already applied. Nothing here needs the API. After merge,
get_content_impactreturns a published new page's numbers instead of an error.
Follow-up:
- Let the coach see where a page went live, and since when (
content.ts:183-240,getContentDraftFor).- #1548's workflow 12 tells the coach to pick the period closest to how long the page has been live. No tool returns
published_atorpublished_url, so the coach has to ask. - Fix: return
published_urlandpublished_atfromget_content_draft(00262 sets them together), and add a line to the skill.
- #1548's workflow 12 tells the coach to pick the period closest to how long the page has been live. No tool returns
…t_content_draft, and say a ready draft comes back as it is (#1548, #1554 review) (#1559) Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
Follow-up from the review of #1548. The problem: for a new page that's been published, the MCP tool
get_content_impactsaid "This draft is a new page, not live yet":source_url;published_url, while acreatedraft'ssource_urlstays empty;publishedUrl ?? sourceUrl.What changes:
getContentImpactFor(web/src/lib/mcp/content.ts) reads the draft'spublished_url, and measurespublished_url ?? source_url, as the Live page tab does. An optimized page republished at a new address is read there too./api/mcp/content-drafts/[id]/impact) calls the same function, so it gets the fix.Related issue
Follow-up to #1548 (no issue).
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
get_content_impacton a published new page (Content Editor › Mark published, or Send to CMS). It returns the page's citations, AI visits and clicks, not "not live yet".Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/): 0 errors; the 6 warnings were already on mainyarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Also run:
yarn test(427 files, 4,067 tests) andyarn build.Tests:
createdraft is measured at itspublished_url;published_urlselected. The mock now records eachselect, so the test fails if the column is dropped.A review agent read it. It checked that
DRAFT_COLUMNSis used only bydraftFor, and that the REST route shares the function. Its three suggestions are in: the select check, the field's comment, and the message.🤖 Generated with Claude Code