LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-vega
createdAtNov 19, 2026, 12:53 PM
updatedAtNov 19, 2026, 2:31 PM
githubUrlhttps://github.com/neomjs/neo/issues/21477
authorneo-opus-vega
commentsCount0
parentIssue21367
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[ ] 21474 More components: a streaming markdown card, process and splitter tiles
closedAtNov 19, 2026, 2:31 PM

A streamed markdown document can end unlike its one-shot parse

neo-opus-vega
neo-opus-vega commented on Nov 19, 2026, 12:53 PM

Sub of #21367: an engine defect before More components' markdown card (#21474).

Context

On dev 32d592f333, the stream demo of examples/component/markdown (24-character chunks of its source) ends in another document than "Render instantly" from a cleared state:

  • ## Why transcripts need this renders as a heading "Why tran" and a paragraph "scripts need this".
  • The table has no head: its <table> holds the old paragraph's text node | Surface | Layer | |---| beside the body rows (DOM read in the browser, 19 Nov: children of TABLE#…__md-7 are the comment …__md-7-c0, TBODY#…__md-7-c6 and that text).

Streaming LLM transcripts is what the component is for, so the example's demo shows the defect to everyone who presses its first button.

The Problem

Three faults in src/component/markdown/Parser.mjs, each reproduced in a unit spec:

  1. #segment gives headings and breaks open: false even when their line is the unfinished last line, so a chunk boundary inside a heading settles it.
  2. The empty string after a final \n counts as a blank line, so a paragraph, list, quote or table that ends in a newline settles before its next line arrives. A table header row then never meets its delimiter row.
  3. #appendParse reuses the tail's id when the tail changes block type (paragraph → table), and child ids are numbered in creation order (-c0, -c1), so a re-parse hands one node's id to a node of another kind. The differ matches by id and keeps the old text node where the thead belongs. The same shift happens inside one growing block when an unclosed ** turns into strong or a padded table cell fills.

The Architectural Reality

Design authority: the parser's header, "Block sequence numbers never recycle — not within a value lifetime and not across resets — so a reset cannot birth two-nodes-one-id across batches", and its streaming model, in which only the open tail block re-parses.

  • Parser.mjs: #segment, #appendParse, #createBlock (the child id dispenser), #parseInline.
  • blockMeta.open feeds the component's virtualization: an open block's units can still change.
  • test/playwright/unit/component/markdown/Parser.spec.mjs pins "a streamed table promotes from the open tail paragraph when its delimiter arrives" with the paragraph's id on the table.

The Fix

  • A heading or break stays open while its line is unfinished. A block that reaches the empty string after a final newline stays open, and its source keeps that newline, so the next append continues the exact suffix.
  • A tail that turns into another block type becomes a new block under a fresh id.
  • A child id carries its node's kind (-t3, -li0, -strong2), so no id can name two kinds of node.

Acceptance Criteria

  • AC-1: For chunk sizes 1, 2, 3, 5, 7, 11 and 24, streaming a document with every block type ends in the same blocks as its one-shot parse.
  • AC-2: Across a stream, no id names two kinds of node.
  • AC-3: The markdown example's stream demo renders "Why transcripts need this" as one heading and its table with a head.
  • AC-4: The markdown unit specs and MarkdownStreamingCoherenceNL.spec.mjs pass.

Out of Scope

  • The markdown card in More components (#21474).
  • The VDOM differ.

Avoided Traps

  • Teaching the differ to replace a node whose id changes kind: the producer that gives one id to two kinds is at fault, and a differ that matches by id is right to trust ids.

Related

#21367 · #21474 · #13018 (the component) · #13045 (windowing)

Live latest-open + closed sweep: newest open read at 11:55Z (#21476 back to #21472) + open and closed searches ("markdown streaming heading OR markdown stream table"; "markdown parser stream OR MarkdownParser OR markdown table promote"; #13018 has no Out of Scope) on 19 Nov; no equivalent. Backlog band: 79 open before this filing (red); folded under #21367, whose rule files each engine defect as its leaf before the renewal. A2A claim sweep: latest messages to 11:41Z, all read-states; no claim on the markdown parser. MC sweep: "markdown streaming parser tail block settles … id reuse vdom differ", 5 results, the component's build sessions, no prior decision on these faults. Own-assignment sweep: #21474 holds the card, not the parser.

Retrieval Hint: "streamed markdown ends unlike its one-shot parse: heading cut mid-line, table header settles before its delimiter, one id across two node kinds"