Skip to content

fix(mermaid): render nested transitions with empty labels#739

Open
KushalLukhi wants to merge 1 commit intopytransitions:masterfrom
KushalLukhi:fix/706-mermaid-empty-label-outer-transitions
Open

fix(mermaid): render nested transitions with empty labels#739
KushalLukhi wants to merge 1 commit intopytransitions:masterfrom
KushalLukhi:fix/706-mermaid-empty-label-outer-transitions

Conversation

@KushalLukhi
Copy link
Copy Markdown

@KushalLukhi KushalLukhi commented Mar 20, 2026

Summary

Fix Mermaid nested graph generation to include transitions even when the trigger/label is an empty string.

This addresses #706 where outer-state transitions were omitted from Mermaid output when labels were empty.

Root cause

NestedGraph._add_edges skipped edges with falsy labels:

if not attr["label"]:
    continue

For transitions like ['', 'A', 'B'], this dropped otherwise valid edges entirely.

Fix

  • Keep labeled output as-is: source --> dest: label
  • Emit unlabeled edges as source --> dest when label is empty

Tests

Added test_transitions_without_labels_between_outer_states in tests/test_mermaid.py using a minimal nested machine setup from the bug report.

The test asserts that Mermaid output contains:

  • C --> A
  • A --> B
  • B --> C

Validation

  • New regression test passes locally.
  • Existing targeted Mermaid nested ROI tests also pass.

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.

1 participant