Repository navigation
fix(posts-import): recognise posts already imported from the same site - #1610
Merged
gregpriday merged 12 commits intoNov 28, 2026
Merged
Conversation
…Press site - Keep the WordPress site and post ID on each imported entry - Match a later export's posts by that ID, else by a kept old address - Plan matched posts in place; selectPlan skips or updates them - Say an old address another post keeps is already its old address
- The review counts the posts already here, skipping them by default - Commit takes the choice; skipped-only imports change nothing - Cover the review's choice in a browser test
- Match by ID across the export before any old address - Own-address matches only for posts of the same site - Link a partial export's posts to entries imported before - Keep a featured picture the export lacks; keep the entry's date - Record the ID on an address-matched update - Draft-link notes follow the entry's own state; damaged redirects are skipped - Show what updating changes; count posts left as they are - Cover the re-import through the controller
- Match by address only entries imported from the same site - Scope the omitted-post lookup to the site's installation; add own routes - Warn of links to drafts, and to posts updating makes drafts - Never write back a saved date the engine refuses
- A ?p= link counts only at the installation's own root - Drop the lookup by an entry's address here, which the old site may have used
- The commit's arguments are now (id, opening, addToNavigation, existing) - The menu review's fixture counts no posts already here
Member
Author
|
CI's one failure is base-level, not this change: |
…ess-export Keeps develop's old-site links and category archive redirects alongside skipping or updating posts already in the project: each way of importing names only the links of the posts it brings, and keeps an old category archive working only while its category comes.
…ess-export A link to a post already in the project keeps its query and names a section it can't open, as develop's links to imported posts now do (entryLink).
…importing-the-same-wordpress-export # Conflicts: # src/main/posts-import/plan.ts # src/main/posts-import/wxr.ts
…importing-the-same-wordpress-export
…importing-the-same-wordpress-export
gregpriday
deleted the
bugfix/issue-1519-importing-the-same-wordpress-export
branch
November 28, 2026 09:56
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.
Importing a WordPress export again brought every post in a second time as a numbered copy, and the review never said the posts were already there. This change recognises posts imported before from the same site. The review counts them and skips them by default, or updates them in place when the author chooses, so only the new posts are imported.
Resolves #1519
What changes
EntryDoc.imported = { site, postId }, set throughentry.create's newimportedfield. The site is the export's base URL with its installation path. A damaged record is a diagnostics warning. The generator reads entries field by field, so the record never reaches the exported site.alreadyImportedinsrc/main/posts-import/plan.ts) considers only entries recorded as imported from the same site. Post-ID matches across the whole export come first. A post with no ID can then match by the entry's address or an old address kept for it. An entry without the record is never matched: a post written in the project, or a redirect an author pointed at one, says nothing about where it came from. Nothing predates the record, since the project is pre-release.selectPlan(plan, 'skip' | 'update')picks what an import brings. Skip leaves out the pictures, new terms and groupings that only skipped posts would have brought. Groupings and terms go to new posts first, so a limit that only updating would hit stops only updating.knownPosts). A link to a post the export leaves out goes to that post's entry rather than the old site. The lookup works by?p=ID at the installation's own root, or by a kept old address, and never across another installation on the same host.PostImportReview.tsx): the review counts the posts already in the project and offers Skip them (the default) or Update them from the export. Its counts, problems and action follow the choice: "Import 1 post", "Import 1 post and update 2", or Close only when there is nothing to import. When updating, matched posts with notes are shown in full. Links to posts that are drafts, or that updating makes drafts, are flagged.commitPostImport(id, opening, addToNavigation, existing)takes the choice. An all-skipped import changes nothing and adds no history step. A mixed import is one step, "Import 3 posts and update 2".Testing
tests/unit/posts-import.test.ts: a repeated export, its draft included, is recognised and skipped by default, with no operations planned. Update in place keeps the address, old addresses and draft state. New posts link to the ones already here. The other cases: ID matches beat an earlier address row; locally written posts and their redirects are never matched; a partial export keeps links and the featured picture; links are scoped to the installation; dates and draft warnings; the last grouping slot goes to a new post; unreadable posts are never put over their entries. The existing "numbers a slug" test now uses another site's posts, since it used to assert the duplicates.tests/unit/posts-import-controller.test.ts(new) runs realreviewPostImportandcommitPostImport. Skipping a repeated export leaves the revision and posts unchanged. A mixed update is one step with the right label and opens the new post. Skip still imports when only updating is blocked.tests/unit/post-import-existing-browser.test.ts(new) covers the review in Chromium: the default choice, the labels, Close-only, problems per choice, and notes when updating.tests/unit/post-import-menu-browser.test.tsnow expects the trailing'skip'argument.npm run typecheckis green.tests/e2e/posts-import.mjs(it only covers a first import, and its assertions still match).Open
wp:post_idon its posts (WordPress writes one for every item) can't be recognised on a second import.