Skip to content

Replace the Svelte node graph view with a Graphene-rendered graph UI - #4992

Open
timon-schelling wants to merge 1 commit into
masterfrom
graph-ui
Open

timon-schelling wants to merge 1 commit into
masterfrom
graph-ui

Conversation

@timon-schelling

Copy link
Copy Markdown
Member

No description provided.

@timon-schelling timon-schelling changed the title Implement Graphene base graph UI Implement Graphene based graph UI Nov 21, 2026
@timon-schelling

timon-schelling commented Nov 21, 2026 •

Copy link
Copy Markdown
Member Author

!build (Run ID 44932059322)

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 issues found across 69 files

Confidence score: 3/5

  • In types.rs, peer-applied name changes skip the width-cache invalidation used for local renames, so layer sizing can stay stale after a remote rename. Invalidate the cache for peer updates too.
  • In nodes.rs, rows with both a secondary input and output hide the output label. Draw each connector’s label on its respective side.
  • In layer.rs, the name box overlaps the visibility button, grip, and locked-layer button. Reserve space for the right-side controls.
  • The PR title is missing the required Graphene: prefix. Rename it to Graphene: Implement base graph UI.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="editor/src/messages/portfolio/document/utility_types/network_interface/types.rs">

<violation number="1" location="editor/src/messages/portfolio/document/utility_types/network_interface/types.rs:1171">
P2: The layer width cache now includes the name's text width, but name changes applied from a peer skip the invalidation that local renames do. `apply` mirrors `DisplayName` through `NodeMut::set_display_name` without calling `invalidate_node_appearance`, so a layer renamed remotely can keep its old width. Invalidate the node's appearance in the `NodeMetadataChange::DisplayName` arm of `apply.rs`, or confirm that reconcile unloads it.</violation>
</file>

<file name="node-graph/graph-ui/src/dashes.rs">

<violation number="1" location="node-graph/graph-ui/src/dashes.rs:132">
P2: `corner_length` is measured with `radius`, but the corner arcs are drawn with `arc_radius` (`radius - inset`). Use `arc_radius` so the dash distances match the stroked centerline.</violation>
</file>

<file name="editor/src/node_graph_executor/runtime.rs">

<violation number="1" location="editor/src/node_graph_executor/runtime.rs:656">
P3: The three `expect` calls in `stand_in_executor` will panic the runtime thread if the stand-in network fails to preprocess, compile, or type-check. Consider a graceful fallback, or document why these cannot fail.</violation>
</file>

<file name="node-graph/graph-ui/src/layer.rs">

<violation number="1" location="node-graph/graph-ui/src/layer.rs:100">
P2: `name_width` does not reserve space for the right-side buttons. The name box ends at x=232, which overlaps the visibility button (228..252), the grip (220..228), and the lock button when the layer is locked. Subtract the width of the buttons from the name width, or document that the overlap is intended.</violation>
</file>

<file name="node-graph/graph-ui/src/nodes.rs">

<violation number="1" location="node-graph/graph-ui/src/nodes.rs:438">
P2: Rows with both a secondary input and output render only the input label, hiding the output name (for example, `Area` beside `Width`). Draw each present connector’s label on its respective side of the row.</violation>
</file>

<file name="node-graph/graph-ui/Cargo.toml">

<violation number="1" location="node-graph/graph-ui/Cargo.toml:3">
P2: Custom agent: **PR title enforcement**

Prefix this Graphene node-graph UI change with `Graphene:`; the title should read `Graphene: Implement base graph UI`.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@@ -0,0 +1,42 @@
[package]
name = "graph-ui"
description = "The node graph UI of Graphite, drawn by Graphene"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Custom agent: PR title enforcement

Prefix this Graphene node-graph UI change with Graphene:; the title should read Graphene: Implement base graph UI.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At node-graph/graph-ui/Cargo.toml, line 3:

<comment>Prefix this Graphene node-graph UI change with `Graphene:`; the title should read `Graphene: Implement base graph UI`.</comment>

<file context>
@@ -0,0 +1,42 @@
+[package]
+name = "graph-ui"
+description = "The node graph UI of Graphite, drawn by Graphene"
+version.workspace = true
+license.workspace = true
</file context>

/// Width in grid units from the left edge of the layer's thumbnail to its left end, cached since text measurement is slow. Only loaded for layers.
pub(crate) layer_width: TransientCache<u32>,
/// Width in grid units from the left edge of the layer's thumbnail to its left end, and the measured width of its name, cached since text measurement is slow. Only loaded for layers.
pub(crate) layer_width: TransientCache<(u32, f64)>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The layer width cache now includes the name's text width, but name changes applied from a peer skip the invalidation that local renames do. apply mirrors DisplayName through NodeMut::set_display_name without calling invalidate_node_appearance, so a layer renamed remotely can keep its old width. Invalidate the node's appearance in the NodeMetadataChange::DisplayName arm of apply.rs, or confirm that reconcile unloads it.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At editor/src/messages/portfolio/document/utility_types/network_interface/types.rs, line 1171:

<comment>The layer width cache now includes the name's text width, but name changes applied from a peer skip the invalidation that local renames do. `apply` mirrors `DisplayName` through `NodeMut::set_display_name` without calling `invalidate_node_appearance`, so a layer renamed remotely can keep its old width. Invalidate the node's appearance in the `NodeMetadataChange::DisplayName` arm of `apply.rs`, or confirm that reconcile unloads it.</comment>

<file context>
@@ -1169,8 +1167,8 @@ pub struct DocumentNodeTransientMetadata {
-	/// Width in grid units from the left edge of the layer's thumbnail to its left end, cached since text measurement is slow. Only loaded for layers.
-	pub(crate) layer_width: TransientCache<u32>,
+	/// Width in grid units from the left edge of the layer's thumbnail to its left end, and the measured width of its name, cached since text measurement is slow. Only loaded for layers.
+	pub(crate) layer_width: TransientCache<(u32, f64)>,
 }
 
</file context>

pub(crate) fn border(min: DVec2, max: DVec2, radius: f64, gaps: &[[DVec2; 2]], dashed: bool) -> BezPath {
let inset = BORDER_WIDTH / 2.;
let arc_radius = radius - inset;
let corner_length = flattened_arc_length(radius, [0., FRAC_PI_2]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: corner_length is measured with radius, but the corner arcs are drawn with arc_radius (radius - inset). Use arc_radius so the dash distances match the stroked centerline.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At node-graph/graph-ui/src/dashes.rs, line 132:

<comment>`corner_length` is measured with `radius`, but the corner arcs are drawn with `arc_radius` (`radius - inset`). Use `arc_radius` so the dash distances match the stroked centerline.</comment>

<file context>
@@ -0,0 +1,349 @@
+pub(crate) fn border(min: DVec2, max: DVec2, radius: f64, gaps: &[[DVec2; 2]], dashed: bool) -> BezPath {
+	let inset = BORDER_WIDTH / 2.;
+	let arc_radius = radius - inset;
+	let corner_length = flattened_arc_length(radius, [0., FRAC_PI_2]);
+	let [left, top] = (min + inset).to_array();
+	let [right, bottom] = (max - inset).to_array();
</file context>
Suggested change
let corner_length = flattened_arc_length(radius, [0., FRAC_PI_2]);
let corner_length = flattened_arc_length(arc_radius, [0., FRAC_PI_2]);

}

pub fn name_width(&self) -> f64 {
self.width as f64 * GRID_SIZE - LAYER_NAME_LEFT - LAYER_DETAILS_MARGIN

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: name_width does not reserve space for the right-side buttons. The name box ends at x=232, which overlaps the visibility button (228..252), the grip (220..228), and the lock button when the layer is locked. Subtract the width of the buttons from the name width, or document that the overlap is intended.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At node-graph/graph-ui/src/layer.rs, line 100:

<comment>`name_width` does not reserve space for the right-side buttons. The name box ends at x=232, which overlaps the visibility button (228..252), the grip (220..228), and the lock button when the layer is locked. Subtract the width of the buttons from the name width, or document that the overlap is intended.</comment>

<file context>
@@ -0,0 +1,174 @@
+	}
+
+	pub fn name_width(&self) -> f64 {
+		self.width as f64 * GRID_SIZE - LAYER_NAME_LEFT - LAYER_DETAILS_MARGIN
+	}
+
</file context>


for row in 1..card.rows() {
let (input, output) = (card.secondary_inputs.get(row - 1), card.secondary_outputs.get(row - 1));
let Some(connector) = input.or(output) else { continue };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Rows with both a secondary input and output render only the input label, hiding the output name (for example, Area beside Width). Draw each present connector’s label on its respective side of the row.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At node-graph/graph-ui/src/nodes.rs, line 438:

<comment>Rows with both a secondary input and output render only the input label, hiding the output name (for example, `Area` beside `Width`). Draw each present connector’s label on its respective side of the row.</comment>

<file context>
@@ -0,0 +1,826 @@
+
+	for row in 1..card.rows() {
+		let (input, output) = (card.secondary_inputs.get(row - 1), card.secondary_outputs.get(row - 1));
+		let Some(connector) = input.or(output) else { continue };
+		let name = labels.label(&connector.name, NODE_WIDTH - 2. * NODE_ROW_PADDING)?;
+		let left = if input.is_some() { NODE_ROW_PADDING } else { NODE_WIDTH - NODE_ROW_PADDING - name.width };
</file context>

..Default::default()
};
graph_ui::render::wrap_network(&mut network);
preprocessor.preprocess(&mut network, &|_| None).expect("The stand-in network preprocesses");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The three expect calls in stand_in_executor will panic the runtime thread if the stand-in network fails to preprocess, compile, or type-check. Consider a graceful fallback, or document why these cannot fail.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At editor/src/node_graph_executor/runtime.rs, line 656:

<comment>The three `expect` calls in `stand_in_executor` will panic the runtime thread if the stand-in network fails to preprocess, compile, or type-check. Consider a graceful fallback, or document why these cannot fail.</comment>

<file context>
@@ -505,10 +610,52 @@ impl NodeRuntime {
+		..Default::default()
+	};
+	graph_ui::render::wrap_network(&mut network);
+	preprocessor.preprocess(&mut network, &|_| None).expect("The stand-in network preprocesses");
+	let compiled = Compiler {}.compile_single(network).expect("The stand-in network compiles");
+	DynamicExecutor::new(compiled.network).expect("The stand-in network is typed")
</file context>

@github-actions

Copy link
Copy Markdown
📦 Web Build Complete for 3151a57
https://5de2dba1.graphite.pages.dev

Wasm: 48.63 MB — JS: 0.72 MB — CSS: 0.12 MB — Fonts: 0.69 MB — Images: 0.09 MB — All Assets: 50.25 MB

@Keavon Keavon changed the title Implement Graphene based graph UI Replace the Svelte node graph view with a Graphene-rendered graph UI Nov 22, 2026

@Keavon Keavon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only regression I found is the loss of hover animations on node/layer/redirect dot/import/export connectors. Good to merge once fixed (or in a followup).

This branch was successfully deployed

1 active deployment
graphite-dev (Preview) — 2c85279e Deployed Nov 22, 2026 by github-actions[bot]
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.

2 participants