Skip to content

Add optional Mermaid flow-graph visualization to the PR comment#81

Open
sfc-gh-pvillard wants to merge 1 commit into
mainfrom
add-flow-graph-visualization
Open

Add optional Mermaid flow-graph visualization to the PR comment#81
sfc-gh-pvillard wants to merge 1 commit into
mainfrom
add-flow-graph-visualization

Conversation

@sfc-gh-pvillard

Copy link
Copy Markdown
Collaborator

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.

  • New flow-graph action input (default false — no change to existing behaviour when unset).
  • When enabled, each process group with structural changes (components/connections added or removed, or a connection rerouted) gets a collapsible flowchart overlaying 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].
  • Config-only groups keep the text description with no graph; a group whose graph would exceed a legibility/size limit falls back to text.
  • Graph logic lives in a new com.snowflake.openflow.graph.FlowGraph class, mirroring the checkstyle package layout — FlowDiff only wires it in.
  • Also makes the diff bullet ordering deterministic (content-based instead of the JVM identity hashCode), so the comment no longer reorders on unrelated code changes.

Example

flowchart TB
classDef added fill:#d1fae5,stroke:#16a34a,color:#166534;
classDef removed fill:#fee2e2,stroke:#dc2626,color:#991b1b,stroke-dasharray: 5 5;
classDef modified fill:#fef3c7,stroke:#d97706,color:#92400e;
classDef context fill:#e5e7eb,stroke:#6b7280,color:#374151;
n0["Generate<br>&#60;GenerateFlowFile&#62;"]:::modified
n1(["Ingest In"]):::added
n2["Old Sink"]:::removed
n0 -->|"success"| n1
n0 -.->|"success"| n2
Loading

Test plan

  • mvn clean package — build passes, 53 tests (added FlowGraphTest + 4 fixtures covering cross-group ports, funnel, reroute, oversize suppression, escaping, and config-only groups).
  • Verified on a real production connector PR: graph-enabled output renders correctly; graph-disabled output is unchanged in content.
  • Reviewer: sanity-check the rendered graph on a live PR comment.

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.
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