Skip to content

fix(php-transformer): emit a shared navigation entity referenced by token - #2248

Merged
chubes4 merged 2 commits into
trunkfrom
fix/1945-shared-navigation-entity
Sep 26, 2026
Merged

chubes4 merged 2 commits into
trunkfrom
fix/1945-shared-navigation-entity

Conversation

@chubes4

@chubes4 chubes4 commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Problem

Extracted header chrome still inlined core/navigation-link children. WordPress also ships a default Navigation post with <!-- wp:page-list /-->. Editing the menu in the Site Editor therefore did not change the imported header.

Refs #1945.

Design

After shared-shell extraction, cluster core/navigation blocks that share the same destination list (label + URL, order preserved, including submenus) across template parts and page-owned copies.

Each cluster becomes one plan menus record with inner block_markup, a deterministic token, and reconciliation_identity. Host blocks become self-closing with ref set to {{wordpress-site-plan:navigation:TOKEN}}, keeping overlayMenu, className, style, and layout.

No destination post IDs. SSI persists the entity and substitutes the integer ref.

Fix

  • NavigationEntityProjection clusters and rewrites parts/pages, then reanchors runtime entity bindings whose byte offsets moved.
  • Bootstrap still emits the current-page navigation-link filter from entity inner markup.

Tests

php tests/contract/shared-navigation-entity.php fails on trunk (Clustered header destinations become one navigation entity) and passes here.

composer test:canonical, composer test:parity (346 fixtures), composer test:packaging, and php tests/contract/production-acceptance-matrix.php passed.

Evidence

Paired SSI dev package (blocks-engine SHA 527302c608eb) imported the Adventuring Ankara capture.

  • One wp_navigation post titled Header with Home / Blog / About Me / Contact.
  • Default page-list Navigation post remains unused.
  • parts/header.html and the homepage navigation are <!-- wp:navigation {"ref":N,"overlayMenu":"mobile",...} /-->.
  • 1440 link x: 1122 / 1183 / 1241 / 1329 (unchanged vs baseline).
  • 390 hamburger opens the four links.
  • Current-page aria-current matches baseline on /, /about-me/, /blog/.
  • Editing the entity label updates /, /about-me/, and a post.
  • quality_pass with 0 fallbacks.
  • Site Editor header canvas: 1 core/navigation, 0 invalid-block warnings.

Merge order

  1. This PR (Blocks Engine plan entity + token ref).
  2. Automattic/static-site-importer fix/1945-shared-navigation-entity (persist wp_navigation and substitute integer ref).

Do not merge SSI first: older plans have no tokens, and this plan is not yet persisted.

AI assistance

  • AI assistance: Yes
  • Model: Grok 4.6
  • Tool: Claude (Anthropic) via Claude Code, orchestrated by chubes4; follow-up implementation via OpenCode (Grok 4.6)
  • Used for: Reading Shared chrome stays inline in post_content when a capture has responsive document variants #1945 and related PRs, emitting the shared navigation entity, adding the trunk-failing contract test, running composer suites, pairing an SSI import, measuring geometry, and drafting this PR. A human remains responsible for review and merge.

Refs #1945

…oken

Cluster identical destination lists across template parts and page-owned
copies into one menu record, rewrite those core/navigation blocks to a
self-closing token ref, and keep overlay and class attributes on the host.
The plan still emits one shared menu entity, but host markup keeps its
children so WordPress can render without a destination post id.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant