You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.5 KiB

+++ title = "Change graph cycle marker from [cycle] to *" priority = 3 status = "done" ticket_type = "task" dependencies = [] +++

Goal

When nbd graph renders a node that has already been visited (a node appearing in multiple branches of the tree), it currently labels the repeat occurrence as [cycle]. This label is misleading — the node isn't truly in a cycle, it's simply appearing twice in the tree because it's depended on from multiple places. Change the marker to * to indicate "this ticket appears elsewhere in the tree".

Current output

a3f9c2  [todo]  Fix login bug
├── b7d41e  [in_progress]  Add rate limiting
│   └── c9e823  [todo]  Write tests
└── c9e823  [cycle]

Target output

a3f9c2  [todo]  Fix login bug
├── b7d41e  [in_progress]  Add rate limiting
│   └── c9e823  [todo]  Write tests
└── c9e823  *

Files to change

src/display.rs

In the render_node function (around line 409), change the cycle rendering line from:

append_line(out, &format!("{prefix}{connector}{id}  [cycle]"));

to:

append_line(out, &format!("{prefix}{connector}{id}  *"));

README.md

Update the nbd graph section example to replace [cycle] with * in the documentation.

Validation

cargo fmt && cargo check && cargo clippy && cargo test
# Create two tickets that share a dependency, then graph them
cargo run -- graph

Any test that checks for [cycle] in graph output needs updating to expect * instead.