Skip to content

Integrate document-format storage into the editor#4265

Open
TrueDoctor wants to merge 10 commits into
masterfrom
editor-gdd-integration
Open

Integrate document-format storage into the editor#4265
TrueDoctor wants to merge 10 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.

Comment thread editor/src/messages/portfolio/document/document_message_handler.rs Outdated
Comment thread editor/src/messages/portfolio/document/document_message_handler.rs Outdated
Comment thread editor/src/messages/portfolio/document/utility_types/network_interface.rs Outdated

@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.

8 issues found across 31 files

Confidence score: 2/5

  • editor/src/messages/portfolio/document/document_message_handler.rs selects save format from a preference instead of the current file path, so Ctrl+S can write .gdd content into a .graphite file (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.rs can 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.rs carries previewing across 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.rs and editor/src/messages/portfolio/document/storage/round_trip_tests.rs reduce 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 the SavedDocument .gdd naming fix in editor/src/consts.rs) before merging.

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

Re-trigger cubic

Comment thread editor/src/consts.rs
Comment thread editor/src/messages/portfolio/portfolio_message_handler.rs Outdated
Comment thread editor/src/messages/portfolio/document/document_message_handler.rs
Comment thread editor/src/messages/portfolio/document/document_diff.rs
Comment thread editor/src/messages/portfolio/document/document_diff.rs Outdated
Comment thread editor/src/messages/portfolio/document/utility_types/network_interface.rs Outdated

@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.

2 issues found across 31 files

Confidence score: 2/5

  • In editor/src/messages/portfolio/portfolio_message_handler.rs, load_document remounts storage even for .gdd files already mounted by OpenGddDocument, 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_values compares 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

Comment thread editor/src/messages/portfolio/portfolio_message_handler.rs Outdated
Comment thread editor/src/messages/portfolio/document/document_diff.rs Outdated

@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.

3 issues found across 31 files

Confidence score: 3/5

  • In editor/src/messages/portfolio/document/document_diff.rs, diff_registries currently misses resource payload mismatches and also uses zip-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 .gdd opens 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

Comment thread editor/src/messages/portfolio/portfolio_message_handler.rs
Comment thread editor/src/messages/portfolio/document/document_diff.rs Outdated
Comment thread editor/src/messages/portfolio/document/document_diff.rs

@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.

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

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: 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>

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