5
54
Fork
You've already forked blue
4

Introduce Graph command #97

Open
opened 2025年09月30日 09:25:52 +02:00 by pastor · 2 comments

Proposal: Build Graph Exporter

As discussed in other channels, we would like to introduce a build graph exporter.
This command should emit BLUE’s DAG build graph for use in external tools.

Output Format

We still need to decide which output format to support initially:

  • JSON is a straightforward option.
  • If there is a well-supported graph visualizer on Linux, we could prioritize the format it expects.

Ideally, the exporter should be:

  • User-extensible
  • Configurable

Users should be able to:

  • Choose the export format
  • Extend available exporters

Graph Contents

The exported DAG should include additional metadata per node.
One of the most important data points is provenance tracking, allowing the user to:

  • Click a graph node
  • Jump directly to the code line that produced it (in BLUE, this corresponds to the origin field).

Integration with External Viewers

  • The viewer we support as a first-class citizen should respect the $EDITOR environment variable, so clicking a node opens the user’s editor of choice.
  • Launching the external viewer should be configurable via:
    • A BLUE parameter: program.viewer.graph
    • An environment variable: BLUE_PROGRAM_VIEWER_GRAPH

The graph must be interactive, so static approaches (e.g., Graphviz) are not suitable.

Build Snooping

We also want to support build snooping for visualizations like this:
Syscall build snooping

Two possible approaches:

LD_PRELOAD

  • Fast
  • Requires introducing C into BLUE (adds dependency on GCC toolchain)
  • Cannot snoop static binaries

PTRACE

  • Does not require introducing any external dependency
  • Slow
  • Messy
  • Only one process can ptrace another

Emacs Graph Viewer

We would also like to provide an Emacs graph viewer, but there is no solid foundation for such a tool yet.
We would likely rely on SVG manipulation for the implementation.

Inspirations from existing Emacs UIs:

Note: org-roam-ui is implemented in JS.

  • Drawback: JS dependency
  • Advantage: Portable (browser-based) and provides excellent interactivity

If we wanted something like that, it would be very nice to implement it in Scheme using Hoot which is supported on all major browser platforms since version 0.6.0.


## Proposal: Build Graph Exporter As discussed in other channels, we would like to introduce a **build graph exporter**. This command should emit **BLUE’s DAG build graph** for use in external tools. ### Output Format We still need to decide which output format to support initially: - **JSON** is a straightforward option. - If there is a well-supported graph visualizer on Linux, we could prioritize the format it expects. Ideally, the exporter should be: - **User-extensible** - **Configurable** Users should be able to: - Choose the export format - Extend available exporters ### Graph Contents The exported DAG should include **additional metadata per node**. One of the most important data points is **provenance tracking**, allowing the user to: - Click a graph node - Jump directly to the code line that produced it (in BLUE, this corresponds to the `origin` field). ### Integration with External Viewers - The viewer we support as a first-class citizen should respect the `$EDITOR` environment variable, so clicking a node opens the user’s editor of choice. - Launching the external viewer should be configurable via: - A BLUE parameter: `program.viewer.graph` - An environment variable: `BLUE_PROGRAM_VIEWER_GRAPH` The graph must be **interactive**, so static approaches (e.g., Graphviz) are not suitable. ### Build Snooping We also want to support **build snooping** for visualizations like this: [Syscall build snooping](https://danielchasehooper.com/posts/syscall-build-snooping) Two possible approaches: **LD_PRELOAD** - Fast - Requires introducing C into BLUE (adds dependency on GCC toolchain) - Cannot snoop static binaries **PTRACE** - Does not require introducing any external dependency - Slow - Messy - Only one process can `ptrace` another ### Emacs Graph Viewer We would also like to provide an **Emacs graph viewer**, but there is no solid foundation for such a tool yet. We would likely rely on **SVG manipulation** for the implementation. Inspirations from existing Emacs UIs: - [org-supertag](https://github.com/yibie/org-supertag) - [org-timeblock](https://github.com/ichernyshovvv/org-timeblock) - [grid.el](https://github.com/ichernyshovvv/grid.el) - [org-graph-view](https://github.com/alphapapa/org-graph-view) - [hyperdrive.el](https://git.sr.ht/~ushin/hyperdrive.el) - [org-roam-ui](https://github.com/org-roam/org-roam-ui) - [boxy](https://gitlab.com/grinn.amy/boxy) Note: [org-roam-ui](https://github.com/org-roam/org-roam-ui) is implemented in JS. - Drawback: JS dependency - Advantage: Portable (browser-based) and provides excellent interactivity If we wanted something like that, it would be very nice to implement it in Scheme using [Hoot](https://spritely.institute/hoot) which is supported on all major browser platforms since version [0.6.0](https://spritely.institute/news/guile-hoot-0-6-0-released.html). ---
old added this to the beta milestone 2025年10月14日 01:24:37 +02:00
Author
Owner
Copy link

This will be more easily implemented after #114.

This will be more easily implemented after #114.
Owner
Copy link

Let's go with d3js for the graph backend for now.

For the build snooping, we will see later.

Let's go with d3js for the graph backend for now. For the build snooping, we will see later.
Sign in to join this conversation.
No Branch/Tag specified
main
pipeline-operators
documentation
shadow-fields
instance-walker
blue-shell
promote-serializers-to-metacommands
pre-alpha
Labels
Clear labels
bug
Something is not working
contribution welcome
Contributions are very welcome, get started here
discussion
duplicate
This issue or pull request already exists
enhancement
New feature
good first issue
Interested in contributing? Get started here.
help wanted
Need some help
invalid
Something is wrong
optimization
question
More information is needed
upstream
Related to an upstream repository, already reported there
bug
Something is not working
contribution welcome
Contributions are very welcome, get started here
duplicate
This issue or pull request already exists
enhancement
New feature
good first issue
Interested in contributing? Get started here.
help wanted
Need some help
invalid
Something is wrong
question
More information is needed
upstream
Related to an upstream repository, already reported there
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Depends on
#114 DAG builder API
lapislazuli/blue
Reference
lapislazuli/blue#97
Reference in a new issue
lapislazuli/blue
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?