Skip to content

feat: fork WP author-family blocks (post-author-name, post-author-biography, avatar) - #523

Merged
ViewFromTheBox merged 2 commits into
release/1.0from
feature/518-fork-author-family-blocks
Jun 2, 2026
Merged

ViewFromTheBox merged 2 commits into
release/1.0from
feature/518-fork-author-family-blocks

Conversation

@ViewFromTheBox

@ViewFromTheBox ViewFromTheBox commented Jun 2, 2026 •

Copy link
Copy Markdown
Member

Description

Forks the three upstream WP blocks that replace the deprecated core/post-author — post-author-name, post-author-biography, and avatar — into the artisanpack/* namespace, following the established I5 entity-cluster fork pattern. Each block carries a context-aware editor preview (createEntityPlaceholderEdit), bidirectional core/* ↔ artisanpack/* transforms, server-side _resolved* stamping via PostResolver, and three-renderer parity coverage (Blade + React + Vue). Now that all three replacements ship, artisanpack/post-author restores supports.inserter: false to match upstream's deprecation contract.

Closes: #518

Type of Change

  • New feature (adds new functionality)

Related Issue

Issue: #518 (parent meta: #506)

Motivation and Context

Closes the parity gap between upstream WP's theme block category and the visual-editor fork: previously the fork only shipped core/post-author, which upstream itself hides because post-author-name + post-author-biography + avatar are the recommended replacements. Authors copying a Gutenberg pattern with any of these blocks saw "Unknown block" failures. This PR ships the first family from the meta-issue (#506) — the smallest scope sub-issue, which also unlocks the inserter-hide for the deprecated post-author block.

Changes Made

Three new forked blocks under resources/js/visual-editor/blocks/:

Each block ships block.json (artisanpack namespace, artisanpack/postPreview in usesContext), edit.tsx (via createEntityPlaceholderEdit), save.tsx returning null, transforms.ts (bidirectional with core/*), inline-SVG inserter-icon.tsx, and an upstream-state.json decision log.

Server-side resolution — src/Resources/PostResolver.php adds the six new block names (core/* + artisanpack/*) to SUPPORTED_BLOCKS and dispatches all three slugs to the existing resolveAuthor() since the resolved data shape is identical.

Three-renderer parity:

  • Blade: 6 new partials (core/{name}.blade.php + artisanpack/{name}.blade.php delegating via @include).
  • React: 3 new components in core/postContext.tsx + 6 new entries in registerCoreBlocks.ts.
  • Vue: same pattern.
  • Manifest: packages/renderer-parity.json gains 6 entries; npm run verify:parity is green.

Deprecation cutover: artisanpack/post-author/block.json restores supports.inserter: false to match upstream now that the replacements ship. upstream-state.json knownDivergences is trimmed accordingly.

How Has This Been Tested?

Testing Environment:

  • Operating System: macOS Darwin 25.5.0
  • Browser: Chrome (latest)
  • PHP Version: 8.4.3
  • Project Version: 1.0.0-spike (release/1.0)

Tests Performed:

  1. npm run test — full Vitest suite: 1702/1702 tests pass (including the 13 new author-family contract tests and 6 new query-preview tests)
  2. composer test — full Pest suite: 809/809 tests pass (including 4 new PostResolver tests covering both artisanpack/* forks and their core/* counterparts)
  3. npm run verify:parity — renderer parity check: 95/95 blocks registered across blade/react/vue
  4. npm run upstream-diff — all forks in sync with their pinned upstream
  5. npm run build — TypeScript build green
  6. Manual test in keystone-cms: opened /admin/site-editor, dropped the three new blocks into a template Query Loop. Editor preview correctly stamps the resolved post's author name and avatar (host-side User model needed name / avatar_url accessors for the bridge — host wiring, out of scope for this PR). Deprecated artisanpack/post-author no longer appears in the inserter. Bidirectional block transforms round-trip losslessly.

Accessibility Tests Run

  • Keyboard navigation tested
  • Screen reader tested (avatar block emits an alt attribute pulled from _resolvedAuthorName; missing alt falls back to empty per upstream core/avatar semantics)
  • Color contrast verified (no new color rules introduced)
  • ARIA labels checked

Details: The new blocks emit the same Gutenberg-shaped markup as their upstream counterparts; no new interactive surfaces or focus management was introduced.

Tests Added

  • Unit tests added/updated
  • Integration tests added/updated
  • All tests passing

Test details:

  • resources/js/visual-editor/blocks/__tests__/author-family.test.ts (new) — 13 contract tests covering block.json namespace + textdomain + artisanpack/postPreview in usesContext, dynamic null save, bidirectional transforms, and avatar's commentId forward-compat
  • resources/js/visual-editor/blocks/_shared/__tests__/entity-placeholder-query-preview.test.tsx (extended) — 6 new tests for the three blocks' query-preview behavior plus a flipped assertion for artisanpack/post-author now being inserter-hidden
  • tests/Unit/VisualEditor/Resources/PostResolverArtisanPackTest.php (extended) — 4 new tests covering server-side resolution for the three new artisanpack/* blocks and their core/* counterparts

Documentation

  • Inline code documentation added (PHPDoc + TSDoc on every new block file, with upstream-state.json decision logs)
  • README updated (no README changes required)

Documentation details: Each new block's upstream-state.json records the upstream pinned version (9.43.0), file-by-file divergence status, and known divergences from upstream — consumed by scripts/upstream-diff.mjs for drift detection.

Screenshots

N/A — the new blocks render byte-equivalent to their upstream counterparts. Visual diff was confirmed during manual testing in keystone-cms.

Pre-Submission Checklist

  • Followed contributing guidelines
  • Checked for other open PRs for same update
  • Code passes all tests
  • Code has been linted
  • Accessibility tests completed
  • Code follows project style guide
  • Self-review completed
  • Comments added for complex code
  • No new warnings generated

Summary by CodeRabbit

  • New Features

    • Added three author-related blocks: Avatar, Post Author Name, and Post Author Biography; Post Author is hidden from the inserter in favor of these specialized blocks.
  • Chores

    • Renderer and backend now support stamping/resolving the new author-family blocks for consistent server-rendered output.
  • Tests

    • Added comprehensive tests validating transforms, preview fallbacks, and resolver stamping for the new author blocks.

…graphy, avatar)

Forks the three upstream WP blocks that replace the deprecated
core/post-author: post-author-name, post-author-biography, and avatar.
Each block ships block.json with the artisanpack namespace +
artisanpack/postPreview in usesContext, a createEntityPlaceholderEdit
preview, a dynamic null save, bidirectional core/* ↔ artisanpack/*
transforms, an inline-SVG inserter icon, and an upstream-state.json
decision log.

PostResolver dispatches all three new slugs to the existing
resolveAuthor() since the resolved data shape is identical. Blade,
React, and Vue renderer-parity coverage matches the post-author
fork's "delegate to core partial" pattern; the renderer-parity
manifest gains six entries (core/* and artisanpack/* per block).

Now that the replacements ship, artisanpack/post-author restores
supports.inserter: false to match upstream's deprecation. The
entity-placeholder-query-preview test flips the post-author
insertable assertion and adds six new tests for the author family's
query-preview behavior. A dedicated author-family.test.ts mirrors
the I5 entity-cluster contract suite. PostResolverArtisanPackTest
adds four PHP tests covering both the artisanpack/* forks and their
core/* counterparts.

The avatar block keeps commentId in usesContext for forward-compat
with the comments family fork (#519).

Closes #518
@coderabbitai

coderabbitai Bot commented Jun 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a518cffa-7e25-4f53-98f3-814495c78a4a

📥 Commits

Reviewing files that changed from the base of the PR and between e115179 and da86513.

📒 Files selected for processing (3)
  • packages/visual-editor-renderer-react/src/blocks/core/postContext.tsx
  • packages/visual-editor-renderer-vue/src/blocks/core/postContext.ts
  • tests/Unit/VisualEditor/Resources/PostResolverArtisanPackTest.php
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/visual-editor-renderer-react/src/blocks/core/postContext.tsx
  • packages/visual-editor-renderer-vue/src/blocks/core/postContext.ts
  • tests/Unit/VisualEditor/Resources/PostResolverArtisanPackTest.php

📝 Walkthrough

Walkthrough

Three author-related blocks (post-author-name, post-author-biography, avatar) are added as paired core/artisanpack fork variants across Blade, React, and Vue renderers. Each block includes Gutenberg metadata, editor placeholder behavior, server-side rendering, bidirectional transforms, and integration with the PostResolver backend system. Comprehensive tests validate block contracts and query-preview fallback behavior.

Changes

Author Family Block Fork Implementation

Layer / File(s) Summary
Renderer registration and parity setup
packages/renderer-parity.json, packages/visual-editor-renderer-react/src/blocks/registerCoreBlocks.ts, packages/visual-editor-renderer-vue/src/blocks/registerCoreBlocks.ts
Canonical block names (post-author-name, post-author-biography, avatar) added to renderer-parity.json; React and Vue registries extend CORE_BLOCKS mappings to include the three author-family blocks and corresponding imports.
Blade template implementations (core and fork)
packages/visual-editor-renderer-blade/resources/views/blocks/core/avatar.blade.php, packages/visual-editor-renderer-blade/resources/views/blocks/core/post-author-name.blade.php, packages/visual-editor-renderer-blade/resources/views/blocks/core/post-author-biography.blade.php, packages/visual-editor-renderer-blade/resources/views/blocks/artisanpack/*
Core Blade templates compute/sanitize resolved attributes, conditionally render links and images; artisanpack fork templates delegate to core partials via @include for byte-identical output.
React block renderer implementations
packages/visual-editor-renderer-react/src/blocks/core/postContext.tsx
Adds React renderers PostAuthorNameBlock, PostAuthorBiographyBlock, AvatarBlock that render resolved _resolved* attributes, conditionally wrap links, and handle missing avatar URLs.
Vue block renderer implementations
packages/visual-editor-renderer-vue/src/blocks/core/postContext.ts
Adds Vue renderers PostAuthorNameBlock, PostAuthorBiographyBlock, AvatarBlock with similar behavior to React renderers, using buildLinkProps and default linkTarget '_self'.
Avatar block definition and configuration (complete)
resources/js/visual-editor/blocks/avatar/block.json, resources/js/visual-editor/blocks/avatar/edit.tsx, resources/js/visual-editor/blocks/avatar/save.tsx, resources/js/visual-editor/blocks/avatar/transforms.ts, resources/js/visual-editor/blocks/avatar/inserter-icon.tsx, resources/js/visual-editor/blocks/avatar/index.ts, resources/js/visual-editor/blocks/avatar/upstream-state.json
Registers artisanpack/avatar block metadata and attributes, adds editor placeholder edit that derives image preview from author data, dynamic save returning null, bidirectional transforms with core/avatar, inserter icon, entrypoint index, and upstream-state metadata.
Post-author-name block definition and configuration (complete)
resources/js/visual-editor/blocks/post-author-name/block.json, resources/js/visual-editor/blocks/post-author-name/edit.tsx, resources/js/visual-editor/blocks/post-author-name/save.tsx, resources/js/visual-editor/blocks/post-author-name/transforms.ts, resources/js/visual-editor/blocks/post-author-name/inserter-icon.tsx, resources/js/visual-editor/blocks/post-author-name/index.ts, resources/js/visual-editor/blocks/post-author-name/upstream-state.json
Registers artisanpack/post-author-name with attributes isLink/linkTarget, placeholder edit mapping author.name, dynamic save returning null, transforms for round-trip with core/post-author-name, inserter icon, index entry, and upstream-state metadata.
Post-author-biography block definition and configuration (complete)
resources/js/visual-editor/blocks/post-author-biography/block.json, resources/js/visual-editor/blocks/post-author-biography/edit.tsx, resources/js/visual-editor/blocks/post-author-biography/save.tsx, resources/js/visual-editor/blocks/post-author-biography/transforms.ts, resources/js/visual-editor/blocks/post-author-biography/inserter-icon.tsx, resources/js/visual-editor/blocks/post-author-biography/index.ts, resources/js/visual-editor/blocks/post-author-biography/upstream-state.json
Registers artisanpack/post-author-biography, placeholder edit mapping author.bio (html), dynamic save returning null, bidirectional transforms with core/post-author-biography, inserter icon, index entry, and upstream-state metadata.
Backend resolver wiring for author-family blocks
src/Resources/PostResolver.php
Expands SUPPORTED_BLOCKS to include core/* and artisanpack/* author-family slugs and maps post-author* and avatar variants to resolveAuthor() so _resolved* attributes (name, url, bio, avatar) are stamped during post traversal.
Block contract validation and integration tests
resources/js/visual-editor/blocks/__tests__/author-family.test.ts, resources/js/visual-editor/blocks/_shared/__tests__/entity-placeholder-query-preview.test.tsx, resources/js/visual-editor/blocks/post-author/block.json, resources/js/visual-editor/blocks/post-author/upstream-state.json, tests/Unit/VisualEditor/Resources/PostResolverArtisanPackTest.php
Adds Vitest and unit tests verifying block.json metadata, dynamic save returns null, bidirectional transforms, entity-placeholder query-preview rendering and fallbacks, inserter support change for post-author, and PostResolver stamping parity between core and artisanpack blocks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related issues

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant Editor
  participant EditPlaceholder as createEntityPlaceholderEdit
  participant PostResolver as PostResolver.php
  participant BladeTemplate as core Blade partial

  Editor->>EditPlaceholder: show preview using _resolved* (author data)
  Editor->>PostResolver: save/post traversal
  PostResolver->>BladeTemplate: stamp and pass _resolved* attrs
  BladeTemplate->>Editor: render sanitized HTML (img/links/text)
Loading

Poem

🐰 I hopped through blocks of name and bio,

an avatar peeking where authors go,
Blade, React, Vue all sing the same tune,
stamps and transforms under a silver moon,
core and artisanpack hopping in row.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: fork WP author-family blocks (post-author-name, post-author-biography, avatar)' clearly and concisely summarizes the main change: forking three WordPress author-related blocks into the artisanpack namespace.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/518-fork-author-family-blocks

Comment @coderabbitai help to get the list of available commands and usage tips.

@ViewFromTheBox ViewFromTheBox moved this from Backlog to In Review in ArtisanPack UI Overview Jun 2, 2026
@ViewFromTheBox
ViewFromTheBox marked this pull request as ready for review June 2, 2026 02:08

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/visual-editor-renderer-react/src/blocks/core/postContext.tsx`:
- Around line 213-243: PostAuthorNameBlock and PostAuthorBiographyBlock
currently ignore attributes.textAlign, so add handling to read the alignment
(e.g., const textAlign = attrString(attributes.textAlign)) and include a
conditional class "has-text-align-{textAlign}" in the classes passed to
classList; update both PostAuthorNameBlock (ensuring the class is applied
whether rendering the <a> link branch or the plain <div>) and
PostAuthorBiographyBlock (applied to the <p>) so the editor's text alignment
(has-text-align-left/center/right/etc.) is emitted when attributes.textAlign is
present.

In `@tests/Unit/VisualEditor/Resources/PostResolverArtisanPackTest.php`:
- Around line 123-143: The test currently asserts literal values on core/*
stamped blocks which doesn't verify parity with artisanpack/*; update the test
to call PostResolver::stampBlock for the artisanpack variants (e.g.,
'artisanpack/post-author-name', 'artisanpack/post-author-biography',
'artisanpack/avatar') using the same fakeArtisanPackPost(), then assert that the
core/* attributes (_resolvedAuthorName, _resolvedAuthorBio,
_resolvedAuthorAvatar) are equal to the corresponding attributes on the
artisanpack/* stamped results (use the same PostResolver->stampBlock calls to
produce both sides) rather than comparing to hard-coded strings.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ba3fe402-be79-4a12-a6ca-4d51f6206a78

📥 Commits

Reviewing files that changed from the base of the PR and between 66a2025 and e115179.

📒 Files selected for processing (38)
  • packages/renderer-parity.json
  • packages/visual-editor-renderer-blade/resources/views/blocks/artisanpack/avatar.blade.php
  • packages/visual-editor-renderer-blade/resources/views/blocks/artisanpack/post-author-biography.blade.php
  • packages/visual-editor-renderer-blade/resources/views/blocks/artisanpack/post-author-name.blade.php
  • packages/visual-editor-renderer-blade/resources/views/blocks/core/avatar.blade.php
  • packages/visual-editor-renderer-blade/resources/views/blocks/core/post-author-biography.blade.php
  • packages/visual-editor-renderer-blade/resources/views/blocks/core/post-author-name.blade.php
  • packages/visual-editor-renderer-react/src/blocks/core/postContext.tsx
  • packages/visual-editor-renderer-react/src/blocks/registerCoreBlocks.ts
  • packages/visual-editor-renderer-vue/src/blocks/core/postContext.ts
  • packages/visual-editor-renderer-vue/src/blocks/registerCoreBlocks.ts
  • resources/js/visual-editor/blocks/__tests__/author-family.test.ts
  • resources/js/visual-editor/blocks/_shared/__tests__/entity-placeholder-query-preview.test.tsx
  • resources/js/visual-editor/blocks/avatar/block.json
  • resources/js/visual-editor/blocks/avatar/edit.tsx
  • resources/js/visual-editor/blocks/avatar/index.ts
  • resources/js/visual-editor/blocks/avatar/inserter-icon.tsx
  • resources/js/visual-editor/blocks/avatar/save.tsx
  • resources/js/visual-editor/blocks/avatar/transforms.ts
  • resources/js/visual-editor/blocks/avatar/upstream-state.json
  • resources/js/visual-editor/blocks/post-author-biography/block.json
  • resources/js/visual-editor/blocks/post-author-biography/edit.tsx
  • resources/js/visual-editor/blocks/post-author-biography/index.ts
  • resources/js/visual-editor/blocks/post-author-biography/inserter-icon.tsx
  • resources/js/visual-editor/blocks/post-author-biography/save.tsx
  • resources/js/visual-editor/blocks/post-author-biography/transforms.ts
  • resources/js/visual-editor/blocks/post-author-biography/upstream-state.json
  • resources/js/visual-editor/blocks/post-author-name/block.json
  • resources/js/visual-editor/blocks/post-author-name/edit.tsx
  • resources/js/visual-editor/blocks/post-author-name/index.ts
  • resources/js/visual-editor/blocks/post-author-name/inserter-icon.tsx
  • resources/js/visual-editor/blocks/post-author-name/save.tsx
  • resources/js/visual-editor/blocks/post-author-name/transforms.ts
  • resources/js/visual-editor/blocks/post-author-name/upstream-state.json
  • resources/js/visual-editor/blocks/post-author/block.json
  • resources/js/visual-editor/blocks/post-author/upstream-state.json
  • src/Resources/PostResolver.php
  • tests/Unit/VisualEditor/Resources/PostResolverArtisanPackTest.php

Comment thread tests/Unit/VisualEditor/Resources/PostResolverArtisanPackTest.php Outdated
- React + Vue PostAuthorNameBlock / PostAuthorBiographyBlock now read
  attributes.textAlign and emit has-text-align-{align} classes,
  matching the existing PostTitle / PostDate / PostExcerpt pattern.
  Both blocks declare typography.textAlign: true in block.json but the
  renderers were dropping the alignment on save. Blade is unaffected
  because BlockSupports::wrapperAttrs already handles textAlign for
  every wrapper.

- PostResolverArtisanPackTest's core-vs-artisanpack parity case now
  asserts the resolved attribute bags are equal, so a one-sided
  regression on either namespace trips the test instead of passing
  against the static literal baseline.
@ViewFromTheBox
ViewFromTheBox merged commit da21957 into release/1.0 Jun 2, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in ArtisanPack UI Overview Jun 2, 2026
@ViewFromTheBox
ViewFromTheBox deleted the feature/518-fork-author-family-blocks branch June 2, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Fork WP theme blocks · Author family (post-author-name, post-author-biography, avatar)

1 participant