Integrate document-format storage into the editor#4265
Conversation
There was a problem hiding this comment.
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.
2c52d29 to
a263180
Compare
a263180 to
92d4397
Compare
92d4397 to
337c12c
Compare
There was a problem hiding this comment.
8 issues found across 31 files
Confidence score: 2/5
editor/src/messages/portfolio/document/document_message_handler.rsselects save format from a preference instead of the current file path, so Ctrl+S can write.gddcontent into a.graphitefile (and vice versa), which can break reopen routing and effectively corrupt expected load behavior — derive format from the on-disk extension for existing files and add a regression test before merging.editor/src/messages/portfolio/portfolio_message_handler.rscan silently drop autosave writes when resource storage is unavailable while still treating the document as autosaved, creating a real data-loss/regression risk if users trust autosave state — gate autosave success on actual persistence (or surface failure/retry) before merge.editor/src/messages/portfolio/document/utility_types/network_interface.rscarriespreviewingacross revisions, which can leave stale preview root IDs after undo/redo and cause invalid root/structure resolution — clear or revalidate preview IDs when rebuilding network state and cover this path with an undo/redo test.editor/src/messages/portfolio/document/document_diff.rsandeditor/src/messages/portfolio/document/storage/round_trip_tests.rsreduce diagnosability: value-level drift is omitted from diffs and redo is called without an assertion, so breakages can be logged unclearly or pass tests silently — add per-value diff details and a concrete redo assertion (and consider theSavedDocument.gddnaming fix ineditor/src/consts.rs) before merging.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
2 issues found across 31 files
Confidence score: 2/5
- In
editor/src/messages/portfolio/portfolio_message_handler.rs,load_documentremounts storage even for.gddfiles already mounted byOpenGddDocument, which can overwrite the active working copy and erase undo/redo history if merged as-is — gate or skip remounting when storage is already mounted before merging. - In
editor/src/messages/portfolio/document/document_diff.rs,differing_valuescompares entire attribute records instead of just values, so timestamp-only metadata changes can be flagged as value drift and confuse diff diagnostics — narrow the comparison to value fields to de-risk debugging noise.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
3 issues found across 31 files
Confidence score: 3/5
- In
editor/src/messages/portfolio/document/document_diff.rs,diff_registriescurrently misses resource payload mismatches and also useszip-style comparison that truncates when list lengths differ, so users can see drift reports without enough per-entry detail to diagnose or fix the source of the mismatch. Before merging, make the diff length-aware and include payload/content-level mismatch diagnostics for trailing and unequal entries. - In
editor/src/messages/portfolio/portfolio_message_handler.rs, failed.gddopens are silently ignored, which makes corrupt or invalid files look like a no-op and leaves users without feedback on what happened. Add an explicit user-facing error/notification path for open failures before merging.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
6952653 to
503249e
Compare
…erences, restructure tests
…, and view-settings/diff fixes
…esource diff detail
503249e to
111a055
Compare
There was a problem hiding this comment.
1 issue found across 13 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="editor/src/messages/portfolio/document/storage_tests/round_trip_tests.rs">
<violation number="1" location="editor/src/messages/portfolio/document/storage_tests/round_trip_tests.rs:625">
P2: Doc comment on `assert_cursor_matches_runtime` claims resource presence validation that the implementation does not perform</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| assert!(!storage.can_undo(), "cursor must not undo past the loaded base (the load is not an undo step)"); | ||
| } | ||
|
|
||
| /// Assert the `Gdd` cursor's stored registry matches a fresh `from_runtime` of the current interface (node |
There was a problem hiding this comment.
P2: Doc comment on assert_cursor_matches_runtime claims resource presence validation that the implementation does not perform
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At editor/src/messages/portfolio/document/storage_tests/round_trip_tests.rs, line 625:
<comment>Doc comment on `assert_cursor_matches_runtime` claims resource presence validation that the implementation does not perform</comment>
<file context>
@@ -626,18 +616,16 @@ async fn undo_twice_steps_cursor_two_interactions() {
-/// and per-network export wiring must agree. The runtime keeps resources alive across undo (for legacy
-/// redo) while the cursor reverts the interaction's `AddResource`, so the runtime's resource set is allowed
-/// to be a superset of the cursor's, but a resource the current network references must be present.
+/// Assert the `Gdd` cursor's stored registry matches a fresh `from_runtime` of the current interface (node
+/// set, network set, per-network export wiring), mirroring the live `verify_cursor_matches_runtime` check.
+/// The runtime's resource set may be a superset (it keeps undone resources alive for redo), but every
</file context>
No description provided.