Skip to content

feat(objects): probe XRECORD on every release band and MATERIAL's data-field budget - #222

Merged
DrunkOnJava merged 2 commits into
mainfrom
feat/probe-xrecord-material
Oct 26, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
feat/probe-xrecord-material

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Lands two probes that were stranded untracked in the feat/xrecord-material worktree since 2026-08-30: probe_xrecord shows the §20.4.104 XRECORD field list closes on all 1117 XRECORD records of the corpus, R14 included, and probe_material pins the data-field budget every MATERIAL record leaves after its common object data. XRECORD (345) and MATERIAL (65) are the two largest unhandled kinds in coverage_report.

Spec reference

What the output makes derivable

  1. XRECORD on R14 needs only a dispatch arm. All 345 custom-class XRECORDs in coverage_report's unhandled histogram are the 115 records of each R14 file, where XRECORD has a class-map type code; entities/dispatch.rs sends only the fixed code 0x4F to objects::xrecord. The field list that decoder already reads closes on every one of them. Routing the XRECORD class name to it would move 345 records from skipped to decoded (recorded in §20 family: Dictionaries and non-graphical objects (§20.4.44, §20.4.45, §20.4.71, §20.4.72, §20.4.74, §20.4.76, §20.4.77, §20.4.79, §20.4.83, §20.4.89, §20.4.90, §20.4.92 to §20.4.95, §20.4.104) #149; not done here, since this PR adds probes only).
  2. R13 to R2004 body strings take an RS length, then the RC codepage, then the bytes; §20.4.104 prints the length as RC. arc_R14.dwg handle 0x2AB holds 102="EXTNAMES" 1="*MODEL_SPACE" 2="*Model_Space" in 47 databytes: 3 × (2 + 2 + 1) + 32. An RC length gives 44.
  3. MATERIAL: no field list. The budgets below are what a list has to fill; only sample_AC1032.dwg holds a material that is not a default, so the per-map layout cannot yet be separated from its values (MATERIAL (30 records): per-map block layout needs a corpus file with a non-default material #49).

docs/data/spec-coverage.tsv is unchanged: §20.4.104 stays partial until the R14 records decode in the crate itself. Its note ("Skipped as unmatched across the corpus") is wrong for R2000 to R2018 and is corrected with that state change.

Test plan

  • rustfmt --edition 2024 --check and cargo clippy --release --all-features --example probe_xrecord --example probe_material -- -D warnings clean; RUSTFLAGS="-D warnings" cargo build --release of both examples clean.
  • Run on the 19-file corpus (the 18 nextgis arc_/circle_/line_ files and sample_AC1032.dwg). No unit tests added.
$ cargo run --release --example probe_xrecord -- ../../samples/*.dwg
arc_2000.dwg (AC1015 (2000)): 57/57 close at delta 0, 57/57 chunk streams walk clean, 0 custom-class
arc_2004.dwg (AC1018 (2004)): 53/53 close at delta 0, 53/53 chunk streams walk clean, 0 custom-class
arc_2007.dwg (AC1021 (2007)): 47/47 close at delta 0, 47/47 chunk streams walk clean, 0 custom-class
arc_2010.dwg (AC1024 (2010)): 46/46 close at delta 0, 46/46 chunk streams walk clean, 0 custom-class
arc_2013.dwg (AC1027 (2013)): 22/22 close at delta 0, 22/22 chunk streams walk clean, 0 custom-class
arc_R14.dwg (AC1014 (R14)): 115/115 close at delta 0, 115/115 chunk streams walk clean, 115 custom-class
circle_2000.dwg (AC1015 (2000)): 57/57 close at delta 0, 57/57 chunk streams walk clean, 0 custom-class
circle_2004.dwg (AC1018 (2004)): 53/53 close at delta 0, 53/53 chunk streams walk clean, 0 custom-class
circle_2007.dwg (AC1021 (2007)): 47/47 close at delta 0, 47/47 chunk streams walk clean, 0 custom-class
circle_2010.dwg (AC1024 (2010)): 46/46 close at delta 0, 46/46 chunk streams walk clean, 0 custom-class
circle_2013.dwg (AC1027 (2013)): 22/22 close at delta 0, 22/22 chunk streams walk clean, 0 custom-class
circle_R14.dwg (AC1014 (R14)): 115/115 close at delta 0, 115/115 chunk streams walk clean, 115 custom-class
line_2000.dwg (AC1015 (2000)): 57/57 close at delta 0, 57/57 chunk streams walk clean, 0 custom-class
line_2004.dwg (AC1018 (2004)): 53/53 close at delta 0, 53/53 chunk streams walk clean, 0 custom-class
line_2007.dwg (AC1021 (2007)): 47/47 close at delta 0, 47/47 chunk streams walk clean, 0 custom-class
line_2010.dwg (AC1024 (2010)): 46/46 close at delta 0, 46/46 chunk streams walk clean, 0 custom-class
line_2013.dwg (AC1027 (2013)): 22/22 close at delta 0, 22/22 chunk streams walk clean, 0 custom-class
line_R14.dwg (AC1014 (R14)): 115/115 close at delta 0, 115/115 chunk streams walk clean, 115 custom-class
sample_AC1032.dwg (AC1032 (2018)): 97/97 close at delta 0, 97/97 chunk streams walk clean, 0 custom-class

Group codes per band (XR_CODES=1; arc_ files, circle_ and line_ are identical):

arc_2000.dwg codes: 1x29 2x2 3x2 4x1 6x1 7x1 8x1 9x1 40x2 41x1 42x1 70x2244 72x3 77x3 90x365 91x1 92x1 93x4 94x4 95x1 102x3049 140x120 141x1 142x1 148x3 149x6 171x3 175x3 179x3 270x18 271x18 273x3 280x289 282x3 298x1 300x4 301x1 302x1 303x1 304x1 305x1 306x1 307x1 308x1 309x1 330x1 340x1
arc_2004.dwg codes: 1x27 2x1 3x1 40x1 70x2235 72x3 77x3 90x364 91x1 92x1 93x4 94x4 95x1 102x3040 140x120 141x1 142x1 148x3 149x6 171x3 175x3 179x3 270x18 271x18 273x3 280x289 282x3 298x1 300x3 330x1 340x1
arc_2007.dwg codes: 1x26 70x2232 90x363 102x3029 140x120 270x18 271x18 280x288 298x1 300x3 330x1
arc_2010.dwg codes: 1x26 70x720 90x362 102x1517 140x120 270x18 271x18 280x288 298x1 300x3
arc_2013.dwg codes: 1x2 90x3 102x4 270x18 271x18 300x3 330x2
arc_R14.dwg codes: 1x82 2x51 3x2 4x1 6x1 7x1 8x1 9x1 10x15 40x3 41x1 42x1 70x2248 71x1 72x3 74x1 77x3 79x1 90x370 91x1 92x1 93x4 94x4 95x1 102x3073 140x120 141x1 142x1 146x1 148x3 149x6 171x3 175x3 179x3 270x18 271x18 273x3 280x289 281x1 282x3 298x1 300x4 301x1 302x1 303x1 304x1 305x1 306x1 307x1 308x1 309x1 310x1 330x1 340x11 1000x2 1002x4 1070x2
sample_AC1032.dwg codes: 1x27 10x12 11x1 41x1 42x1 43x1 44x1 45x1 46x1 47x1 48x1 49x1 50x1 51x1 52x1 53x1 62x18 70x25 71x8 90x38 91x2 92x3 93x1 94x1 95x1 96x1 102x2 270x60 271x78 272x8 273x8 290x9 291x4 292x22 293x8 294x1 300x175 301x12 302x3 303x1 310x3640 311x3983 330x20 331x14 340x7 360x2 361x2 370x14 420x4 440x14 460x8 461x8 462x8 463x8 464x8 469x106 1070x2 1071x13
$ cargo run --release --example probe_material -- ../../samples/arc_R14.dwg ... ../../samples/sample_AC1032.dwg 'TV,TV'
arc_R14.dwg          0x11    react=1 acds=0 budget=1340   delta=-1264   rest=[]
arc_R14.dwg          0x19    react=1 acds=0 budget=1340   delta=-1264   rest=[]
arc_R14.dwg          0x21    react=1 acds=0 budget=1332   delta=-1264   rest=[]
arc_2000.dwg         0x11    react=1 acds=0 budget=1340   delta=-1264   rest=[]
arc_2000.dwg         0x19    react=1 acds=0 budget=1340   delta=-1264   rest=[]
arc_2000.dwg         0x21    react=1 acds=0 budget=1332   delta=-1264   rest=[]
arc_2004.dwg         0x11    react=1 acds=0 budget=1340   delta=-1264   rest=[]
arc_2004.dwg         0x19    react=1 acds=0 budget=1340   delta=-1264   rest=[]
arc_2004.dwg         0x21    react=1 acds=0 budget=1332   delta=-1264   rest=[]
arc_2007.dwg         0x11    react=1 acds=0 budget=1284   delta=-1284   rest=[]
arc_2007.dwg         0x19    react=1 acds=0 budget=1284   delta=-1284   rest=[]
arc_2007.dwg         0x21    react=1 acds=0 budget=1284   delta=-1284   rest=[]
arc_2010.dwg         0x11    react=1 acds=0 budget=1284   delta=-1284   rest=[]
arc_2010.dwg         0x19    react=1 acds=0 budget=1284   delta=-1284   rest=[]
arc_2010.dwg         0x21    react=1 acds=0 budget=1284   delta=-1284   rest=[]
sample_AC1032.dwg    0x96    react=1 acds=0 budget=516    delta=-516    rest=["", "", "", "", ""]
sample_AC1032.dwg    0x97    react=1 acds=0 budget=516    delta=-516    rest=["", "", "", "", ""]
sample_AC1032.dwg    0x98    react=1 acds=0 budget=1028   delta=-1028   rest=["", "", "", "", ""]
sample_AC1032.dwg    0xDAA   react=1 acds=0 budget=554    delta=-554    rest=["", ""]
sample_AC1032.dwg    0xDB6   react=1 acds=0 budget=1066   delta=-1066   rest=[texture-map paths]
sample_AC1032.dwg    0xDC0   react=1 acds=0 budget=946    delta=-946    rest=[texture-map paths]
sample_AC1032.dwg    0xDCA   react=1 acds=0 budget=1130   delta=-1130   rest=[texture-map paths]
sample_AC1032.dwg    0xDD4   react=1 acds=0 budget=1130   delta=-1130   rest=[texture-map paths]
sample_AC1032.dwg    0xDDE   react=1 acds=0 budget=1066   delta=-1066   rest=[texture-map paths]
sample_AC1032.dwg    0xDE8   react=1 acds=0 budget=874    delta=-874    rest=[texture-map paths]
sample_AC1032.dwg    0xDF2   react=1 acds=0 budget=738    delta=-738    rest=[]
0/26 MATERIAL records close at delta 0

The same run with no spec over all 19 files prints 65 records with the budgets in the table of the module doc (0/65 MATERIAL records close at delta 0, as an empty spec must). MAT_BD=1 on arc_2010.dwg finds 1/48 at bits 46, 120, 250, 324, 510, 584, 706, 780, 900, 974, 1096 and 1170, the offsets src/objects/acad_material.rs documents.

Changes from the stranded originals: the module docs (what each proves, measured table, how to verify), the MATERIAL probe's §19.4.2 citation corrected to §20.1, and an unused cursor removed from its MAT_BD scan. Output is byte-identical before and after.

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.1, §20.3 and §20.4.104 of the ODA's freely-redistributable Open Design Specification for .dwg files (v5.4.1), which says the XRECORD indicator numbers "follow the normal AutoCAD DXF convention for group codes", and on the corpus bytes. The code-to-width table follows that convention; the widths marked (measured) are the ones that make every body walk clean. 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.

…a-field budget

probe_xrecord measures the §20.4.104 field list and the group-code body on every XRECORD record, fixed type 0x4F or class: all 1117 records of the 19-file corpus close at delta 0 and their bodies walk clean. R14 carries XRECORD as a class, so its 345 records reach the dispatcher as custom-class objects and count as unhandled although the existing field list closes on them. R13 to R2004 body strings take an RS length, not the RC length §20.4.104 prints.

probe_material reports each MATERIAL record's data-field budget and tests a candidate field list against all 65 records at once. It derives no field list: only the R2018 file holds a material that is not a default (#49).
@DrunkOnJava DrunkOnJava added type:spec Implements or verifies a numbered section of ODA spec v5.4.1 area:objects Common object formats and non-graphical objects (§20.1 to §20.3, §20.4 objects, §28) labels Oct 26, 2026
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 26, 2026 08:53
@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:32:59.647948Z 1e09d4f 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.

@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 26, 2026 10:31
@DrunkOnJava
DrunkOnJava merged commit c9181e9 into main Oct 26, 2026
25 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/probe-xrecord-material branch October 26, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:objects Common object formats and non-graphical objects (§20.1 to §20.3, §20.4 objects, §28) type:spec Implements or verifies a numbered section of ODA spec v5.4.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant