Keep WordPress drafts out of the published archive - #64
Open
ssavutu wants to merge 1 commit into
Open
Conversation
The extractor never collected wp:status, so there was nothing downstream to filter on and every <item> of post_type "post" became a live article. On Delta that published 18 posts WordPress was holding back -- 4 of its 5 private posts, its only pending one, and 13 drafts -- each reachable at its own URL and marked "index, follow". A private 2016 sponsored post and a story about a business being cited for violations were among them. Status now rides along from Extractor through the translator, and the formatter withholds pub_date for anything that is not "publish". That is exactly how the CMS models a draft (PublishDueArticles keys on a null pub_date), so a withheld post lands as an editable draft rather than a live page. creation_date is resolved before that point, so the piece keeps its date and still sorts. A missing status defaults to "publish": an export taken before the extractor collected the field must still import its archive as published rather than blanking ten thousand articles. The 18 already-published posts were archived directly in prod; this stops a reseed from putting them back. Co-Authored-By: Claude Opus 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 went wrong
Extractornever collectedwp:status. With no status downstream there was nothing to filter on, so every<item>of post_typepostbecame a live article.On Delta that published 18 posts WordPress was holding back — 4 of its 5 private posts, its only pending one, and 13 drafts. Each had its own URL and
<meta name="robots" content="index, follow">. Among them: a private 2016 sponsored post, and a story about a local business cited for violations.Found while chasing an unrelated question about a category named "Paid Post" that appeared in Delta but showed zero published posts in WordPress — because the article behind it is
privatethere.The fix
Extractor.py—wp:statusadded to_POST_ITEM_KEYSand_ARTICLE_SCALAR_TAGS. Both were needed: the first collects the key, the second maps the namespaced tag onto it.ArticleTranslator— carries a normalizedstatus, mirroring how_normalizeCommentStatusalready absorbs WordPress's inconsistent casing.ArticleFormatter— anything notpublishgetspub_date = NULL.A null
pub_dateis precisely how the CMS models a draft (PublishDueArticleskeys on it), so a withheld post arrives as an editable draft and is absent from search, sitemap, feeds, comments and embeddings.creation_dateis resolved before that point, so the piece keeps its date and still sorts correctly for an editor.A missing status defaults to
publish— an export predating this field must still import the archive as published rather than blanking ten thousand articles.Verification
End-to-end through the real
Extractor→Translator→Formatterpath against the production WXR:8 new tests in
tests/test_article_status.py; all 15 test modules pass.Prod
The 18 live posts were archived directly on Delta and now return 404. This change stops a reseed from putting them back.
Scope was closed by checking all 119 non-published WP posts: 26 have slugs (16 leaked), 93 do not (80 usable titles → 2 leaked; 7 others turned out to be duplicate-title pairs where WordPress publishes its own copy, so the Delta row is the published original under a collision-suffixed slug).
🤖 Generated with Claude Code