Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- A `flow.mmd` with a transition label (`a --> b : text`) failed with `state 'a' has no path to [*]`. steplock read `b : text` as the target state. It now ignores the label (#232)

## [0.2.2] - 2026-10-04

### Fixed
Expand Down
1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ manual_let_else = "deny"
items_after_statements = "deny"
needless_pass_by_value = "deny"
trivially_copy_pass_by_ref = "deny"
explicit_into_iter_loop = "deny"

[dependencies]
cel-interpreter = "0.10"
Expand Down
5 changes: 4 additions & 1 deletion core/src/flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ pub fn parse_mmd(path: &str, content: &str) -> Result<FlowGraph> {
}

fn split_transition(line: &str) -> Option<(&str, &str)> {
line.split_once("-->")
let (lhs, rhs) = line.split_once("-->")?;
// Drop a transition label (`a --> b : text`) so the target is just `b`.
let rhs = rhs.split_once(':').map_or(rhs, |(target, _)| target);
Some((lhs, rhs))
}

fn split_label(line: &str) -> Option<(&str, &str)> {
Expand Down
19 changes: 19 additions & 0 deletions core/src/flow_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,25 @@ stateDiagram-v2
assert!(g.is_terminal("skip_reason"));
}

#[test]
fn ignores_transition_labels() {
let mmd = r"
stateDiagram-v2
[*] --> tests
tests --> docs : yes
tests --> fix : no
fix --> docs
docs --> [*] : done
tests : Did all tests pass?
";
let g = parse_mmd("test.mmd", mmd).unwrap();
let mut nexts = g.next_states("tests");
nexts.sort();
assert_eq!(nexts, vec!["docs", "fix"]);
assert!(g.is_terminal("docs"));
assert_eq!(g.labels["tests"], "Did all tests pass?");
}

#[test]
fn error_on_missing_initial_state() {
let mmd = "stateDiagram-v2\n a --> b\n";
Expand Down
Loading