Repository navigation
CLI: info and convert report what a damaged DWG left out (read notes, #859) - #2337
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Expose read notes in inspection results crates/engine/src/cmd/inquiry.rs, docs/control-protocol.md, README.md |
drawing.inspect now includes readNotes. The protocol documentation and README describe inspection fields and read-note reporting. |
Report read notes during conversion apps/cadcraft-cli/src/output.rs, apps/cadcraft-cli/src/convert.rs, apps/cadcraft-cli/tests/read_notes.rs |
The CLI formats read notes with a path prefix and emits them before skipped-message diagnostics. Unit and integration tests cover damaged and intact DWG files. |
Estimated code review effort: 2 (Simple) | ~12 minutes
Change: Bug fix
Possibly related issues
- DXF/DWG preservation: track 27 pending checks and round-trip follow-ups #2238 — The PR exposes reader notes, which relates to the issue’s request for visibility into reader defects, but does not fix data loss.
- DWG is off on FreeBSD aarch64: acadrust 0.6.6 doesn't compile there, and 0.6.7/0.6.8 read some damaged DWGs as empty #2526 — The PR reports read notes for damaged DWGs, but does not address cases that open without a note.
- 0.13.0: reading a DWG silently empties block definitions that contain 3DSOLIDs (regression from 0.12.0) #2159 — The PR reports available reader notes, but does not restore missing
3DSOLIDrecords. - Real-file corpus: 19 office DWGs + 4 fixtures round-tripped and opened in BricsCAD (ROADMAP item 3) #1041 — The PR improves CLI visibility of reader notes, but does not fix entity loss.
- [Bug Report] DWG from AutoCAD with 3D drawings: "1 of 308 object records couldn't be read and was left out (type 521 × 1)" on open #1854 — The PR exposes and prints reader notes related to skipped objects.
Suggested reviewers: aiongg, dylanmtaylor
Merge Risk: 
Minimal · up to 7dd73
-
The read-note reporting changes are consistent across inspection, conversion, tests, and documentation, with no merge-blocking risk found.
Security architecture risk: 
Minimal · up to 30c9f
-
The change makes existing partial-read diagnostics visible without adding privileges, executable behavior, or a new entrypoint. Inspection remains read-only, and conversion retains its existing output and success behavior. No material security risk was identified in the reviewed changes.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- inferred — The changed exposure is diagnostic metadata from the drawing already opened by the caller, delivered through existing inspection results and conversion stderr. The additions do not select another asset, create a network listener, or introduce a privileged operation.
Trust Boundaries and Controls
- observed — Note text includes reader-derived counts and diagnostic record-type labels, including nonnumeric labels. The new code carries this text as JSON string values or literal-formatted stderr output; it does not use notes as executable commands, file destinations, or authorization inputs.
-
Pre-merge checks: 
5
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.
|
Thanks, a What I ran on the port
One small thing for the rebase |
FredApps
left a comment
There was a problem hiding this comment.
ReviewerA — source-read COMMENT (not an approval)
I read the head of the diff: the CLI info and convert report what a damaged DWG left out (read notes, #859). When reading leaves something out (records a DXF reader cannot place, object records of a damaged DWG), info reports it as skipped and readNotes, convert warns on stderr, run prints the DWG notes with its log, the exit code stays 0, and MCP open replies with the notes as warnings. A converter that silently drops objects makes data loss invisible, so reporting is the right thing, and keeping exit 0 matches the README. A script that wants to fail on loss would want a flag (--strict) to change the exit code. A test with a damaged file is the proof. The messages are catalogue-free and meant for the log. I have not run it, and no exact-head CI result exists for this head. Nothing was run.
I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.
Status: waiting_author.
…torytold#859) A damaged DWG opens partially since storytold#859 and the drawing's read notes say how many object records were left out. OPEN echoes them and MCP `open` returns them as `warnings`, but `cadcraft-cli info` and `convert` stayed silent: a corpus round trip wrote thousands of skipped records away without a word. - convert: each read note goes to stderr as `IN: <note>`, next to the skipped-records warning (storytold#872). The exit code stays 0. - drawing.inspect (and so info, MCP inspect_drawing and the control channel): new field `readNotes`, next to `skipped`. Existing fields are unchanged. - run already prints OPEN's notes with the session log. - README and docs/control-protocol.md say where the notes appear. Part of storytold#1039. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30c9f13 to
7dd73de
Compare
|
Thanks for porting and running it, that saved a round. I rebased onto I'd rather keep this PR to
I can open both after this one lands, if that's useful. |
austin62jake
left a comment
There was a problem hiding this comment.
Approving. I merged it onto current main with six other PRs (#2620, #2337, #2117, #2028, #2022, #2006, #1976, #1759). cargo xtask ci passes: all 7 steps, 3166 tests.
info and convert now print the reader's notes, one warning line each, before the skipped-records line. So a damaged DWG's "3 of 10 object records couldn't be read… saving over the original would lose them" reaches a script on stderr instead of being silent. The new CLI tests and the unit test pin down the format.
Part of #1039. Redo of #1048 (closed after it went stale), rebased on
main(26da98e).A damaged DWG opens partially since #859, and the drawing's
read_notessay what was left out.runand MCPopenshow the notes, butcadcraft-cli infoandconvertdid not. @Rickpixell measured this again on v0.13.0 andmainin #1039 (comment). On a damaged R12 DWG,convertwrote a DXF with 0 entities and printed onlywrote out.dxf.inforeportedentityCount: 0andskipped: {count: 0}. Both commands exited 0. A script using either command gets an empty drawing and no sign that anything was lost.Changes
convert(apps/cadcraft-cli/src/main.rs): before writing, prints each read note on stderr asPATH: <note>(read_note_messages), next to the existing skipped-records warning (DXF: count the records the reader can't place; info reports them, convert warns #872). The exit code stays 0, the same as for skipped records.info/drawing.inspect(crates/engine/src/cmd/inquiry.rs): new fieldreadNotesholding the notes as strings (an empty array for a complete read), next toskipped.infoprintsdrawing.inspect, so MCPinspect_drawingand the control channel get the field too. No existing field changes.runand MCPopen: unchanged. They already show the notes.README.md(CLI section) anddocs/control-protocol.md(drawing.inspectrow).#1790 contains the same change inside a larger PR. If #1790 lands first, I'll close this one.
Not in this PR (from the same measurement)
file-format-parity.mdlists R11/R12 DWG read as "no", but an intact R12 DWG reads completely.Test plan
apps/cadcraft-cli/tests/read_notes.rs: builds a 200-line R2000 DWG and damages copies the way Open damaged DWGs partially and say what was left out (acadrust 0.6.4, #800) #859's own test does (flipping bytes across the objects area) until one reads partially. This also gives the damaged 2000+ case that could not be produced by hand.infoon that copy has exactly onereadNotesentry.convertprints exactly onePATH: DWG: … couldn't be read and …line and still writes the copy. The intact DWG givesreadNotes: []and no warning.read_notes_become_one_warning_eachcovers the message format.cargo xtask ci: fmt, clippy, i18n, assets, layers and wasm pass; the workspace tests pass excepttext_double_click::double_clicked_text_takes_ime_composition_and_commit, which fails on my machine for a missing CJK font ("No glyph for 中", noCRAFT_FONTS_DIR) and is unrelated to this change.🤖 Generated with Claude Code
Summary by CodeRabbit
infocommand reports skipped records and read notes, whilerunlogs DWG notes.convertnow warns about drawing read notes before reporting skipped records, while still completing successfully and writing the converted copy when notes are present.