A read below the depth that filled the memo re-spells, so the depth guards still run
CI / gate (push) Successful in 28s
CI / publish (push) Has been skipped

This commit is contained in:
2026-09-19 13:37:58 +02:00
parent 3f8afcb9d7
commit d6756ea5e6
4 changed files with 33 additions and 12 deletions
+6 -3
View File
@@ -316,9 +316,12 @@ someone spells it or pins it.
- The parse keeps each node's readable spelling in a memo, so the `commonMarkSpelling` ask spells a
node once rather than once per level above it (18). The node reference is the key, which holds
because the parse builds one object per position; `adfToMarkdown` passes no memo, where a
consumer's document may hold one node at two positions (4b). A kept spelling rebases: `text` and
`spelling` carry no depth, `headroom` is affine in it, and a reuse sits at or above the depth that
filled it. Only what succeeded is kept, so no path minted at another position is ever read.
consumer's document may hold one node at two positions (4b). `text` and `spelling` carry no depth
and `headroom` is affine in it, so a read above the depth that filled the entry rebases; a read
below re-spells, because a hit skips the depth guards the walk it replaces runs and an ordered
list past the marker cap gives way, spending two emitter levels where the parser spent one. A
give-way is kept too and serves any depth, reading the node's shape alone. Only what succeeded is
kept, so no path minted at another position is ever read.
- No casts: `as`, `as unknown as`, non-null `!`. A boundary owes a type guard validating the
fields it claims (`isAdfDocument`); past it everything is typed. Make invalid states
unrepresentable.