Skip to content

feat: add interactive DAG WebView panel (GSoC 2026 Goal #1)#24

Open
rupeshca007 wants to merge 1 commit intoouterbounds:mainfrom
rupeshca007:feat/dag-webview-panel
Open

feat: add interactive DAG WebView panel (GSoC 2026 Goal #1)#24
rupeshca007 wants to merge 1 commit intoouterbounds:mainfrom
rupeshca007:feat/dag-webview-panel

Conversation

@rupeshca007
Copy link
Copy Markdown

@rupeshca007 rupeshca007 commented Mar 28, 2026

Summary

Adds a Visual DAG Viewer to the Metaflow VS Code extension, directly addressing Goal #1 of the GSoC 2026 VS Code Extension project.

The existing extension has only 2 keyboard shortcuts with no visual tooling. This PR adds an interactive, live-updating DAG graph rendered in a VS Code WebView panel.

Changes

dag_parser.py (new)

  • Zero-dependency Python AST parser
    • Finds all FlowSpec subclasses, extracts @step methods and self.next() edges
    • Outputs BFS-ordered JSON with steps, edges, and error fields
    • Uses only the ast module -- never executes user code, safe in editor context

extension.js (modified)

  • New showDagView command spawns dag_parser.py as a child_process
    • Creates a WebviewPanel beside the editor with retainContextWhenHidden: true
    • Sends DAG JSON to the WebView via postMessage
    • Registers onDidSaveTextDocument watcher for live refresh on every save
    • Handles node-click messages from WebView to navigate editor cursor to that step

media/dag_webview.html (new)

  • Self-contained D3.js (v7) graph rendered in the WebView
    • BFS-level layout -- parallel steps appear at the same depth
    • Color-coded nodes: green = start/end, orange = join, blue = regular step
    • Bezier curved directed edges with arrowheads
    • Click any node -> sends navigateToStep message back to extension

package.json (modified)

  • Registers Metaflow: Show DAG command
    • Keybinding: Ctrl+Alt+D (active when editorLangId == python)
    • Version bumped to 0.1.0

How to Test

Clone this branch and open in VS Code
Press F5 to launch the Extension Development Host
Open any Metaflow flow .py file
Press Ctrl+Alt+D or run "Metaflow: Show DAG" from the Command Palette
The DAG panel opens beside the editor
Edit and save the file -> DAG auto-refreshes
Click any node -> editor jumps to that step

Tested With

Linear flows (start -> process -> end)
Branching flows with fan-out and fan-in (start -> branch_a, branch_b -> join -> end)

GSoC 2026 Context

This PR demonstrates capability for the Metaflow VS Code Extension GSoC project. The DAG viewer is Goal #1 and the foundation for the artifact browser (Goal #2) and run configuration UI (Goal #4).


GSoC 2026 AI Policy Disclosure: I want to transparently note that I used AI tools to assist in generating parts of this prototype implementation and boilerplate. However, I have manually reviewed, tested, and fully understand every line of code submitted, and I am prepared to explain and iterate on it during the review process.

Adds a full Visual DAG Viewer to the Metaflow VS Code extension, directly
addressing Goal outerbounds#1 of the GSoC 2026 VS Code Extension project.

Changes:
- dag_parser.py: zero-dependency Python AST parser that finds all FlowSpec
  subclasses, extracts @step methods and self.next() edges, outputs BFS-ordered
  JSON topology. Uses the ast module only - no runtime execution of user code.
- extension.js: new showDagView command that spawns dag_parser.py as a child
  process, creates a WebviewPanel beside the editor, sends DAG JSON via
  postMessage, registers a file-save watcher for live refresh, and handles
  node-click messages to navigate the editor cursor to the clicked step def.
- package.json: registers 'Metaflow: Show DAG' command with Ctrl+Alt+D
  keybinding active on Python files; bumps version to 0.1.0.
- media/dag_webview.html: self-contained D3.js (v7) DAG visualization with
  BFS-level layout, bezier curved edges, color-coded nodes (green=start/end,
  orange=join, blue=step), and click-to-navigate postMessage back to extension.

Tested with linear and branching flows in the Extension Development Host.
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