Skip to content

fix(pstack): read multi-line Mermaid notes in statechart charts - #819

Open
rudycelekli wants to merge 1 commit into
cursor:mainfrom
rudycelekli:fix/statechart-multiline-notes-20261023
Open

rudycelekli wants to merge 1 commit into
cursor:mainfrom
rudycelekli:fix/statechart-multiline-notes-20261023

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

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, where note right of A opens a block whose text lines run until end 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 as A --> 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 parseMermaid so 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 until end 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 note case.

Reviewed by Cursor Bugbot for commit 6f45cd1. Bugbot is set up for automated code reviews on this repo. Configure here.

@rudycelekli
rudycelekli force-pushed the fix/statechart-multiline-notes-20261023 branch from 7352467 to 6f45cd1 Compare October 24, 2026 02:01

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6f45cd1. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant