Repository navigation
ci: check the diagram bot's Mermaid parses before it posts - #25849
Conversation
Eight of the thirty-four figures posted so far render as an error box instead of a picture. All eight break on a Mermaid rule the bot's instructions did not state.
Type of change
How to test
cat > /tmp/broken.mmd <<'MERMAID'
sequenceDiagram
participant A as One
participant B as Two
Note over A,B: runs in the build JVM; agents travel via MAVEN_OPTS
MERMAID
node .github/scripts/validate-mermaid.mjs /tmp/broken.mmd
Note
The eight figures that do not renderEvery Diagram Bot comment posted since the bot was turned on was pulled
Test coverageThere is no automated test for the script itself. It was checked against |
|
Test Results 1 455 files 1 539 suites 1h 33m 9s ⏱️ Results for commit 1560715. |



Follow-up to #25373
DX/docs ·
.github/workflows· reviewers reading a Diagram Bot commentBackground — Diagram Bot. A pull request whose change is about
structure, flow or ordering gets one Mermaid figure posted as a comment
by an agentic workflow. GitHub renders that block in the reader's own
browser, so a block with a syntax error becomes a red error box where
the picture should be.
Eight of the thirty-four figures the bot has posted so far do not
render. Each one breaks on a Mermaid rule the bot's own instructions
never stated, so the reviewer gets an error box and the bot looks
broken. It now parses its figure before posting, fixes what does not
parse, and stays silent when it cannot.
Risks:
Context. The instructions asked for quotes around node labels that
hold punctuation and said nothing about edge labels, backticks or
semicolons — which is where all eight failures are. The lock file is
unchanged on purpose: the prompt is pulled in at run time with
runtime-import, and the frontmatter did not change..github/scripts/validate-mermaid.mjs, which parses a figurewith the same Mermaid version GitHub renders comments with and names
the line at fault. It takes a
.mmdfile, a.mdfile whose fencedmermaidblocks it extracts, or the figure on stdin.under the runner's temp directory. With no network the script still
applies its own rules and exits 2, so an unreachable registry never
passes a broken figure as sound.
%%{init}%%, rawHTML, quoted free text in a sequence diagram and a
classDefthatsets
fill:withoutcolor:. Over the thirty-four figures postedso far they flag exactly the eight that do not parse, and none of
the twenty-six that do.
diagram-bot.mdthat runs the validator before thecomment goes out, and records
noopinstead of posting when thefigure still does not parse after three attempts.
diagram-bot.mdaround what actuallybroke: quote edge labels as well as node labels, never open a label
with a backtick, and keep semicolons out of
sequenceDiagrammessageand note text.
.github/workflows/README.md.