Skip to content

Add document-format crate#4234

Open
TrueDoctor wants to merge 8 commits into
masterfrom
upstream-document-format
Open

Add document-format crate#4234
TrueDoctor wants to merge 8 commits into
masterfrom
upstream-document-format

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 the document-format crate, which provides a typed handle (Gdd) for the .gdd document format, decoupling on-disk layout from the editor's in-memory runtime types. It implements codecs, export options, path layouts, and session state persistence. The review feedback highlights several critical issues: a randomized history writing order in append_history_deltas that can cause document load failures, a race condition on WASM/OPFS in open_from_archive due to non-blocking writes, a potential runtime panic on WASM from using block_on in garbage_collect, and redundant loads in stream_entries due to duplicate hashes in hashes_from_store.

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 document/document-format/src/lib.rs Outdated
Comment thread document/document-format/src/lib.rs
Comment thread document/document-format/src/lib.rs Outdated
Comment thread document/document-format/src/lib.rs Outdated
@TrueDoctor TrueDoctor force-pushed the upstream-document-format branch from 98bc8f2 to bee1f52 Compare June 16, 2026 14:03

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

5 issues found across 14 files

Confidence score: 2/5

  • In document/document-format/src/lib.rs, add_resource_from_path commits AddResource before bytes are copied, so an I/O failure can leave a persisted hash pointing to missing data; merging as-is risks durable document/resource inconsistency — make the operation atomic (copy/verify first, then persist) or add rollback before merging.
  • In document/document-format/src/codec.rs, read_single can convert a trailing decode Err into ExpectedSingle, which hides the real parse failure and can send callers down the wrong recovery path — propagate the second-item decode error before returning the multi-value error.
  • In document/document-format/src/export.rs, using two independent booleans means an invalid “all excluded” configuration is representable until runtime validate(), so bad states can slip through call sites and fail late — replace this with a type that makes invalid combinations unrepresentable (or enforce construction-time validation) before merge.
  • In document/document-format/src/io.rs, write_single returns ReadError with unreachable variants like NotFound, which can mislead downstream error handling and obscure real write failure semantics — split read/write error types (or rename/refine) to match actual write behavior.

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

Re-trigger cubic

Comment thread document/document-format/src/lib.rs Outdated
Comment thread document/document-format/src/export.rs Outdated
Comment thread document/document-format/src/codec.rs Outdated
Comment thread document/document-format/src/io.rs Outdated
Comment thread document/document-format/src/export.rs Outdated
Split the 963-line lib.rs by responsibility: persist path into persist.rs, resource I/O into resource.rs, export engine into export.rs. Rename the GddV1 layout struct to GddV1Layout and add a GddV1 = Gdd<GddV1Layout> alias.

@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 6 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread document/document-format/src/persist.rs Outdated
Comment thread document/document-format/src/resource.rs
Comment thread document/document-format/src/persist.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.

1 issue found across 9 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread document/graph-storage/Cargo.toml
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