Skip to content

test: prove the new render pipeline replicates the legacy DOM for text blocks#2793

Draft
christianhg wants to merge 1 commit into
mainfrom
investigate-pipeline-equivalence
Draft

test: prove the new render pipeline replicates the legacy DOM for text blocks#2793
christianhg wants to merge 1 commit into
mainfrom
investigate-pipeline-equivalence

Conversation

@christianhg

Copy link
Copy Markdown
Member

What

Proves PTE's new defineX render pipeline can replicate the legacy pipeline's DOM 1:1 for text blocks. Each case renders the same value through the legacy pipeline (no render callbacks = engine default) and the new pipeline (a defineTextBlock catch-all reconstructing that default), normalizes both DOM trees (tag + sorted attributes + children), and asserts toEqual.

This is the engine-level capability proof: the new pipeline exposes enough on its render props for a consumer to reconstruct the legacy output. It also pins the two branches most prone to silent divergence — the empty-block zero-width path and the list item whose className defaults level to 1 while data-level stays absent.

What's intentionally excluded (the point, not gaps)

  • The whole data-slate-* namespace: opting into the new pipeline is a clean break, emitting only data-pt-*. The Slate names die with the legacy pipeline; the data-pt-* names that replaced them are present on both sides and verified.
  • data-list-index: plugin-provided (@portabletext/plugin-list-index, pinned by its own tests).

Shelf life

Test-only. It exists while both pipelines coexist; when the legacy pipeline is removed it converts to an absolute DOM-literal assertion or gets deleted (noted in the file). Block objects and inline objects are follow-ups on the same harness.

…t blocks

Renders a battery of text-block values through the legacy pipeline (no
render callbacks, engine default) and the new `defineX` pipeline (a
`defineTextBlock` catch-all reconstructing that default), normalizes both
DOM trees (tag + sorted attributes + children), and asserts they are
equal.

Proves the new pipeline reproduces the legacy DOM 1:1 on the surface that
carries forward: the `pt-block`/`pt-text-block` class taxonomy, the
`data-block-*`/`data-list-item`/`data-level`/`data-style` attributes, the
`data-pt-*` attributes, and the full element structure.

The `data-slate-*` namespace is excluded by design: opting into the new
pipeline is a clean break, emitting only `data-pt-*` and never the
Slate-named attributes. The legacy pipeline emits both; the Slate names
die with the legacy pipeline (EDEX-1249), and the `data-pt-*` names that
replaced them are verified present on both sides. `data-list-index` is
excluded as plugin-provided (`@portabletext/plugin-list-index`).
@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
portable-text-editor-documentation Ready Ready Preview, Comment Jun 15, 2026 9:13am
portable-text-example-basic Ready Ready Preview, Comment Jun 15, 2026 9:13am
portable-text-playground Ready Ready Preview, Comment Jun 15, 2026 9:13am

Request Review

@changeset-bot

changeset-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 80db726

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Stats — @portabletext/editor

Compared against main (41c3c588)

@portabletext/editor

Metric Value vs main (41c3c58)
Internal (raw) 776.0 KB -
Internal (gzip) 148.3 KB -
Bundled (raw) 1.38 MB -
Bundled (gzip) 310.2 KB -
Import time 97ms -0ms, -0.2%

@portabletext/editor/behaviors

Metric Value vs main (41c3c58)
Internal (raw) 467 B -
Internal (gzip) 207 B -
Bundled (raw) 424 B -
Bundled (gzip) 171 B -
Import time 2ms +0ms, +1.6%

@portabletext/editor/plugins

Metric Value vs main (41c3c58)
Internal (raw) 2.7 KB -
Internal (gzip) 894 B -
Bundled (raw) 2.5 KB -
Bundled (gzip) 827 B -
Import time 7ms +0ms, +1.5%

@portabletext/editor/selectors

Metric Value vs main (41c3c58)
Internal (raw) 79.3 KB -
Internal (gzip) 14.5 KB -
Bundled (raw) 74.8 KB -
Bundled (gzip) 13.4 KB -
Import time 8ms +0ms, +2.9%

@portabletext/editor/traversal

Metric Value vs main (41c3c58)
Internal (raw) 25.4 KB -
Internal (gzip) 5.0 KB -
Bundled (raw) 25.4 KB -
Bundled (gzip) 5.0 KB -
Import time 6ms -0ms, -1.5%

@portabletext/editor/utils

Metric Value vs main (41c3c58)
Internal (raw) 28.7 KB -
Internal (gzip) 6.0 KB -
Bundled (raw) 26.7 KB -
Bundled (gzip) 5.7 KB -
Import time 6ms +0ms, +2.1%

🗺️ . · ./behaviors · ./plugins · ./selectors · ./traversal · ./utils · Artifacts

Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

📦 Bundle Stats — @portabletext/markdown

Compared against main (41c3c588)

Metric Value vs main (41c3c58)
Internal (raw) 53.0 KB -
Internal (gzip) 9.6 KB -
Bundled (raw) 347.6 KB -
Bundled (gzip) 96.0 KB -
Import time 40ms +2ms, +4.3%

🗺️ View treemap · Artifacts

Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

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