Repository navigation
fix(callflow): bump Mermaid maxTextSize to prevent diagram rendering failure on large architectures - #5448
Open
Gaurav-meena95 wants to merge 1 commit into
Conversation
…failure on large architectures Mermaid v11 has a default browser text diagram limit of 50,000 characters. When exporting architecture callflows for moderately complex projects or sections with 40+ nodes and edges, the generated diagram definition exceeds this limit, causing Mermaid to throw 'Error: Maximum text size in diagram exceeded' and fail to render in the browser. Configure maxTextSize: 250000 in both the Mermaid init directive (mermaid_init) and the client-side execution config (mermaidConfig). Co-authored-by: Antigravity <antigravity@google.com>
|
Thanks for the pull request, @Gaurav-meena95. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.11 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify review 
8 possible issues to check · High impact
Mermaid init directives now default to a 250,000-character text limit and allow callers to set a different limit.
8 possible issues we couldn't confirm
- The PR title says it prevents diagram rendering failures, but the code only raises a text-size limit and the description is empty ·
graphify/callflow_html.py:599 - mermaid_init accepts any max_text_size value without validation, so a zero, negative or None value goes straight into the Mermaid config ·
graphify/callflow_html.py:602 - The Mermaid maxTextSize check at line 377 would also pass for 2500000 or any other value starting with 250000 ·
tests/test_callflow_html.py:377 - +5 more in Graphify
They don't change the score.
Code graph · 742 functions depend on this change
- 1 function became more coupled.
write_callflow_html()(8 callers). - 1 of 620 test files are affected by this change.
- Gate, test list and every flagged function: in the Graphify check.
Reviewed c466199 · Full report in the Graphify check
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5447
What does this PR do?
Configures
maxTextSize: 250000ingraphify/callflow_html.py(both in themermaid_initdirective and client-sidemermaidConfig) to prevent Mermaid v11 from throwingError: Maximum text size in diagram exceededwhen rendering architecture diagrams for medium-to-large codebases.Problem
Mermaid v11 has a default browser text diagram limit of 50,000 characters. When exporting architecture callflows (
graphify export callflow-html) for codebases or sections containing 40+ nodes, relations, and source file metadata, the generated flowchart definition easily exceeds 50,000 characters. BecausemaxTextSizewas omitted from the configuration, the browser threw an unhandled promise rejection and aborted diagram rendering.Solution
DEFAULT_MAX_TEXT_SIZE = 250_000(5x default headroom)."maxTextSize": max_text_sizein the%%{init: {...}}%%directive viamermaid_init().maxTextSize: 250000in the client-sidemermaid.initialize(mermaidConfig)block.tests/test_callflow_html.pyvalidating directive configuration, custom overrides, and HTML file generation.Type of change
Verification & Invariants
test_mermaid_init_configures_max_text_sizeandtest_write_callflow_html_includes_max_text_sizeintests/test_callflow_html.py).How was this tested?
Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments.