You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Route Word 97 binary parsing through craft-libs - #6565
Move native .doc parsing and encryption detection into craft-doc-binary. WordCraft keeps the public read API and maps the shared neutral model into its app model.
The app-local parser and its wire-specific tests are removed after matching parser coverage was confirmed in craft-doc-binary / craft-cfb. Adapter tests cover compressed and UTF-16 documents, malformed containers, nested stories, large paragraph text, and moving media buffers without copying.
No actionable comments were generated in the recent review.
Walkthrough
The docbin crate now delegates DOC reading to craft-doc-binary and converts its shared document model into wordcraft_doc::Document. The change removes the in-crate parser modules and their dedicated encryption, drawing, and metadata tests.
Adds pinned shared-reader dependencies and JSON-based conversion for document content, nested structures, persistent fields, media, and passthrough data. Tests cover nested content, settings, media pointer identity, and default fit state.
Reader delegation and read tests crates/docbin/src/lib.rs, crates/docbin/src/tests.rs
Delegates reads and encryption checks to craft-doc-binary. Tests cover non-compound input and compressed, CP1252, and UTF-16 text extraction.
sequenceDiagram
participant Caller
participant read_with_password
participant craft_doc_binary
participant from_shared_model
participant wordcraft_doc_Document
Caller->>read_with_password: bytes and optional password
read_with_password->>craft_doc_binary: read document
craft_doc_binary-->>read_with_password: shared document model
read_with_password->>from_shared_model: convert shared model
from_shared_model-->>wordcraft_doc_Document: converted document
Loading
Suggested reviewers:edurbs, benandez
Merge Risk: Minimal · up to 388c8
Word 97 .doc parsing now runs through the shared craft-libs reader, while WordCraft keeps its existing read API. Document content and metadata such as title, author and page setup carry over in the conversion to WordCraft's document model. No merge-blocking issues were found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "Route Word 97 binary parsing through craft-libs" matches the main change. The PR moves native .doc parsing and encryption detection out of the crate and into craft-doc-binary, and the diff …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "Route Word 97 binary parsing through craft-libs" matches the main change. The PR moves native .doc parsing and encryption detection out of the crate and into craft-doc-binary, and the diff deletes the local parser modules (fib, piece, fkp, sprm, and others) while lib.rs becomes an adapter to the shared reader. The title is short, specific, and avoids file lists. It names the "craft-libs" destination, which is accurate per the PR objectives.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between eae8363 and 388c8e5.
Files ignored due to path filters: 1
Cargo.lock is excluded by !**/*.lock
Files selected for processing: 22
crates/docbin/Cargo.toml
crates/docbin/src/crypt.rs
crates/docbin/src/drawing.rs
crates/docbin/src/fib.rs
crates/docbin/src/fkp.rs
crates/docbin/src/fmt.rs
crates/docbin/src/lib.rs
crates/docbin/src/list.rs
crates/docbin/src/media.rs
crates/docbin/src/metadata.rs
crates/docbin/src/model_bridge.rs
crates/docbin/src/notes.rs
crates/docbin/src/officeart.rs
crates/docbin/src/piece.rs
crates/docbin/src/sections.rs
crates/docbin/src/sprm.rs
crates/docbin/src/stsh.rs
crates/docbin/src/table.rs
crates/docbin/src/tests.rs
crates/docbin/src/tests/drawing.rs
crates/docbin/src/tests/encrypted.rs
crates/docbin/src/tests/metadata.rs
Files with no reviewable changes: 18
crates/docbin/src/crypt.rs
crates/docbin/src/drawing.rs
crates/docbin/src/fib.rs
crates/docbin/src/fkp.rs
crates/docbin/src/fmt.rs
crates/docbin/src/list.rs
crates/docbin/src/media.rs
crates/docbin/src/metadata.rs
crates/docbin/src/notes.rs
crates/docbin/src/officeart.rs
crates/docbin/src/piece.rs
crates/docbin/src/sections.rs
crates/docbin/src/sprm.rs
crates/docbin/src/stsh.rs
crates/docbin/src/table.rs
crates/docbin/src/tests/drawing.rs
crates/docbin/src/tests/encrypted.rs
crates/docbin/src/tests/metadata.rs
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Move native
.docparsing and encryption detection intocraft-doc-binary. WordCraft keeps the public read API and maps the shared neutral model into its app model.The app-local parser and its wire-specific tests are removed after matching parser coverage was confirmed in
craft-doc-binary/craft-cfb. Adapter tests cover compressed and UTF-16 documents, malformed containers, nested stories, large paragraph text, and moving media buffers without copying.Validation
cargo test -p wordcraft-docbin -- --nocapturecargo clippy -p wordcraft-docbin --all-targets -- -D warningscargo fmt --all -- --checkgit diff --checkSummary by CodeRabbit