Repository navigation
fix(chat): bound markdown nesting depth on the parsed tree, not the text - #10753
Conversation
|
🤖 Kiro Crew [operator: iamwhatever#241cc860]: |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Bounds depth on the parser's own output with the same-options oracle and drift-detecting parity tests — the root-cause shape #8916's pre-parse rewrite could never converge on. [DESIGN-REVIEWED] 68779fe |
UX Review (Fable 5) — ✅ PASSUX-level review of The diff adds no user-visible controls, labels, or strings — it's a rendering-pipeline guard (depth bounding on parsed markdown trees plus a whitespace-run cap). The only visible deltas occur on pathological input (nesting depth >100, whitespace runs >256 columns) that previously crashed the renderer with a UX-Verdict: PASS No user-visible control changes; pathological input that used to crash the renderer now degrades to readable text, byte-identical below the bounds. [UX-REVIEWED] 68779fe |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of All checks pass. The sourcePos surface ( First-Principles-Verdict: PASS One residual to verify: sourcePos surfaces ( What this change shipsInventory (8 items) — 8 justifiedIntent: FIX — a chat, channel, or notification message with pathologically nested markdown no longer crashes the renderer or blanks the view.
Provenance is derived throughout: the defect is pinned by tests this PR adds that fail on base (the plugin-order test shows the base pipeline throws [FIRST-PRINCIPLES-REVIEWED] 68779fe |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
Chat markdown is input-controlled. A message of thousands of leading `>` markers, of progressively indented list items, or of `<div><div>...` raw HTML parses into a tree whose depth equals the nesting count, and several layers downstream of the parser recurse over it: remark-gfm's post-parse transform (unist-util-visit-parents), remark-rehype, hast-util-from-parse5 inside rehype-raw, react-markdown's hast->JSX conversion, and this codebase's own tree walkers. Past the engine's call-stack limit any one of them throws `RangeError: Maximum call stack size exceeded` on a single message. In the chat transcript MessageErrorBoundary degrades that message to raw text; ChannelPage and NotificationDetailPanel render MarkdownRenderer bare, so there the whole view is replaced. The parsers themselves are iterative. micromark and mdast-util-from-markdown parse a 50,000-deep blockquote run without throwing, and parse5 keeps an explicit open-element stack. So the depth of the tree is a fact that can be read off the parser's output, and it is bounded there: - `remarkBoundDepth` registers a mdast-util-from-markdown `transforms` entry that walks the parsed mdast with an explicit stack and folds any subtree past MAX_TREE_DEPTH into one text node carrying its words. That hook runs INSIDE parse(), in registration order -- and remark-gfm's autolink-literal extension registers a recursive transform through the same hook, which is where the markdown crash actually lives. A unified transformer would be too late, so the plugin is `use()`d ahead of remark-gfm; a test pins both the order and the reason. - `rehypeBoundRawDepth` runs ahead of rehype-raw. If the tree holds raw HTML it serializes the tree with raw admitted and parses that with parse5 as an oracle (iterative), measuring the DOM depth the raw HTML will produce. Past the bound every raw node is downgraded to a text node, so hast-util-from-parse5 never sees a deep tree and the message keeps its words while losing only its HTML rendering. The oracle is only an oracle if it reads the same tree the real parse builds, so it uses the parser options hast-util-raw uses (`scriptingEnabled: false`, under which a `<noscript>` body nests rather than being flat RAWTEXT) and it counts a `<template>`'s children, which parse5 parks on a separate `content` fragment that hast-util-from-parse5 also recurses into. - `capWhitespaceRuns` truncates any run of spaces and tabs wider than MAX_INDENT_COLS, wherever on a line it sits. The tree bound cannot bound the PARSER'S OWN COST: micromark re-scans every open container on every line, so a list indented to depth d costs O(lines * d) before a tree exists (a 1,200-level list parsed for minutes; a 600-level one behind a `> ` prefix took 6.8s, 1.0s capped). Indentation is decided by whitespace alone, and a run after a blockquote prefix indents exactly as a leading run does, so the cap is over every run: lexical, recognizing no construct. No CommonMark construct needs more than four columns of whitespace to mean what it means, so 256 means the same as 300 everywhere except inside code, where alignment past 256 columns loses the excess. Below the bounds nothing is rewritten, so ordinary content renders byte-identically and data-sourcepos coordinates stay exact. A folded subtree keeps its words, including an image's alt text. The alternative -- rewriting the raw text before parsing so the tree comes out shallow -- requires predicting what two parsers will make of the text without running them. Every rule that model gets slightly different from the real parser is a bypass in the direction that re-opens the crash, and the model has to be maintained against both upstreams. That approach was tried first; review found seven bypass spellings in four rounds (fake closes inside comments, the code-span mask, `<x:y>` tag names, empty list items, form-feed-terminated tags, fence-repair ordering, SVG foreign-content voids) and fixing them introduced two more. Every one of those spellings is a test here, and none needed a rule: the parsers already know. Both pipelines adopt the bound. MarkdownRenderer puts remarkBoundDepth first in REMARK_PLUGINS and rehypeBoundRawDepth first in both rehype lists, and caps whitespace runs at the MarkdownBlock entry -- gated off in sourcePos mode like every other column-shifting pass there, since data-sourcepos maps a selection back to source coordinates and a shortened run would anchor a comment to the wrong occurrence; the tree bounds hold either way, so only the parser-time bound is given up on that surface. Mochi's ChatPanel adds the same two plugins to MD_REMARK / MD_REHYPE and applies the cap per TEXT segment, after widget extraction, so an <mcwidget> payload reaches WidgetFrame byte-identical -- its <pre> indentation included -- which a pre-parse text clamp could not guarantee. parse5 and hast-util-to-html become direct dependencies at the versions the lockfile already resolves them to (both are transitive dependencies of rehype-raw); the lockfile change is the two root entries. Tests: `MarkdownRenderer.depthBound.test.tsx` (27), `markdownDepthBound.oracle.test.ts` (22) and `mochi/test/mochiChatPanelDepthBound.test.tsx` (5). The oracle test is the drift detector for the design's one load-bearing assumption -- that the oracle reads the same tree rehype-raw builds: it runs both on every construct known to change nesting and asserts the oracle downgraded whenever the real tree exceeds the bound, so a parse5 or hast-util-raw upgrade (or a lockfile resolving them to different parse5 instances) turns a case red instead of re-opening the overflow. Reverting the mdast bound turns six red, the raw bound five, the whitespace cap three, the scripting option (two, in the oracle test), the template traversal, the alt collection, the per-segment widget cap and the sourcePos gate one each, with the exact RangeError or the parser timeout; ordinary content, raw HTML below the bound, and sourcepos are pinned unchanged. Fixtures sit at 10k blockquotes and 400 list levels -- far past where the unbounded pipeline throws, far under what the concurrent suite can parse inside CI's 15s per-test budget; the 15k parse-level contract needs no React render. Out of scope, tracked in #10620: a per-item error boundary on the two bare MarkdownRenderer surfaces, which bounds the cost of any future miss to one item regardless of mechanism. Co-authored-by: javenciu <129346815+javenciu@users.noreply.github.com>
3e248f3 to
68779fe
Compare
|
🤖 Kiro Crew [operator: iamwhatever#241cc860]:
|
|
🤖 Kiro Crew [operator: iamwhatever#241cc860]:
|
|
🤖 Kiro Crew [operator: iamwhatever#241cc860]:
|
|
🤖 Kiro Crew [operator: iamwhatever#241cc860]:
|
|
🤖 Kiro Crew [operator: iamwhatever#241cc860]: Ready for maintainer review at head
|
…rBoundary The chat transcript wraps every message in MessageErrorBoundary, so a markdown render crash degrades one message. ChannelPage message bodies and the NotificationDetailPanel body rendered MarkdownRenderer bare, so the same crash there escalated to the app-level ErrorBoundary and replaced the whole view. Wrap both call sites with rawContent so the fallback offers the raw text, matching the transcript. Regression test renders each surface with a renderer that throws on a marker string and asserts the per-item fallback appears while the surrounding surface (sibling messages, panel header) still renders. Red on base, green with the fix. Residuals 1 and 2 of #10620 landed in #10753. Closes #10620
…rBoundary (#11135) The chat transcript wraps every message in MessageErrorBoundary, so a markdown render crash degrades one message. ChannelPage message bodies and the NotificationDetailPanel body rendered MarkdownRenderer bare, so the same crash there escalated to the app-level ErrorBoundary and replaced the whole view. Wrap both call sites with rawContent so the fallback offers the raw text, matching the transcript. Regression test renders each surface with a renderer that throws on a marker string and asserts the per-item fallback appears while the surrounding surface (sibling messages, panel header) still renders. Red on base, green with the fix. Residuals 1 and 2 of #10620 landed in #10753. Closes #10620
…ext (kirodotdev#10753) Chat markdown is input-controlled. A message of thousands of leading `>` markers, of progressively indented list items, or of `<div><div>...` raw HTML parses into a tree whose depth equals the nesting count, and several layers downstream of the parser recurse over it: remark-gfm's post-parse transform (unist-util-visit-parents), remark-rehype, hast-util-from-parse5 inside rehype-raw, react-markdown's hast->JSX conversion, and this codebase's own tree walkers. Past the engine's call-stack limit any one of them throws `RangeError: Maximum call stack size exceeded` on a single message. In the chat transcript MessageErrorBoundary degrades that message to raw text; ChannelPage and NotificationDetailPanel render MarkdownRenderer bare, so there the whole view is replaced. The parsers themselves are iterative. micromark and mdast-util-from-markdown parse a 50,000-deep blockquote run without throwing, and parse5 keeps an explicit open-element stack. So the depth of the tree is a fact that can be read off the parser's output, and it is bounded there: - `remarkBoundDepth` registers a mdast-util-from-markdown `transforms` entry that walks the parsed mdast with an explicit stack and folds any subtree past MAX_TREE_DEPTH into one text node carrying its words. That hook runs INSIDE parse(), in registration order -- and remark-gfm's autolink-literal extension registers a recursive transform through the same hook, which is where the markdown crash actually lives. A unified transformer would be too late, so the plugin is `use()`d ahead of remark-gfm; a test pins both the order and the reason. - `rehypeBoundRawDepth` runs ahead of rehype-raw. If the tree holds raw HTML it serializes the tree with raw admitted and parses that with parse5 as an oracle (iterative), measuring the DOM depth the raw HTML will produce. Past the bound every raw node is downgraded to a text node, so hast-util-from-parse5 never sees a deep tree and the message keeps its words while losing only its HTML rendering. The oracle is only an oracle if it reads the same tree the real parse builds, so it uses the parser options hast-util-raw uses (`scriptingEnabled: false`, under which a `<noscript>` body nests rather than being flat RAWTEXT) and it counts a `<template>`'s children, which parse5 parks on a separate `content` fragment that hast-util-from-parse5 also recurses into. - `capWhitespaceRuns` truncates any run of spaces and tabs wider than MAX_INDENT_COLS, wherever on a line it sits. The tree bound cannot bound the PARSER'S OWN COST: micromark re-scans every open container on every line, so a list indented to depth d costs O(lines * d) before a tree exists (a 1,200-level list parsed for minutes; a 600-level one behind a `> ` prefix took 6.8s, 1.0s capped). Indentation is decided by whitespace alone, and a run after a blockquote prefix indents exactly as a leading run does, so the cap is over every run: lexical, recognizing no construct. No CommonMark construct needs more than four columns of whitespace to mean what it means, so 256 means the same as 300 everywhere except inside code, where alignment past 256 columns loses the excess. Below the bounds nothing is rewritten, so ordinary content renders byte-identically and data-sourcepos coordinates stay exact. A folded subtree keeps its words, including an image's alt text. The alternative -- rewriting the raw text before parsing so the tree comes out shallow -- requires predicting what two parsers will make of the text without running them. Every rule that model gets slightly different from the real parser is a bypass in the direction that re-opens the crash, and the model has to be maintained against both upstreams. That approach was tried first; review found seven bypass spellings in four rounds (fake closes inside comments, the code-span mask, `<x:y>` tag names, empty list items, form-feed-terminated tags, fence-repair ordering, SVG foreign-content voids) and fixing them introduced two more. Every one of those spellings is a test here, and none needed a rule: the parsers already know. Both pipelines adopt the bound. MarkdownRenderer puts remarkBoundDepth first in REMARK_PLUGINS and rehypeBoundRawDepth first in both rehype lists, and caps whitespace runs at the MarkdownBlock entry -- gated off in sourcePos mode like every other column-shifting pass there, since data-sourcepos maps a selection back to source coordinates and a shortened run would anchor a comment to the wrong occurrence; the tree bounds hold either way, so only the parser-time bound is given up on that surface. Mochi's ChatPanel adds the same two plugins to MD_REMARK / MD_REHYPE and applies the cap per TEXT segment, after widget extraction, so an <mcwidget> payload reaches WidgetFrame byte-identical -- its <pre> indentation included -- which a pre-parse text clamp could not guarantee. parse5 and hast-util-to-html become direct dependencies at the versions the lockfile already resolves them to (both are transitive dependencies of rehype-raw); the lockfile change is the two root entries. Tests: `MarkdownRenderer.depthBound.test.tsx` (27), `markdownDepthBound.oracle.test.ts` (22) and `mochi/test/mochiChatPanelDepthBound.test.tsx` (5). The oracle test is the drift detector for the design's one load-bearing assumption -- that the oracle reads the same tree rehype-raw builds: it runs both on every construct known to change nesting and asserts the oracle downgraded whenever the real tree exceeds the bound, so a parse5 or hast-util-raw upgrade (or a lockfile resolving them to different parse5 instances) turns a case red instead of re-opening the overflow. Reverting the mdast bound turns six red, the raw bound five, the whitespace cap three, the scripting option (two, in the oracle test), the template traversal, the alt collection, the per-segment widget cap and the sourcePos gate one each, with the exact RangeError or the parser timeout; ordinary content, raw HTML below the bound, and sourcepos are pinned unchanged. Fixtures sit at 10k blockquotes and 400 list levels -- far past where the unbounded pipeline throws, far under what the concurrent suite can parse inside CI's 15s per-test budget; the 15k parse-level contract needs no React render. Out of scope, tracked in kirodotdev#10620: a per-item error boundary on the two bare MarkdownRenderer surfaces, which bounds the cost of any future miss to one item regardless of mechanism. Co-authored-by: Joe Guo <zejiangg@amazon.com> Co-authored-by: javenciu <129346815+javenciu@users.noreply.github.com>
…rBoundary (kirodotdev#11135) The chat transcript wraps every message in MessageErrorBoundary, so a markdown render crash degrades one message. ChannelPage message bodies and the NotificationDetailPanel body rendered MarkdownRenderer bare, so the same crash there escalated to the app-level ErrorBoundary and replaced the whole view. Wrap both call sites with rawContent so the fallback offers the raw text, matching the transcript. Regression test renders each surface with a renderer that throws on a marker string and asserts the per-item fallback appears while the surrounding surface (sibling messages, panel header) still renders. Red on base, green with the fix. Residuals 1 and 2 of kirodotdev#10620 landed in kirodotdev#10753. Closes kirodotdev#10620
Problem / Motivation
A chat message containing pathologically nested markdown — thousands of leading
>blockquote markers, a list indented hundreds of levels, or a<div><div>…raw-HTML run — parses into a tree whose depth equals the nesting count. Several layers downstream of the parser recurse over that tree:remark-gfm's own post-parse transform (unist-util-visit-parents),remark-rehype,hast-util-from-parse5insiderehype-raw,react-markdown's hast→JSX conversion, andMarkdownRenderer.tsx's eight self-recursive walkers. Past the engine's call-stack limit any one of them throwsRangeError: Maximum call stack size exceededwhile rendering one message.Reproduced at
origin/main: 50,000 nested blockquote markers throw throughMarkdownRenderer; so do 5,000 nested<div>s in an HTML block, and a 1,200-level indented list does not finish parsing inside a five-minute budget.Why it matters
In the chat transcript every message is wrapped in
MessageErrorBoundary(src/pages/chat/AssistantMessage.tsx,src/pages/chat/ChatPageMessageContent.tsx,src/app-sdk/messageRenderers.tsx), so the pre-fix cost there is one message degraded to raw text plus a multi-second overflow parse repeated on every streaming frame while that message is the live tail. Outside chat,MarkdownRendereris rendered bare —src/pages/ChannelPage.tsx(channel message bodies) andsrc/components/notifications/NotificationDetailPanel.tsx(notification bodies) have no per-item boundary — so the sameRangeErrorpropagates to the app-levelErrorBoundaryand replaces the view. Mochi'sChatPanelruns its own copy of the pipeline over the same content and has no boundary at all. Every one of these inputs is input-controlled: a channel message, a notification body, an agent's output. Nothing upstream caps nesting depth, so the renderer has to.What changed (motivation → approach → change)
Where to bound. Two places could hold the guard. Before parsing, by rewriting the raw text so the tree comes out shallow — which requires predicting what two parsers (micromark, then parse5 via
rehype-raw) will make of the text without running them. Or after parsing, on the tree they produce — where depth is a fact to be read, not predicted.The pre-parse approach was tried first, in #8916. Its grammar model was bypassed seven times in four review rounds (fake closes inside comments, the code-span mask,
<x:y>tag names, empty list items, form-feed-terminated tags, fence-repair ordering, SVG foreign-content voids), and fixing bypasses introduced two more, because every rule the model gets slightly different from the real parser is a hole in the direction that re-opens the crash. That PR is closed with the full record; this one replaces it.Why the tree is bounded where it is. Verified against the pinned versions in
website/node_modules:micromarkandmdast-util-from-markdownare iterative.remark-parsealone parses 50,000 nested blockquotes without throwing.mdast-util-gfm-autolink-literal'stransformshook, which recurses viaunist-util-visit-parentsand runs insideparse(), before any unified transformer. A plain remark plugin is too late. AfromMarkdownExtensions.transformsentry registered beforeremark-gfmruns first, through the same hook.parse5's tree builder is iterative. The HTML crash lives inhast-util-from-parse5's recursion insidehast-util-raw, whose parser options are a hardcoded constant — no adapter can be injected, but the same parser can be run as an oracle first.>prefix: 6.8s). That one dimension is decided by whitespace alone, which is lexical.New
website/src/utils/markdownDepthBound.ts, three mechanisms, no grammar modeling:remarkBoundDepth— amdast-util-from-markdowntransform registered ahead ofremark-gfm. Walks the parsed mdast with an explicit stack and folds any subtree pastMAX_TREE_DEPTH(100) into one text node carrying its words (imagealtincluded). A test pins both the plugin order and why (a transformer-registered walk provably runs too late).rehypeBoundRawDepth— ahead ofrehype-raw. If the tree holds raw HTML, serializes it with raw admitted and parses that withparse5as an oracle, measuring the DOM depth the raw HTML will produce. Past the bound, every raw node is downgraded to a text node, sohast-util-from-parse5never sees a deep tree and the message keeps its words while losing only its HTML rendering. The oracle uses the parser optionshast-util-rawuses (scriptingEnabled: false, under which<noscript>content nests rather than being flat RAWTEXT) and counts<template>children on parse5's separatecontentfragment at the two levelshast-util-from-parse5gives them. A 47-input differential againsthast-util-raw@9.1.0's actual output found no case where the oracle reads ≤ 100 while the real tree exceeds it.capWhitespaceRuns— truncates any run of spaces and tabs wider thanMAX_INDENT_COLS(256), wherever on a line it sits. No CommonMark construct needs more than four columns of whitespace to mean what it means, so 256 means what 300 means everywhere except inside code, where alignment past 256 columns loses the excess — the one visible effect, and only on content no person writes. Identity (same string reference) on any message without such a run.Below the bounds nothing is rewritten: ordinary content renders byte-identically and
data-sourceposcoordinates stay exact.Wiring.
MarkdownRenderer.tsxputsremarkBoundDepthfirst inREMARK_PLUGINS,rehypeBoundRawDepthfirst in both rehype lists, and applies the whitespace cap at theMarkdownBlockentry — gated off in sourcePos mode like every other column-shifting pass there (data-sourceposmaps a selection back to source coordinates; a shortened run would anchor a comment to the wrong occurrence). The tree bounds hold in both modes; only the parser-time bound is given up on that surface. Mochi'sChatPanel.tsxadds the same two plugins toMD_REMARK/MD_REHYPE— imported from the core, as its sanitizer already is — and applies the cap per text segment at all five<Markdown>sites, after widget extraction, so an<mcwidget>payload reachesWidgetFramebyte-identical (a pre-parse text clamp could not guarantee that, which is what kept #8916 off this surface).Dependencies.
parse5andhast-util-to-htmlbecome direct dependencies at the versions the lockfile already resolves them to (both are transitive dependencies ofrehype-raw); the lockfile change is the two root entries.Tests
website/src/test/MarkdownRenderer.depthBound.test.tsx(27),website/src/test/markdownDepthBound.oracle.test.ts(22) andwebsite/src/apps/mochi/test/mochiChatPanelDepthBound.test.tsx(5). Every vector review found against the pre-parse approach is here, and none needed a rule:> - > -;> > >re-opens; 400-level lists with and without item text, and behind a>prefix<div>runs as a block and across paragraphs;<x:y>,<span\f>, NUL;<svg>+<base>;<noscript>and<template>bodies; fake closes inside comments, CDATA, attribute values and code spans; the fence-repair reordering vectorparse(), and a transformer-registered bound would throw firstmarkdownDepthBound.oracle.test.ts): for every construct known to change nesting — colon names,\f, NUL, SVG voids,<noscript>,<template>, comment/CDATA/attribute/code-span fake closes, self-closing spelling, implied-end siblings, mixes with blockquotes, lists and math passthrough — the oracle's decision is compared against the treerehype-rawactually builds, asserting it downgraded whenever the real depth exceeds the bound. This is the drift detector for the design's one assumption: aparse5orhast-util-rawupgrade, or a lockfile resolving them to differentparse5instances, turns a case red instead of re-opening the overflow (flipping thescriptingEnabledoption turns two red today)Bubblesurvives the deep vectors; a widget with a 150-deep body and a 300-space<pre>line reachesWidgetFramebyte-identicalRevert-verified per mechanism, not in aggregate: removing the mdast bound turns six red, the raw bound five, the whitespace cap three, and the scripting option (two, in the oracle test), template traversal, alt collection, per-segment widget cap and sourcePos gate one each — each with the exact
RangeErroror the parser timeout.Fixtures sit at 10k blockquotes and 400 list levels — far past where the unbounded pipeline throws, far under what the concurrent CI suite parses inside its 15s per-test budget; the 15k parse-level contract carries no React render.
Manual verification
N/A — unit coverage sufficient: the guarantee is "renders without throwing, below-bound content unchanged", and both halves are asserted at the DOM level through the real
MarkdownRendererand mochiBubblecomponents in the vitest DOM harness.Related Issues
Fixes #10571 (mochi
ChatPanelsibling — covered by construction). Fixes #10607 (pinning copied grammar tables — moot, there are no copied tables). Replaces #8916 (closed; javenciu's problem statement, reproducers and review history are what this design rests on — co-authored). #10620 is deliberately NOT closed by this PR: its two residual crash vectors (fence-repair ordering; SVG foreign-content voids) are tests here and pass by construction, but its third item — a per-item error boundary on the two bareMarkdownRenderersurfaces, which bounds the cost of any future miss to one item regardless of mechanism — stays open as separate work.Pattern harvest
When a guard must decide "what will the parser make of this input", put the guard after the parser, on its output, and let the parser be the oracle. A guard placed before the parser has to re-implement the grammar, and its failure mode is silent: every rule that differs is a bypass, every fix is a chance to introduce another, and the maintenance obligation is permanent because the upstream parser keeps moving. #8916's record — seven bypasses, two regressions from fixes, four rounds without convergence — is the measurement.
Two corollaries surfaced here. First, "after the parser" means after the whole parse step, including hooks that run inside it:
remark-gfm's recursive transform runs insideparse(), so the bound had to register through the same hook, earlier — a plugin that looked like it ran first did not. Second, an oracle is only an oracle under the same options: a one-flag difference (scriptingEnabled) made the oracle read<noscript>content as flat while the real parse nested it. Both are pinned by tests that fail if the placement or the options drift.Rule candidate: review-prompt — when a change adds a pre-parse rewrite of parser input (markdown, HTML, JSON, a DSL) to defend against a parser-side failure, ask whether the same bound can be applied to the parser's output instead; if it can, the rewrite is a shadow parser and should be replaced.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)Why no screenshot: no visual delta -- every mechanism is an identity on content below its bound (pinned by tests), and the only inputs that render differently are ones that crashed the renderer before.