Skip to content

Integrate document-format storage into the editor#4265

Draft
TrueDoctor wants to merge 3 commits into
masterfrom
editor-gdd-integration
Draft

Integrate document-format storage into the editor#4265
TrueDoctor wants to merge 3 commits into
masterfrom
editor-gdd-integration

Conversation

@TrueDoctor

Copy link
Copy Markdown
Member

No description provided.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a new .gdd (Graphite Document) container format alongside the legacy .graphite format, integrating asynchronous working-copy persistence and a robust undo/redo cursor mechanism via graph-storage. It adds comprehensive end-to-end round-trip tests, updates the frontend to support the new extension, and includes debugging utilities for diffing networks and registries. The review feedback highlights several performance optimization opportunities, specifically recommending the removal of redundant clones of the NodeNetwork and view settings, as well as optimizing path vector allocations during transient view state traversal.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

..Default::default()
};

document.apply_stored_document_settings(&storage.view_settings().clone());

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.

medium

The storage.view_settings() getter returns a reference, so cloning the entire BTreeMap of view settings here is unnecessary and introduces redundant allocations. You can pass the reference directly.

		document.apply_stored_document_settings(storage.view_settings());


use crate::messages::portfolio::document::utility_types::network_interface::storage_metadata::collect_network_view_settings;

let network = self.network_interface.document_network().clone();

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.

medium

Cloning the entire NodeNetwork here is unnecessary and expensive because network is only passed by reference to network_ids, stage_runtime_snapshot, and verify_storage_round_trip. You can borrow the document network directly without cloning.

		let network = self.network_interface.document_network();

Comment on lines +3460 to +3464
stack.extend(self_network_metadata.persistent_metadata.node_metadata.keys().map(|node_id| {
let mut current_path: Vec<NodeId> = path.clone();
current_path.push(*node_id);
current_path
}));

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.

medium

Cloning the path vector and pushing it to the stack for every single node (including leaf nodes) is highly inefficient. Since only nodes that represent nested networks actually need to be traversed, you can filter the keys to only those where network_metadata is Some before cloning the path. This avoids redundant vector allocations and map lookups for all leaf nodes.

			stack.extend(
				self_network_metadata
					.persistent_metadata
					.node_metadata
					.iter()
					.filter(|(_, meta)| meta.persistent_metadata.network_metadata.is_some())
					.map(|(node_id, _)| {
						let mut current_path = path.clone();
						current_path.push(*node_id);
						current_path
					}),
			);

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