Skip to content

Verify Mermaid state-description quoting against a real renderer #58

Description

@camcima

Finding #15 of the 2026-08 architecture review. Explicitly not changed in #52 — it needs verification first.

Problem

GraphBuilder.toMermaid() emits state descriptions wrapped in double quotes (src/graph/GraphBuilder.ts:178):

stateDiagram-v2
  direction LR
  s_draft : "draft"

In stateDiagram-v2 the text after : is a state description, rendered verbatim inside the state box. If that is right, every exported diagram shows "draft" with literal quote marks instead of draft — cosmetic, but it is the library's user-facing rendering output, and the node id (s_draft) is already the hex-escaped identifier, so the description exists purely to display a clean label.

Note the label is escaped independently: escapeMermaidLabel() converts " to #quot; and \ to #92;, so the surrounding quotes are not doing escaping work — they may simply be a carry-over from the DOT emitter, where they are required syntax.

Why this is still open

I could not run a Mermaid renderer in the review environment, and the quoted form is pinned in several places — tests/graph.test.ts (s_new : "new", s_in_0020progress : "in progress", and others) and the example output in docs/graph.md. Rewriting output that tests and docs assert, on an unverified hypothesis, is the wrong trade; it needs someone to look at a rendered diagram.

Steps

  1. Render a diagram from toMermaid() in Mermaid Live Editor (or @mermaid-js/mermaid-cli) and check whether the quotes appear in the state boxes.
  2. If they do: drop them from the emitter, update the pinned expectations in tests/graph.test.ts and the sample output in docs/graph.md, and confirm that labels containing spaces, colons, and the already-escaped #quot; / #92; sequences still parse unquoted.
  3. If they do not appear: add a comment at the emitter explaining why the quotes are there, so this doesn't get re-reviewed a third time.

Acceptance criteria

  • Behavior confirmed against an actual renderer, with the finding recorded either way.
  • Emitter and pinned expectations agree with the verified behavior.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions