Skip to content

[Blueprints] Allow WXR imports to choose default author - #3887

Merged
adamziel merged 3 commits into
trunkfrom
add-import-wxr-default-author-option
Jul 3, 2026
Merged

[Blueprints] Allow WXR imports to choose default author#3887
adamziel merged 3 commits into
trunkfrom
add-import-wxr-default-author-option

Conversation

@adamziel

@adamziel adamziel commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

What?

Adds a defaultAuthorUsername option to the importWxr Blueprint step.

When the WordPress importer cannot map an imported author, it falls back to the current WordPress user. This PR keeps the existing default as admin, but lets callers choose a different existing local user by username. Empty or whitespace-only values fall back to admin.

Why?

Blueprint v2 already models a default-author author strategy. This gives that future runner a focused primitive it can use without adding WXR parsing, remote user creation, author maps, or SQL URL rewriting in the same PR.

Consumers

Consumer Benefit
Blueprint v1 importWxr users Can choose which existing local user receives posts whose imported authors cannot be mapped.
Blueprint v2 runner work Can map authorsMode: "default-author" / defaultAuthorUsername to the existing importer fallback behavior.
Studio / Telex / wp-env integrations Get a small, backwards-compatible author-control primitive while larger import semantics remain separate.

Not included

Area Reason
importUsers Creating users from WXR needs separate importer semantics and tests.
authorsMap Explicit remote-to-local mapping is more complex than the default-author fallback.
SQL URL rewriting Needs structured-data-aware handling and should be deferred.
WXR site options Removed from this repo's Blueprint v2 schema in the previous PR.

Testing

  • npm exec nx run playground-blueprints:build:blueprint-schema
  • npm run format:uncommitted
  • npm exec nx run playground-blueprints:test:vite -- --testFiles=packages/playground/blueprints/src/tests/steps/import-wxr.spec.ts
  • npm exec nx run playground-blueprints:typecheck
  • npm exec nx run playground-blueprints:lint
  • git diff --check

Part of #2592.

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for configuring the default local author used by the WXR importer when imported authors can’t be mapped, keeping admin as the backwards-compatible default.

Changes:

  • Introduces defaultAuthorUsername option to the importWxr step API and schema (defaulting to admin).
  • Updates the default importer path to set WordPress “current user” to the configured default author before import.
  • Adds a test validating that unmapped authors are assigned to the configured default user.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
packages/playground/blueprints/src/lib/steps/import-wxr.ts Adds defaultAuthorUsername option and wires it into the importer by setting WP current user.
packages/playground/blueprints/public/blueprint-schema.json Extends blueprint JSON schema with defaultAuthorUsername (default admin).
packages/playground/blueprints/src/tests/steps/import-wxr.spec.ts Adds coverage ensuring posts/pages end up authored by the configured default user.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/playground/blueprints/src/lib/steps/import-wxr.ts
Comment thread packages/playground/blueprints/public/blueprint-schema.json
Comment thread packages/playground/blueprints/src/lib/steps/import-wxr.ts
Comment thread packages/playground/blueprints/src/tests/steps/import-wxr.spec.ts
Comment thread packages/playground/blueprints/src/tests/steps/import-wxr.spec.ts Outdated
@adamziel
adamziel merged commit dea680c into trunk Jul 3, 2026
102 of 103 checks passed
@adamziel
adamziel deleted the add-import-wxr-default-author-option branch July 3, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment