Add optional Mermaid flow-graph visualization to the PR comment - #81
Conversation
Add a `flow-graph` action input (default false) that renders a per process-group Mermaid flowchart of structural changes alongside the existing textual diff. Graph logic lives in a new com.snowflake.openflow.graph.FlowGraph class, mirroring the checkstyle package layout; FlowDiff only wires it in. Also make the diff bullet ordering deterministic (content-based instead of the JVM identity hashCode), so the comment no longer reorders on unrelated changes.
sfc-gh-dchaffelson
left a comment
There was a problem hiding this comment.
LGTM — nicely self-contained (FlowGraph mirrors the checkstyle package layout, FlowDiff just wires it), safely default-off, thorough Mermaid escaping, and good test coverage of the graph behaviour incl. per-graph oversize suppression and config-only groups. Built + ran the suite locally on JDK 21: clean build, 54 tests pass. The deterministic-ordering change (dropping the JVM identity-hashCode tiebreaker) is a good fix on its own.
One non-blocking thing worth flagging before enabling this widely: the size guard is per-graph only (MAX_GRAPH_RENDERED_CHARS = 45000, plus the 20-node/40-edge caps). Since the comment emits one graph per structurally-changed process group on top of the existing text, there's no total-comment budget — a multi-group or large flow with flow-graph enabled could push the comment past GitHub's 65,536-char body limit. That's the same overflow as issue #63; this feature can make it worse when turned on. Default-off means no regression today, so not a blocker — just suggest coordinating enablement with a total-comment-size strategy (budget across graphs+text, or the multi-comment split from #63).
Minor: branch predates the recent main merges so it'll want a rebase; and the PR text says 'collapsible' while the code emits '
Summary
Adds an optional per-process-group Mermaid flow-graph to the PR comment, giving reviewers a visual of the structural changes alongside the existing textual description.
flow-graphaction input (defaultfalse— no change to existing behaviour when unset).flowchartoverlaying the diff: 🟩 added / 🟥 removed / 🟧 modified / ⬜ unchanged. Node shapes distinguish processor (rectangle), port (rounded), funnel (circle); a processor's type shows as<Type>and a child-group port is tagged[group name].com.snowflake.openflow.graph.FlowGraphclass, mirroring thecheckstylepackage layout —FlowDiffonly wires it in.hashCode), so the comment no longer reorders on unrelated code changes.Example
Test plan
mvn clean package— build passes, 53 tests (addedFlowGraphTest+ 4 fixtures covering cross-group ports, funnel, reroute, oversize suppression, escaping, and config-only groups).