From c121b18507da38cdaad75d47d802d34eea6117e0 Mon Sep 17 00:00:00 2001 From: Chris Huber Date: Mon, 16 Nov 2026 11:04:43 +0000 Subject: [PATCH] test: correct shared-shell SVG asset identity expectations --- .../src/ArtifactCompiler/ArtifactCompiler.php | 3 +- .../src/ArtifactCompiler/SourceShells.php | 7 ++- php-transformer/src/Contract/BoxTree.php | 12 ++++ .../Classification/SubtreeClassifier.php | 2 +- .../Elements/WrapperCoalescer.php | 2 +- .../Patterns/SocialLinksPattern.php | 2 +- .../ReusableComponentRecognizer.php | 1 + .../RichText/NavigationLabelNormalizer.php | 2 +- .../Style/AuthorStyleAnalysis.php | 1 + .../Style/SourceBlockAttributeProjector.php | 2 +- .../Support/AddressableInlineLayoutLeaf.php | 4 +- .../src/HtmlToBlocks/Support/SourceDom.php | 12 ++-- .../src/Support/SourceAttribute.php | 7 ++- .../tests/contract/shared-shell-plan.php | 10 +++- .../tests/unit/box-tree-node-id-neutral.php | 55 ++++++++++++++----- 15 files changed, 88 insertions(+), 34 deletions(-) diff --git a/php-transformer/src/ArtifactCompiler/ArtifactCompiler.php b/php-transformer/src/ArtifactCompiler/ArtifactCompiler.php index 195626422c..10db7a8f2d 100644 --- a/php-transformer/src/ArtifactCompiler/ArtifactCompiler.php +++ b/php-transformer/src/ArtifactCompiler/ArtifactCompiler.php @@ -2535,7 +2535,8 @@ private function compileSharedInlineShells(array $files, string $entryPath, stri // same compilation group and its canonical support assets. } unset($areaRows, $row); - $documents[(string) $file['path']] = array('content' => (string) $file['content'], 'rows' => $rows); + // Shared stylesheet comparison must not see route-specific capture IDs. + $documents[(string) $file['path']] = array('content' => $dom->documentElement instanceof DOMElement ? SourceDom::outerHtml($dom->documentElement) : (string) $file['content'], 'rows' => $rows); } if (count($documents) < 2) return array('artifacts' => array(), 'assets' => array(), 'author_stylesheet_projections' => array(), 'runtime_script_projections' => array()); diff --git a/php-transformer/src/ArtifactCompiler/SourceShells.php b/php-transformer/src/ArtifactCompiler/SourceShells.php index b1fe193f41..8bbe84fa4e 100644 --- a/php-transformer/src/ArtifactCompiler/SourceShells.php +++ b/php-transformer/src/ArtifactCompiler/SourceShells.php @@ -28,7 +28,7 @@ public static function ancestorContext(\DOMElement $landmark): array $context = array(); for ($cursor = $landmark->parentNode; $cursor instanceof \DOMElement; $cursor = $cursor->parentNode) { $attributes = array(); - foreach ($cursor->attributes ?? array() as $attribute) $attributes[strtolower($attribute->name)] = $attribute->value; + $attributes = SourceDom::htmlAttributes($cursor); array_unshift($context, array('tag' => strtolower($cursor->tagName), 'attributes' => $attributes)); } return $context; @@ -129,6 +129,11 @@ public static function identity(string $markup, bool $ignoreViewportEntrance = t { $dom = HtmlSerialization::parseDocument('' . $markup . ''); $xpath = new \DOMXPath($dom); + foreach ($dom->getElementsByTagName('*') as $node) { + foreach (iterator_to_array($node->attributes) as $attribute) { + if (\Automattic\BlocksEngine\PhpTransformer\Contract\BoxTree::isEvidenceAttribute($attribute->name)) $node->removeAttributeNode($attribute); + } + } if ($ignoreViewportEntrance) { foreach ($xpath->query('//*[@' . CaptureEvidence::VIEWPORT_ENTRANCE . ']') ?: array() as $node) { if (!$node instanceof \DOMElement) continue; diff --git a/php-transformer/src/Contract/BoxTree.php b/php-transformer/src/Contract/BoxTree.php index 0ec933475d..6197a2b118 100644 --- a/php-transformer/src/Contract/BoxTree.php +++ b/php-transformer/src/Contract/BoxTree.php @@ -27,6 +27,18 @@ final class BoxTree 'width', 'height', 'min-width', 'max-width', 'min-height', 'max-height', ); + /** Capture identity is only meaningful to box-tree lookup, never authored markup. */ + public static function isEvidenceAttribute(string $name): bool + { + return self::NODE_ATTRIBUTE === strtolower($name); + } + + /** @return list<\DOMAttr> Authored attributes, without capture-only identity. */ + public static function authoredAttributes(DOMElement $element): array + { + return array_values(array_filter(iterator_to_array($element->attributes), static fn (\DOMAttr $attribute): bool => ! self::isEvidenceAttribute($attribute->name))); + } + public static function validId(mixed $id): bool { return is_string($id) && 1 === preg_match('/^[A-Za-z0-9._:-]{1,80}$/D', $id); diff --git a/php-transformer/src/HtmlToBlocks/Classification/SubtreeClassifier.php b/php-transformer/src/HtmlToBlocks/Classification/SubtreeClassifier.php index 19ac9ac952..9f15ec8ee4 100644 --- a/php-transformer/src/HtmlToBlocks/Classification/SubtreeClassifier.php +++ b/php-transformer/src/HtmlToBlocks/Classification/SubtreeClassifier.php @@ -373,7 +373,7 @@ private function hasAttributePrefix(array $elements, string $prefix): bool { foreach ( $elements as $element ) { foreach ( $element->attributes ?? array() as $attribute ) { - if ( str_starts_with(strtolower($attribute->nodeName), $prefix) ) { + if ( ! \Automattic\BlocksEngine\PhpTransformer\Contract\BoxTree::isEvidenceAttribute($attribute->nodeName) && str_starts_with(strtolower($attribute->nodeName), $prefix) ) { return true; } } diff --git a/php-transformer/src/HtmlToBlocks/Elements/WrapperCoalescer.php b/php-transformer/src/HtmlToBlocks/Elements/WrapperCoalescer.php index a545dbb75d..795d6327e0 100644 --- a/php-transformer/src/HtmlToBlocks/Elements/WrapperCoalescer.php +++ b/php-transformer/src/HtmlToBlocks/Elements/WrapperCoalescer.php @@ -468,7 +468,7 @@ private function isInheritedTextWrapper(DOMElement $element): bool foreach ($element->childNodes as $node) { if (XML_TEXT_NODE === $node->nodeType && '' !== trim((string) $node->nodeValue)) return false; } - foreach ($element->attributes as $attribute) { + foreach (\Automattic\BlocksEngine\PhpTransformer\Contract\BoxTree::authoredAttributes($element) as $attribute) { if (! in_array(strtolower($attribute->nodeName), array('class', 'style', 'data-node-view-wrapper', 'data-node-view-content', 'data-node-view-content-inner'), true)) return false; } foreach ($this->session->authorStyleRuleCandidates($element) as $rule) { diff --git a/php-transformer/src/HtmlToBlocks/Patterns/SocialLinksPattern.php b/php-transformer/src/HtmlToBlocks/Patterns/SocialLinksPattern.php index 3f674e1319..92aa18884a 100644 --- a/php-transformer/src/HtmlToBlocks/Patterns/SocialLinksPattern.php +++ b/php-transformer/src/HtmlToBlocks/Patterns/SocialLinksPattern.php @@ -362,7 +362,7 @@ private function matchesCoreArtwork(DOMElement $svg, ?string $service): bool foreach ($element->getElementsByTagName('*') as $child) { if (in_array(strtolower($child->tagName), array('title', 'desc'), true)) continue; $attrs = array(); - foreach ($child->attributes as $attr) { + foreach (\Automattic\BlocksEngine\PhpTransformer\Contract\BoxTree::authoredAttributes($child) as $attr) { $attrs[$attr->name] = preg_replace('/[\s,]+/', '', $attr->value); } ksort($attrs); diff --git a/php-transformer/src/HtmlToBlocks/ReusableComponentRecognizer.php b/php-transformer/src/HtmlToBlocks/ReusableComponentRecognizer.php index cdc506fc4e..17aaebad6e 100644 --- a/php-transformer/src/HtmlToBlocks/ReusableComponentRecognizer.php +++ b/php-transformer/src/HtmlToBlocks/ReusableComponentRecognizer.php @@ -114,6 +114,7 @@ private function signature(DOMNode $node, bool $shapeOnly, array &$state): ?stri $attributes = array(); foreach ($node->attributes as $attribute) { $name = strtolower($attribute->name); + if ( \Automattic\BlocksEngine\PhpTransformer\Contract\BoxTree::isEvidenceAttribute($name) ) continue; $value = $this->normalizedAttributeValue($name, $attribute->value); if (null === $value) continue; $attributes[] = $shapeOnly ? $name : ($this->isContentSlot($name) ? $name . '=#slot' : $name . '=' . $value); diff --git a/php-transformer/src/HtmlToBlocks/RichText/NavigationLabelNormalizer.php b/php-transformer/src/HtmlToBlocks/RichText/NavigationLabelNormalizer.php index fe0331b23e..d5a59e28f9 100644 --- a/php-transformer/src/HtmlToBlocks/RichText/NavigationLabelNormalizer.php +++ b/php-transformer/src/HtmlToBlocks/RichText/NavigationLabelNormalizer.php @@ -98,7 +98,7 @@ private static function isPresentationSpan(DOMElement $element): bool if ('span' !== strtolower($element->tagName)) return false; // Identity, language, accessibility and runtime attributes are boundaries, // not disposable styling. Projected presentation markers live in class. - foreach ($element->attributes as $attribute) { + foreach (\Automattic\BlocksEngine\PhpTransformer\Contract\BoxTree::authoredAttributes($element) as $attribute) { if (!in_array($attribute->name, array('class', 'style'), true)) return false; } return true; diff --git a/php-transformer/src/HtmlToBlocks/Style/AuthorStyleAnalysis.php b/php-transformer/src/HtmlToBlocks/Style/AuthorStyleAnalysis.php index d9e5661ab8..cf23ae9443 100644 --- a/php-transformer/src/HtmlToBlocks/Style/AuthorStyleAnalysis.php +++ b/php-transformer/src/HtmlToBlocks/Style/AuthorStyleAnalysis.php @@ -435,6 +435,7 @@ private function startTagIdentity(DOMElement $element, bool $observable = false) $tag = strtolower($element->tagName); $attributes = array(); foreach ( $element->attributes ?? array() as $attribute ) { + if ( \Automattic\BlocksEngine\PhpTransformer\Contract\BoxTree::isEvidenceAttribute($attribute->nodeName) ) continue; $attributes[strtolower($attribute->nodeName)] = (string) $attribute->nodeValue; } if ( $observable ) { diff --git a/php-transformer/src/HtmlToBlocks/Style/SourceBlockAttributeProjector.php b/php-transformer/src/HtmlToBlocks/Style/SourceBlockAttributeProjector.php index 33d7af0933..9fbfc637a2 100644 --- a/php-transformer/src/HtmlToBlocks/Style/SourceBlockAttributeProjector.php +++ b/php-transformer/src/HtmlToBlocks/Style/SourceBlockAttributeProjector.php @@ -321,7 +321,7 @@ public function project( if ($anchor instanceof DOMElement) { $identity = array(); if ($anchor->hasAttribute('class')) $identity['data-blocks-engine-social-source-class'] = $anchor->getAttribute('class'); - foreach ($anchor->attributes as $attribute) { + foreach (\Automattic\BlocksEngine\PhpTransformer\Contract\BoxTree::authoredAttributes($anchor) as $attribute) { if (in_array($attribute->name, array('id', 'class', 'style', 'role', 'title', 'tabindex', 'target', 'rel'), true) || str_starts_with($attribute->name, 'data-') || str_starts_with($attribute->name, 'aria-')) $identity[$attribute->name] = $attribute->value; } $classes = $this->sourceProjectionClassName($anchor, $context, (string) ($identity['class'] ?? '')); diff --git a/php-transformer/src/HtmlToBlocks/Support/AddressableInlineLayoutLeaf.php b/php-transformer/src/HtmlToBlocks/Support/AddressableInlineLayoutLeaf.php index a6b1701f4a..19c2467184 100644 --- a/php-transformer/src/HtmlToBlocks/Support/AddressableInlineLayoutLeaf.php +++ b/php-transformer/src/HtmlToBlocks/Support/AddressableInlineLayoutLeaf.php @@ -17,7 +17,7 @@ final class AddressableInlineLayoutLeaf public static function isPlainTextSpan(DOMElement $element): bool { if ('span' !== strtolower($element->tagName) || 0 !== SourceDom::childElementCount($element) || '' === trim($element->textContent)) return false; - foreach ($element->attributes as $attribute) { + foreach (\Automattic\BlocksEngine\PhpTransformer\Contract\BoxTree::authoredAttributes($element) as $attribute) { if ('class' !== strtolower($attribute->name) && 'data-blocks-engine-richtext-marker' !== strtolower($attribute->name)) return false; } for ($ancestor = $element->parentNode; $ancestor instanceof DOMElement; $ancestor = $ancestor->parentNode) { @@ -35,7 +35,7 @@ public static function identity(DOMElement $element, StyleResolver $styles): ?ar ) return null; $id = SourceDom::attr($element, 'id'); if (1 !== preg_match('/^[A-Za-z][A-Za-z0-9_-]{0,199}$/', $id)) return null; - foreach ($element->attributes as $attribute) { + foreach (\Automattic\BlocksEngine\PhpTransformer\Contract\BoxTree::authoredAttributes($element) as $attribute) { if (!in_array(strtolower($attribute->name), array('id', 'class'), true)) return null; } $display = $styles->declaredPresentation($element, 'display'); diff --git a/php-transformer/src/HtmlToBlocks/Support/SourceDom.php b/php-transformer/src/HtmlToBlocks/Support/SourceDom.php index 6e4fa8ce74..a30e296397 100644 --- a/php-transformer/src/HtmlToBlocks/Support/SourceDom.php +++ b/php-transformer/src/HtmlToBlocks/Support/SourceDom.php @@ -278,7 +278,9 @@ public static function canonicalizedSerializationClone(DOMElement $element, ?cal if (null !== $inlineStyleFor) self::projectInlineStyles($element, $clone, $inlineStyleFor); // Capture node identity binds evidence to the source document, not the output. foreach ( self::subtreeElements($clone) as $node ) { - $node->removeAttribute(BoxTree::NODE_ATTRIBUTE); + foreach ( iterator_to_array($node->attributes) as $attribute ) { + if ( BoxTree::isEvidenceAttribute($attribute->nodeName) ) $node->removeAttributeNode($attribute); + } } return $clone; } @@ -804,7 +806,7 @@ public static function htmlAttributes(DOMElement $element): array { $attributes = array(); foreach ( $element->attributes ?? array() as $attribute ) { - if ( HtmlAttributeName::isIntegerKey($attribute->nodeName) ) { + if ( HtmlAttributeName::isIntegerKey($attribute->nodeName) || BoxTree::isEvidenceAttribute($attribute->nodeName) ) { continue; } $attributes[$attribute->nodeName] = $attribute->nodeValue ?? ''; @@ -2102,7 +2104,7 @@ public static function staticGraphicOnlyCustomElement(DOMElement $element): bool } while ( in_array(strtolower($child->tagName), array( 'span', 'div' ), true) ) { foreach ( $child->attributes as $attribute ) { - if ( ! in_array(strtolower($attribute->nodeName), array( 'class', 'id', 'style' ), true) ) { + if ( ! BoxTree::isEvidenceAttribute($attribute->nodeName) && ! in_array(strtolower($attribute->nodeName), array( 'class', 'id', 'style' ), true) ) { return false; } } @@ -2318,10 +2320,6 @@ public static function safeDataAttributes(DOMElement $element): array { $data = array(); foreach ( self::htmlAttributes($element) as $name => $value ) { - // Capture node identity binds evidence; it is not authored data. - if ( BoxTree::NODE_ATTRIBUTE === $name ) { - continue; - } if ( preg_match('/^data-[a-z0-9_-]+$/i', $name) && strlen($value) <= 300 && ! preg_match('/javascript\s*:/i', $value) ) { $data[$name] = $value; } diff --git a/php-transformer/src/Support/SourceAttribute.php b/php-transformer/src/Support/SourceAttribute.php index ab5b1de2e3..5a559e50fd 100644 --- a/php-transformer/src/Support/SourceAttribute.php +++ b/php-transformer/src/Support/SourceAttribute.php @@ -13,8 +13,9 @@ final class SourceAttribute public static function isSelectorAttribute(string $name): bool { - return in_array($name, self::SELECTOR_NAMES, true) - || 1 === preg_match('/' . self::SELECTOR_PATTERN . '/', $name); + return ! \Automattic\BlocksEngine\PhpTransformer\Contract\BoxTree::isEvidenceAttribute($name) + && (in_array($name, self::SELECTOR_NAMES, true) + || 1 === preg_match('/' . self::SELECTOR_PATTERN . '/', $name)); } public static function isDeclaredEventAttribute(string $name): bool @@ -76,7 +77,7 @@ public static function staticAttributes(array $attributes, array $ownedNames = a $safe = array(); $policy = self::staticPolicy(); foreach ($attributes as $name => $value) { - if (!is_string($name) || !is_string($value) || in_array($name, $ownedNames, true) + if (!is_string($name) || !is_string($value) || \Automattic\BlocksEngine\PhpTransformer\Contract\BoxTree::isEvidenceAttribute($name) || in_array($name, $ownedNames, true) || in_array($name, $policy['excludedNames'], true) || str_starts_with($name, $policy['excludedPrefix'])) { continue; } diff --git a/php-transformer/tests/contract/shared-shell-plan.php b/php-transformer/tests/contract/shared-shell-plan.php index 7627e5a4b6..ee9998eb3d 100644 --- a/php-transformer/tests/contract/shared-shell-plan.php +++ b/php-transformer/tests/contract/shared-shell-plan.php @@ -421,7 +421,15 @@ $styledSvgAssetPaths = array_column(array_filter($styledSvgCompiled['assets'] ?? array(), static fn(array $asset): bool => 'inline-svg' === ($asset['source'] ?? null)), 'path'); $styledSvgShellPaths = array(); foreach ($styledSvgCompiled['inline_shell_artifacts'] ?? array() as $artifact) if (preg_match_all('@assets/materialized-svg/[^" ]+@', $artifact['block_markup'] ?? '', $matches)) $styledSvgShellPaths = array_merge($styledSvgShellPaths, $matches[0]); -$assert('failed' !== ($styledSvgResult['status'] ?? null) && 2 === count($styledSvgAssetPaths) && array() === array_diff($styledSvgShellPaths, $styledSvgAssetPaths), 'Shared shell compilation declares its CSS-context-specific materialized SVG asset instead of leaving an unresolved local browser reference.'); +$assert('failed' !== ($styledSvgResult['status'] ?? null) && 1 === count($styledSvgAssetPaths) && 2 === count($styledSvgShellPaths) && array() === array_diff($styledSvgShellPaths, $styledSvgAssetPaths), 'Shared shells with identical CSS-baked SVG payloads share one declared materialized asset without unresolved local browser references.'); + +$distinctSvgDocument = static fn(string $title): string => str_replace('', '.mobile-header .logo svg{width:32px;height:32px}', $styledSvgDocument($title)); +$distinctSvgResult = (new ArtifactCompiler())->compile(array('entrypoint' => 'index.html', 'files' => array('index.html' => $distinctSvgDocument('Home'), 'about.html' => $distinctSvgDocument('About'))))->toArray(); +$distinctSvgCompiled = $distinctSvgResult['source_reports']['compiled_site'] ?? array(); +$distinctSvgAssetPaths = array_column(array_filter($distinctSvgCompiled['assets'] ?? array(), static fn(array $asset): bool => 'inline-svg' === ($asset['source'] ?? null)), 'path'); +$distinctSvgShellPaths = array(); +foreach ($distinctSvgCompiled['inline_shell_artifacts'] ?? array() as $artifact) if (preg_match_all('@assets/materialized-svg/[^" ]+@', $artifact['block_markup'] ?? '', $matches)) $distinctSvgShellPaths = array_merge($distinctSvgShellPaths, $matches[0]); +$assert('failed' !== ($distinctSvgResult['status'] ?? null) && 2 === count($distinctSvgAssetPaths) && 2 === count(array_unique($distinctSvgShellPaths)) && array() === array_diff($distinctSvgShellPaths, $distinctSvgAssetPaths), 'Shared shells with distinct CSS-baked SVG payloads declare both context-specific assets without unresolved local browser references.'); $responsiveDivergentResult = $responsiveResult; foreach ($responsiveDivergentResult['source_reports']['compiled_site']['pages'] as &$responsivePage) $responsivePage['block_markup'] = $responsiveMarkup('index.html' === $responsivePage['source_path'] ? 'Home' : 'About', 'about.html' === $responsivePage['source_path'] ? 'Different mobile header' : 'Mobile header'); unset($responsivePage); diff --git a/php-transformer/tests/unit/box-tree-node-id-neutral.php b/php-transformer/tests/unit/box-tree-node-id-neutral.php index 910fd0ca0f..f9541579a5 100644 --- a/php-transformer/tests/unit/box-tree-node-id-neutral.php +++ b/php-transformer/tests/unit/box-tree-node-id-neutral.php @@ -2,22 +2,49 @@ declare(strict_types=1); require dirname(__DIR__, 2) . '/vendor/autoload.php'; +use Automattic\BlocksEngine\PhpTransformer\ArtifactCompiler\ArtifactCompiler; use Automattic\BlocksEngine\PhpTransformer\HtmlToBlocks\HtmlTransformer; -// Capture node IDs bind box-tree evidence. They must not change the block tree -// (wrapper coalescing) or reach output markup (attribute-inlined labels). -$source = '' - . '' - . '

Hello world

' +// Route-specific capture IDs must affect neither conversion nor shared chrome. +$document = static fn(string $title): string => '' . $title . '' + . '
' + . '
Hero

Welcome

Shared introduction

' + . '

' . $title . '

Hello world

' . '
x
'; -$index = 0; -$stamped = preg_replace_callback('/<([a-z]+)\b/', static function (array $match) use (&$index): string { - return '<' . $match[1] . ' data-blocks-engine-node-id="n' . $index++ . '"'; -}, $source); - -$plain = (new HtmlTransformer())->transform($source)->toArray()['serialized_blocks']; -$withIds = (new HtmlTransformer())->transform((string) $stamped)->toArray()['serialized_blocks']; -if ($plain !== $withIds) { - throw new RuntimeException("Node IDs changed the block output:\n--- plain\n{$plain}\n--- stamped\n{$withIds}"); +$stamp = static function (string $source, string $route): string { + $index = 0; + return preg_replace_callback('/<([a-z][a-z0-9]*)\b/', static function (array $match) use (&$index, $route): string { + return '<' . $match[1] . ' data-blocks-engine-node-id="' . $route . '-' . $index++ . '"'; + }, $source); +}; +$cases = array( + 'single page' => static function (bool $stamped) use ($document, $stamp): array { + $html = $document('Home'); + return (new HtmlTransformer())->transform($stamped ? $stamp($html, 'home') : $html)->toArray(); + }, + 'two routes with shared header' => static function (bool $stamped) use ($document, $stamp): array { + $files = array(); + foreach (array('index.html' => 'Home', 'about.html' => 'About') as $path => $title) { + $html = $document($title); + $files[$path] = $stamped ? $stamp($html, $title) : $html; + } + return (new ArtifactCompiler())->compile(array('entrypoint' => 'index.html', 'files' => $files))->toArray(); + }, +); +foreach ($cases as $name => $compile) { + $plain = $compile(false); + $withIds = $compile(true); + if (array() === $plain['assets']) throw new RuntimeException("{$name}: fixture must emit CSS assets"); + if ('two routes with shared header' === $name && array() === ($plain['source_reports']['wordpress_site_plan']['template_parts'] ?? array())) { + throw new RuntimeException('Two-route fixture must extract a shared header'); + } + foreach (array( + 'serialized_blocks' => static fn(array $result): mixed => $result['serialized_blocks'], + 'CSS assets' => static fn(array $result): array => array_values(array_filter($result['assets'], static fn(array $asset): bool => 'css' === ($asset['kind'] ?? '') || str_ends_with($asset['path'] ?? $asset['source_path'] ?? '', '.css'))), + 'site-plan parts' => static fn(array $result): array => $result['source_reports']['wordpress_site_plan']['template_parts'] ?? array(), + ) as $output => $select) { + if ($select($plain) !== $select($withIds)) throw new RuntimeException("{$name}: capture node IDs changed {$output}"); + } + if (!str_contains($plain['serialized_blocks'], 'blocks-engine-media-text-image-')) throw new RuntimeException("{$name}: fixture must exercise media-text marker identity"); } echo "ok\n";