Skip to content

fix: #402 display state reads and writes on separate lines in graph visualization#805

Open
adawang1210 wants to merge 1 commit into
apache:mainfrom
adawang1210:fix/issue-402-state-label-newlines
Open

fix: #402 display state reads and writes on separate lines in graph visualization#805
adawang1210 wants to merge 1 commit into
apache:mainfrom
adawang1210:fix/issue-402-state-label-newlines

Conversation

@adawang1210

@adawang1210 adawang1210 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

When visualizing a graph with include_state=True, the action name, reads, and writes were all rendered on a single line (name(read_1, read_2): write_1), which rapidly widens the figure and hurts readability. Node labels now display reads: and writes: as separate, left-justified sections with one state field per line, following the format proposed in the issue.

Rendered result for an action with reads count, user_input and writes count:

counter
reads:
  count
  user_input
writes:
  count

Related issue

Closes #402

Changes made

  • burr/core/graph.py: added a _get_state_label() helper that builds the multi-line label (using graphviz's \l escape for left justification, so indentation stays visible); Graph.visualize() now uses it when include_state=True. Actions with no reads and no writes keep a plain name label.
  • tests/core/test_graphviz_display.py: parametrized test covering all four cases from the issue spec (no reads/writes, only reads, only writes, both).

How to test

pytest tests/core/test_graphviz_display.py

Checklist

  • Tests added or updated
  • All tests pass locally (pytest tests/ --ignore=tests/integration_tests: 577 passed, 5 skipped)
  • Commits are signed off (git commit -s)
  • Pre-commit hooks pass (black, isort, flake8)
  • CONTRIBUTING.md guidelines followed

…raph visualization

Signed-off-by: adawang <adawang12101210@gmail.com>
@github-actions github-actions Bot added the area/core Application, State, Graph, Actions label Jun 11, 2026
@adawang1210

Copy link
Copy Markdown
Contributor Author

The documentation workflow failure is a pre-existing issue in the repo — it fails due to hasura/comment-progress@v2.2.0 being blocked by the Apache enterprise action policy. This is unrelated to my changes. I confirmed the same failure appears on other recent PRs. All 577 unit tests pass locally and pre-commit checks are clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Application, State, Graph, Actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

visualization: display state reads and writes on newline

1 participant