Skip to content

fix(objects): route the R14 XRECORD class to the §20.4.104 decoder (#149) - #254

Merged
DrunkOnJava merged 1 commit into
mainfrom
fix/149-xrecord-r14
Oct 26, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
fix/149-xrecord-r14

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Route the XRECORD class name to the existing XRECORD decoder. On R14, XRECORD has a class number from AcDb:Classes rather than the fixed code 0x4F, so every R14 XRECORD was skipped. All 1,154 R14 XRECORD records of the public corpus now decode, and each closes on its boundary. No XRECORD anywhere in the 52-file corpus is skipped or errors.

Spec reference

§20.4.104 XRECORD, typed (varies): BL numdatabytes, the databytes, then BS cloning flag on R2000+. src/objects/xrecord.rs already reads exactly this and closes on every R2000-R2018 record; dispatch sent only the fixed code 0x4F there. #149's measurement (the probe in #222) showed all 345 R14 records of the 19-file corpus close under that list. This PR adds the one dispatch_object_class arm.

The RS-versus-RC string-length finding in #149 is about the body's group-code pairs. The decoder still carries the body as bytes, so this PR does not use that finding and does not depend on it.

Coverage, ../../samples

cargo run --release --example coverage_report -- ../../samples, base 2e9f7e2:

                       before                        after
arc_R14.dwg         166 126  0  56.8 %          281  11  0  96.2 %
circle_R14.dwg      166 126  0  56.8 %          281  11  0  96.2 %
line_R14.dwg        166 126  0  56.8 %          281  11  0  96.2 %
TOTAL              3911 525  9  88.0 %         4256 180  9  95.7 %

XRECORD (custom class) → 345 leaves the unhandled histogram; nothing enters the error histogram.

Public corpus: tools/corpus/baseline.tsv (regenerated, committed)

python3 -I tools/corpus/measure.py run --corpus <fetch dest> --bin target/release/examples --out r.json then measure.py check --results r.json (exit 0 after measure.py baseline):

-arc_R14.dwg            nextgis   AC1014  166 126   0 ...
+arc_R14.dwg            nextgis   AC1014  281  11   0 ...
-circle_R14.dwg         nextgis   AC1014  166 126   0 ...
+circle_R14.dwg         nextgis   AC1014  281  11   0 ...
-ellipse_R14.dwg        nextgis   AC1014  172 133   0 ...
+ellipse_R14.dwg        nextgis   AC1014  294  11   0 ...
-line_R14.dwg           nextgis   AC1014  166 126   0 ...
+line_R14.dwg           nextgis   AC1014  281  11   0 ...
-point2d_R14.dwg        nextgis   AC1014  165 126   0 ...
+point2d_R14.dwg        nextgis   AC1014  280  11   0 ...
-point3d_R14.dwg        nextgis   AC1014  165 126   0 ...
+point3d_R14.dwg        nextgis   AC1014  280  11   0 ...
-polyline2d_line_R14.dwg nextgis  AC1014  165 127   0 ...
+polyline2d_line_R14.dwg nextgis  AC1014  280  12   0 ...
-sample_AC1014.dwg      acadsharp AC1014  676 461 105 ...
+sample_AC1014.dwg      acadsharp AC1014 1018 119 105 ...

Only the decoded and skipped columns move, and only on the eight R14 drawings. The R14 band (8 files) goes from 1841 decoded / 1351 skipped / 105 errored to 2995 / 197 / 105, and the 52-file total from 13781 / 1985 / 308 to 14935 / 831 / 308. The census, tiling and reference columns are unchanged.

Class census and reference closure

probe_class_census and probe_reference_closure on all 19 files of ../../samples give output identical to the run before the change. The census and closure columns of the 52-row baseline do not move.

Docs

  • docs/data/spec-coverage.tsv §20.4.104 partial → closes. The old note ("Skipped as unmatched across the corpus") is replaced: it was true only of R14. docs/spec-coverage.md is regenerated.
  • src/objects/xrecord.rs: the stale §19.6.5 / §19.5.67 citations are corrected to §20.4.104, and the module doc records the R14 measurement.
  • README "help wanted" item 2: XRECORD is no longer an unhandled class; what remains is typing the body.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • RUSTFLAGS="-D warnings" cargo test --release --all-features (real-file tests ran against ../../samples)
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
  • tools/corpus/measure.py check passes against the committed baseline
  • No unit tests added or changed.

Source-provenance declaration

By submitting this PR I certify that my contribution does not incorporate executable code from any source whose license is incompatible with Apache-2.0. Specifically:

  • No Autodesk DWG SDK source (RealDWG, ObjectARX, ObjectDBX) or NDA-protected Autodesk documentation was consulted or imported.
  • No Open Design Alliance Teigha / Drawings SDK source was consulted or imported. The ODA's public Open Design Specification for .dwg files PDF is explicitly allowed (see CLEANROOM.md).
  • No GPL-licensed DWG implementation source (LibreDWG, etc.) was consulted or imported.

My contribution is based on §20.4.104 of the ODA's freely-redistributable Open Design Specification for .dwg files (v5.4.1) and on the corpus bytes. No third-party code or comments were read.

Developer Certificate of Origin

By submitting this PR, I certify that the contribution complies with the Developer Certificate of Origin 1.1.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T10:35:55.215930Z 47a9b3f New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

)

§20.4.104 types XRECORD (varies): from R2000 it has the fixed code 0x4F,
but R14 files give it a class number from AcDb:Classes, and dispatch
sent only the fixed code to objects::xrecord. Routing the XRECORD class
name there decodes all 1,154 R14 XRECORDs of the public corpus, each
closing on its boundary; no XRECORD in the 52-file corpus is now skipped
or errors.

§20.4.104 moves to closes; tools/corpus/baseline.tsv records the eight
R14 drawings' new decoded and skipped counts.
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