-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Summary
The .mermaid files generated by uipath init contain invalid Mermaid syntax. Node IDs use raw filename.py:lineNumber strings which contain . and : — both special characters in Mermaid's flowchart syntax. The diagrams fail to render in all standard Mermaid viewers.
Root Cause
graph_builder.py dumps node IDs as raw source location strings (e.g. vendor.py:52). In Mermaid flowchart syntax:
.is used as a subgraph qualifier:is a separator in edge labels
The generated output is structurally invalid:
flowchart TB
vendor.py:52(check_vendor_risk)
vendor.py:110(_resolve_instance_url)
vendor.py:52 --> vendor.py:110
A valid equivalent requires sanitized IDs and quoted labels:
flowchart TB
vendor_py_52["check_vendor_risk"]
vendor_py_110["_resolve_instance_url"]
vendor_py_52 --> vendor_py_110
How to Reproduce
- Create a project with Python functions
- Run
uipath init - Open any generated
.mermaidfile in the Mermaid Live Editor (mermaid.live) or VS Code Mermaid extension - The diagram fails to parse
Suggested Fix
In graph_builder.py, sanitize node IDs before writing:
def sanitize_node_id(source_location: str) -> str:
# Replace special characters with underscores
return re.sub(r'[.:]', '_', source_location)
# Generate:
# vendor_py_52["check_vendor_risk"]
# instead of:
# vendor.py:52(check_vendor_risk)Alternatively, if these files are not rendered/consumed by any UiPath platform tooling, stop generating them entirely (see GAP-15).
Impact
- Severity: Low (cosmetic/tooling)
- Every generated
.mermaidfile is broken - If the platform renders these diagrams, they all fail silently
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels