Repository navigation
fix: repair Mermaid labels and report validation accurately - #143
Merged
Merged
Conversation
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.
LLM-generated flowchart labels such as
C{msg.error()?}can fail rendering and repeat the same error during agent retries. Add syntax guidance across generation/update prompts and the MCP skill, and repair unquoted classic rectangle/diamond labels only after a confirmed delimiter error and successful revalidation. Persist verified replacements and return the saved text; keep repairs within the original edit's undo history.Validation now distinguishes confirmed syntax failures from unavailable validation. Check HTTP responses explicitly for pinned
mermaid-py0.8.0 (which does not raise on failed requests), handle newer exception-based versions, and retain complete parser diagnostics. Disabled validation, timeouts, and renderer outages warn without claiming syntax success or requesting syntax fixes.Parent/repository overviews use the same validation before saving, with one correction attempt for remaining syntax errors. Unavailable validation continues with a warning. Automatic repair is limited to clear, single-line rectangle/diamond labels; ambiguous syntax is left for the agent.
The repair fixtures include the issue’s exact reproduction with an inline
-- no -->edge, preserving the edge text while quoting its target label. Toolkit unit tests also cover CI environments without the CLI SDK by stubbing only SDK registration and executing the real editor implementation.The syntax guidance reflects Mermaid 11.9.0: function calls, braces, brackets, commas, and double dashes are valid in sequence-message text; literal semicolons require
#59;, and backticks do not escape them. Add a locked development-only Mermaid/jsdom harness and CI job to verify these cases with the viewer's actual parser version.Validation:
mermaid-py0.8.0 and 0.8.4.git diff --checkpassed.Fixes #141