Repository navigation
fix(pstack): read multi-line Mermaid notes in statechart charts - #819
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
rudycelekli
force-pushed
the
fix/statechart-multiline-notes-20261023
branch
from
October 24, 2026 02:01
7352467 to
6f45cd1
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit 6f45cd1. Configure here.
| } | ||
| if (/^\s*note\s[^:]*$/.test(raw)) { | ||
| inNote = true; | ||
| continue; |
There was a problem hiding this comment.
Quoted notes open a block
Medium Severity · Logic Bug
The block detector treats every colon-free note line as a multi-line opener. Mermaid's one-line floating notes use quotes and as rather than a colon, so the parser keeps skipping later chart lines until end note or end of file. Those lines were previously ignored as single-line notes.
Reviewed by Cursor Bugbot for commit 6f45cd1. Configure here.
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.


parseMermaid skips a line that starts with note, which covers Mermaid's one-line form (
note right of A : text) but not its multi-line form, wherenote right of Aopens a block whose text lines run untilend note. Those text lines reach the parser as chart lines, so a chart that the owners annotated with a multi-line note fails from-chart and the chart comparisons with "cannot read chart line: <the note's first line>". A note line that happens to look like a step, such asA --> C : ..., would instead be read as a real transition.The parser now treats a note line with no colon as the start of a block and skips everything through
end note. A note that is never closed fails with "the chart has a note with no end note" instead of silently swallowing the rest of the chart. One-line notes are unchanged. The harness tree is regenerated.Validation: added "a multi-line note is not part of the machine" to pstack/skills/statechart/scripts/test/statechart.test.mjs, with a multi-line note containing a transition-shaped line, a one-line note, and an unclosed note. On origin/main it fails with "cannot read chart line: Waits for the user."; with the fix it passes. Ran npm install --no-save ajv ajv-formats, node scripts/validate-plugins.mjs, node scripts/generate-pstack-harness-trees.mjs --check, node --test pstack/skills//scripts/test/.test.mjs (58 pass), and git diff --check.
Note
Low Risk
Scoped change to Mermaid chart parsing in the statechart skill; behavior for charts without multi-line notes is unchanged aside from the new unclosed-note error.
Overview
Fixes
parseMermaidso multi-line Mermaid state diagram notes are ignored instead of being parsed as states or transitions.When a line matches
note …with no trailing colon (Mermaid’s block form), the parser now skips every following line untilend note. One-line notes (note right of A : text) still use the existing skip rule. An unclosed block raises "the chart has a note with no end note" rather than misreading the rest of the chart—important because note text can look like real steps (e.g.A --> C : …).Tests add "a multi-line note is not part of the machine" covering block notes, a one-liner, and the missing
end notecase.Reviewed by Cursor Bugbot for commit 6f45cd1. Bugbot is set up for automated code reviews on this repo. Configure here.