Skip to content

Compile Mermaid with mermaid-cli (drop the hand-rolled checker); make Python 3.14 required#8

Merged
grammy-jiang merged 1 commit into
masterfrom
claude/pre-commit-hooks-setup-2sc78y
Jul 19, 2026
Merged

Compile Mermaid with mermaid-cli (drop the hand-rolled checker); make Python 3.14 required#8
grammy-jiang merged 1 commit into
masterfrom
claude/pre-commit-hooks-setup-2sc78y

Conversation

@grammy-jiang

Copy link
Copy Markdown
Owner

Mermaid: real compiler instead of a re-implementation

Replaces the hand-written scripts/validate_mermaid.py (structural checks) with scripts/check_mermaid.py, which shells out to the real Mermaid compiler — @mermaid-js/mermaid-cli (mmdc). A diagram passes only if it actually renders, so it catches real syntax errors a structural check can't.

  • mmdc is located via $MMDCPATHnpx --yes @mermaid-js/mermaid-cli@11; Puppeteer runs headless with --no-sandbox, honoring $PUPPETEER_EXECUTABLE_PATH.
  • Wired as the mermaid-compile pre-commit hook (self-bootstraps mmdc via npx locally).
  • Because it needs Node + a headless browser, CI runs it as a dedicated mermaid job; the lint job SKIPs it (stays lightweight).
  • Fails loud if mmdc can't run (never skips silently); ignores Markdown without a mermaid block.

Python 3.14 now required

Dropped the experimental / continue-on-error / allow-prereleases machinery — 3.14 is a plain required matrix entry (["3.11", "3.12", "3.13", "3.14"]). It has passed every CI run since it was added.

Verified locally

  • mmdc compiles all four repo diagrams (README + phase3 + phase4 + Brier); a deliberately broken block exits non-zero.
  • mermaid-compile hook passes via pre-commit; the other hooks pass with it skipped (mirroring the lint job).

CI now has four jobs: lint, egress-isolation, mermaid, and test (3.11–3.14).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fd4FtxJFV2fVSSoD7urqqn


Generated by Claude Code

Replace the hand-written scripts/validate_mermaid.py structural checker with
scripts/check_mermaid.py, which shells out to the real Mermaid compiler
(@mermaid-js/mermaid-cli / mmdc): a diagram passes only if it actually renders.
It is wired as the `mermaid-compile` pre-commit hook (self-bootstraps mmdc via
npx locally) and, because it needs Node + a headless browser, as a dedicated
CI `mermaid` job — the lint job SKIPs it.

Python 3.14 is now a required test-matrix version (dropped the experimental /
continue-on-error / allow-prereleases machinery); it has passed every CI run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fd4FtxJFV2fVSSoD7urqqn
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.14%. Comparing base (5a70b0c) to head (36d2cd5).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master       #8   +/-   ##
=======================================
  Coverage   99.14%   99.14%           
=======================================
  Files          17       17           
  Lines        1756     1756           
=======================================
  Hits         1741     1741           
  Misses         15       15           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@grammy-jiang
grammy-jiang merged commit 6104d9e into master Jul 19, 2026
7 checks passed
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.

3 participants