docs: a durable mermaid-parse check over docs/architecture — a semicolon killed a diagram for weeks, silently #343

Closed
opened 2026-08-08 16:58:07 +00:00 by ben · 1 comment
Owner

The 2026-08-08 review-fix sweep found docs/architecture/09-founding-sequence.md's stand-up sequence diagram had NEVER rendered: two message lines contained semicolons, which mermaid treats as statement separators, so the parse died mid-message — and nothing anywhere would have said so (fixed in 6325eed).

Wanted: a durable check that every mermaid block under docs/architecture/ (and arguably docs/slices/) parses. The proven method from the sweep: load the repo's vendored mermaid.min.js in a real Electron DOM and call mermaid.parse per block — a Node stub DOM false-fails on flowcharts, so the Electron DOM matters. Both rounds' scripts ran from a session scratchpad and are gone; rebuild as a checked-in script wired into the seam-CI harness (or a pre-commit hook), failing loud with file + block + parse error. 30/30 blocks parse at branch head — the check starts green.

The 2026-08-08 review-fix sweep found `docs/architecture/09-founding-sequence.md`'s stand-up sequence diagram had NEVER rendered: two message lines contained semicolons, which mermaid treats as statement separators, so the parse died mid-message — and nothing anywhere would have said so (fixed in `6325eed`). Wanted: a durable check that every mermaid block under `docs/architecture/` (and arguably `docs/slices/`) parses. The proven method from the sweep: load the repo's vendored `mermaid.min.js` in a real Electron DOM and call `mermaid.parse` per block — a Node stub DOM false-fails on flowcharts, so the Electron DOM matters. Both rounds' scripts ran from a session scratchpad and are gone; rebuild as a checked-in script wired into the seam-CI harness (or a pre-commit hook), failing loud with file + block + parse error. 30/30 blocks parse at branch head — the check starts green.
Author
Owner

Done in 71c1424 (on origin/main).

The guard: scripts/check-mermaid.mjs extracts every fenced mermaid block under docs/architecture (30) and every raw docs/slices/*.mermaid DAG (10), loads the viewer's own vendored docs/architecture/vendor/mermaid.min.js in a real DOM and calls mermaid.parse per block — failing loud with file + block + opening line. Starts green at 40/40.

Real DOM without an Electron binary: happy-dom (already an app devDependency) rather than Electron. It has the property the issue calls for — a Node stub DOM false-fails flowcharts, happy-dom does not — and it verifiably (a) parses all 30 arch flowcharts/sequences + 10 slice DAGs and (b) rejects the ;-in-a-message bug, with no Electron download and no X server. So it runs inside the existing seam-CI Node stage rather than needing the e2e display shell.

Wiring (two belts):

  • scripts/seam-smoke.sh — new stage Docs: every mermaid diagram block parses (#343) running node scripts/check-mermaid.mjs (loud, purpose-built output).
  • app/tests/unit/mermaidDocs.test.ts — a vitest seam test (part of pnpm -r run test) that runs the full scan, asserts 0 failures, guards against a silently-empty scan (total >= 30), and pins the regression (valid flowchart parses; ; bug rejected).

Also: docs/architecture/README.md gains a Parse check section; STATUS.md header + milestone log updated.

Verify: node scripts/check-mermaid.mjs → 40/40 block(s) parse; vitest 3/3; eslint + vue-tsc clean.

Done in `71c1424` (on `origin/main`). **The guard:** `scripts/check-mermaid.mjs` extracts every fenced ```mermaid``` block under `docs/architecture` (30) and every raw `docs/slices/*.mermaid` DAG (10), loads the viewer's own vendored `docs/architecture/vendor/mermaid.min.js` in a **real DOM** and calls `mermaid.parse` per block — failing loud with **file + block + opening line**. Starts green at **40/40**. **Real DOM without an Electron binary:** happy-dom (already an `app` devDependency) rather than Electron. It has the property the issue calls for — a Node *stub* DOM false-fails flowcharts, happy-dom does not — and it verifiably (a) parses all 30 arch flowcharts/sequences + 10 slice DAGs and (b) rejects the `;`-in-a-message bug, with no Electron download and no X server. So it runs inside the existing seam-CI Node stage rather than needing the e2e display shell. **Wiring (two belts):** - `scripts/seam-smoke.sh` — new stage `Docs: every mermaid diagram block parses (#343)` running `node scripts/check-mermaid.mjs` (loud, purpose-built output). - `app/tests/unit/mermaidDocs.test.ts` — a vitest seam test (part of `pnpm -r run test`) that runs the full scan, asserts 0 failures, guards against a silently-empty scan (`total >= 30`), and pins the regression (valid flowchart parses; `;` bug rejected). **Also:** `docs/architecture/README.md` gains a *Parse check* section; `STATUS.md` header + milestone log updated. **Verify:** `node scripts/check-mermaid.mjs` → `40/40 block(s) parse`; vitest 3/3; `eslint` + `vue-tsc` clean.
ben closed this issue 2026-08-08 18:20:24 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#343
No description provided.