Repository navigation
Fix WXR import dropping taxonomies - #1083
ask-bonk[bot] wants to merge 1 commit into
Conversation
Co-authored-by: ascorbic <[email protected]>
🦋 Changeset detectedLatest commit: 3e4ec97 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-perf-coordinator | 3e4ec97 | May 18 2026, 06:18 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
docs | 3e4ec97 | May 18 2026, 06:19 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-i18n | 3e4ec97 | May 18 2026, 06:18 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-playground | 3e4ec97 | May 18 2026, 06:19 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-cache | 3e4ec97 | May 18 2026, 06:19 AM |
Scope checkThis PR changes 860 lines across 4 files. Large PRs are harder to review and more likely to be closed without review. If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs. See CONTRIBUTING.md for contribution guidelines. |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/blocks
@emdash-cms/cloudflare
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
Diff looks clean. Now post the summary comment for the maintainer.
Summary
Fixed WXR XML import discards taxonomies (issue #1061).
Root cause
The HTTP WXR execute handler (
packages/core/src/astro/routes/api/import/wordpress/execute.ts) parsedwp:category,wp:tag,wp:term, and per-item<category domain="…">blocks but never wrote anything totaxonomiesorcontent_taxonomies. ThehandleContentCreate()call passed onlydata,slug,status, etc. — no taxonomy info — so categories/tags/custom taxonomy assignments were silently dropped at the persistence step, exactly as the bug report described.Fix
packages/core/src/import/wxr-taxonomies.tswithpreImportWxrTaxonomies()andattachPostTaxonomies():wp:category→ seededcategorytaxonomy, everywp:tag→ seededtagtaxonomy, and everywp:term→ matching custom taxonomy (case-sensitive name match). Idempotent: existing terms are reused, not duplicated. Builds a(taxonomy, slug) → term idlookup.handleContentCreate, walkpost.categories/post.tags/post.customTaxonomiesand callTaxonomyRepository.attachToEntry()for each (which writes thecontent_taxonomiespivot via the translation_group, matching how seed and admin UI do it).collectionsarray (won't tag aproductsrow with acategoryterm linked only toposts).post_tagsynonym → EmDashtag. Skipsnav_menu(handled byimportMenusFromWxr).missingTaxonomies: string[]field on the response (per AGENTS.md backwards-compat rule: additive only). Same for seededcategory/tagdefs that a user may have deleted.errors[]array.execute.ts: pre-pass runs once before the post loop; per-post attach runs after each successful create. Newresult.taxonomies = { termsCreated, termsReused, assignments, missingTaxonomies }block on the response so the admin UI can report what happened.Test coverage
New
packages/core/tests/unit/import/wxr-taxonomies.test.ts— 14 tests covering:wp:category/wp:tagblocks<category nicename>without a top-level block)missingTaxonomieswhen not)post_tagsynonym normalizationnav_menuskipmissingTaxonomiescontent_taxonomiescollectionsfilter enforcement (no cross-collection contamination)INSERT … ON CONFLICT DO NOTHING)Verification
pnpm --filter emdash test: 3307 tests pass (+1 new for missing-seeded-def case)pnpm --filter emdash typecheck: cleanpnpm lint:json: 0 issues in touched files (38 unrelated pre-existing diagnostics elsewhere)pnpm --filter emdash build: cleanChangeset added at
.changeset/fix-wxr-taxonomy-import.md(patch bump foremdash).Closes #1061
github run