← Back to Pull requests

fix: draw pipelines whose component names are not valid Mermaid IDs #13797

Closed
unknown closed this pull request without merging on Nov 26, 2026 11:54 UTC
View on GitHub
unknown unknown commented on Nov 17, 2026 23:12 UTC
Author

Related Issues

  • fixes #13796
  • Proposed Changes:

    _to_mermaid_text used each component name as its Mermaid node ID. Names with a space or a parenthesis, or Mermaid keywords such as end and graph, made mermaid.ink return 400. A component named input or output collided with the extra networkx nodes _prepare_for_drawing adds for the pipeline's inputs and outputs and raised KeyError, and one named i or o shared the Mermaid ID of the input/output marker, so the drawing merged them. SuperComponent names had the same problem as Mermaid class names with super_component_expansion=True.

  • _to_mermaid_ids keeps names that are already valid IDs (letters, digits, _, not a keyword) unchanged, so existing diagrams don't change. Every other name gets an ID with unsafe characters replaced by _ plus a numeric suffix, skipping IDs already in use. The node label still shows the real name.

  • The input/output nodes are keyed with sentinel objects (_INPUT_NODE, _OUTPUT_NODE) that can't equal a component name.

  • SuperComponent class names and legend IDs go through the same helper.
  • How did you test it?

  • Four unit tests in test/core/pipeline/test_draw.py. The three behaviour tests fail on main (KeyError: 'input' and invalid Mermaid text) and pass with the fix; the fourth covers the new helper.

  • pytest test/core/pipeline/ test/core/super_component -m "not integration": 555 passed.

  • hatch run fmt-check and mypy on the changed files: clean.

  • Manually drew pipelines with components named "prompt builder", end, input, output, i, o and an expanded SuperComponent named "rag pipeline" through mermaid.ink: all failed or were wrong before, all draw correctly now.
  • Notes for the reviewer

  • The keyword list only holds words I confirmed break on mermaid.ink (end, graph, flowchart, subgraph, style, linkStyle, class, classDef); End, click, default, direction render fine.

  • Hyphenated names already rendered; they now get an ID like text_embedder_1. The picture is the same.

  • A double quote inside a component name would still break the node label. I left that out to keep this PR focused.
  • This PR was developed with an AI assistant. I have reviewed the changes and run the relevant tests.

    Checklist

  • I have read the contributors guidelines and the code of conduct.

  • I have updated the related issue with new insights and changes.

  • I have added unit tests and updated the docstrings.

  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.

  • I have documented my code.

  • I have added a release note file, following the contributors guidelines.

  • I have run pre-commit hooks and fixed any issue.
  • Diff: 405 lines (+303 / -102) across 5 files Reviewer: its-amann Review duration: 12282m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.45) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 405 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.359
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #13797"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.8% (MEDIUM) · Higher = larger blast radius
    44.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.4% · Safe to merge
    19.4%