Repository navigation
feat!: name the node of each validation diagnostic, and add Block::children - #28
Merged
Merged
Conversation
…ildren A validation diagnostic now carries the NodePath of the node its shape belongs to, in the document validated, so a caller can fix a refused span-less tree without guessing; parser diagnostics leave it None. The wasm binding passes the path through. Block::children() gives the blocks directly inside a block container. BREAKING CHANGE: `Diagnostic` gains the public field `path`, so a struct literal of it no longer compiles. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JoGTgQ8jovSb2J6bwSz4NT
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Plimeor · project thread
Before: a validation diagnostic carried only an optional span, so an editor that writes a hand-built tree (no spans) could not tell which node was refused; Settle retries the write with each tight list made loose until fewer diagnostics come back. Every caller walking blocks wrote its own match over container kinds.
After: every validation diagnostic (and so every
to_markdown/to_htmlrefusal) carriespath: Option<NodePath>, the node its shape belongs to in the document validated; parser diagnostics leave itNone. The wasm binding passes it aspath: number[] | null.Block::children()returns the blocks directly inside a block container.How: the validator keeps the current path while descending and attaches it to each diagnostic it pushes. Plan archived at
docs/archive/2026-10-18-node-paths/; specspublic-api,validation,wasm-bindingupdated (Shortcode glyphmerged into "Each written fact is stored once" to keep public-api at 20 requirements).Breaking:
Diagnosticgains a public field, so its struct literal no longer compiles.Validation run locally:
cargo fmt --check,cargo build,cargo test --no-run,cargo test --profile ci --features html(all pass),RUSTDOCFLAGS='-D warnings' cargo doc --no-deps,cargo test -p markdown-syntax-wasm, the wasm32 build, andnode --test 'wasm/js/test/*.test.mjs'(27 pass).Generated by Claude Code