Repository navigation
fix(tables): read the BL reactor count in the R2007+ table-entry prefix (#40) - #293
Merged
Merged
Conversation
…ix (#40) tables::modern skipped the BL num_reactors that §20.4.x prints and objects::modern reads, and compensated with a release-dependent flag order and an RC after the R2013+ binary-data bit. With no reactors the shifted reads consumed the same bits, so records closed with the xdictionary bit in their 64-flag; with reactors the six R2007/R2010 DIMSTYLE records failed. Read the BL, drop the RC, and read the two bits that remain as B 64-flag, B Xdep. examples/probe_table_prefix.rs compares the prefix with AutoCAD's DXF export: reactor counts, xdictionary bits, Xdep and inline names agree on every table entry of the 32 R2000-R2018 drawings with a twin.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Oct 26, 2026
# Conflicts: # ARCHITECTURE.md # docs/data/spec-coverage.tsv # docs/spec-coverage.md # tools/corpus/baseline.tsv
DrunkOnJava
enabled auto-merge (squash)
October 26, 2026 17:24
DrunkOnJava
added a commit
that referenced
this pull request
Oct 26, 2026
Three more types are compared field by field with AutoCAD's export: MLEADERSTYLE (§20.4.87) and VIEW (§20.4.60) against their spec's DXF column, and VISUALSTYLE, which v5.4.1 does not prescribe, against the DXF Reference's group for each named property. On the 49 drawing pairs: MLEADERSTYLE's 49 records R2000-R2018 agree on every decoded value (1914 equal, 36 by the DXF default). VISUALSTYLE's 1,008 records agree on 58,104 values and disagree on 264, all filed on issue 250: format_version on R2013 and R2018 (DWG 2, export 3) and Realistic's face lighting quality on R2000-R2007 (DWG 2, export 3). VIEW's 6 records agree on every decoded value (120 equal), the R2013 and R2018 Xdep bit included since #293. Before #251 and #253 these scorers found 1,440 VISUALSTYLE values and MLEADERSTYLE's two swapped flags wrong. tools/oracle/baseline.tsv gains the 789 new rows; VIEW and MLEADERSTYLE in docs/spec-coverage.md say what was measured, and VIEW no longer lists the pre-R2007 errors #263 fixed. CLEANROOM records the scorers' sources. Refs #99, #102, #250, #256
This was referenced Oct 26, 2026
DrunkOnJava
added a commit
that referenced
this pull request
Oct 26, 2026
…le (#279) Three more types are compared field by field with AutoCAD's export: MLEADERSTYLE (§20.4.87) and VIEW (§20.4.60) against their spec's DXF column, and VISUALSTYLE, which v5.4.1 does not prescribe, against the DXF Reference's group for each named property. On the 49 drawing pairs: MLEADERSTYLE's 49 records R2000-R2018 agree on every decoded value (1914 equal, 36 by the DXF default). VISUALSTYLE's 1,008 records agree on 58,104 values and disagree on 264, all filed on issue 250: format_version on R2013 and R2018 (DWG 2, export 3) and Realistic's face lighting quality on R2000-R2007 (DWG 2, export 3). VIEW's 6 records agree on every decoded value (120 equal), the R2013 and R2018 Xdep bit included since #293. Before #251 and #253 these scorers found 1,440 VISUALSTYLE values and MLEADERSTYLE's two swapped flags wrong. tools/oracle/baseline.tsv gains the 789 new rows; VIEW and MLEADERSTYLE in docs/spec-coverage.md say what was measured, and VIEW no longer lists the pre-R2007 errors #263 fixed. CLEANROOM records the scorers' sources. Refs #99, #102, #250, #256
4 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Oct 26, 2026
§20.4.60 stores VIEW's view mode as four bits, "0: 71's bit 0 (1), 1: 71's bit 1 (2), 2: 71's bit 2 (4), 3: OPPOSITE of 71's bit 4 (16)", and notes that bit 3 (8) of group 71 "can not be specified". Both VIEW paths surfaced the raw bits; they now surface the group-71 value through the conversion VPORT uses (§20.4.64, #238), with no UCSFOLLOW bit. The DXF value oracle compares ViewEntry::view_mode with group 71 directly now, instead of converting the stored bits in its scorer: equal on all 6 VIEW records, R2000 to R2018. Its baseline row is renamed from "view_mode (stored bits, as group 71)" to "view_mode". The two VIEW round-trip tests write the bits 0001, whose group-71 value is 0. Closes #256 (with #263, #279 and #293, every decoded VIEW value now equals the export).
DrunkOnJava
added a commit
that referenced
this pull request
Oct 26, 2026
§20.4.60 stores VIEW's view mode as four bits, "0: 71's bit 0 (1), 1: 71's bit 1 (2), 2: 71's bit 2 (4), 3: OPPOSITE of 71's bit 4 (16)", and notes that bit 3 (8) of group 71 "can not be specified". Both VIEW paths surfaced the raw bits; they now surface the group-71 value through the conversion VPORT uses (§20.4.64, #238), with no UCSFOLLOW bit. The DXF value oracle compares ViewEntry::view_mode with group 71 directly now, instead of converting the stored bits in its scorer: equal on all 6 VIEW records, R2000 to R2018. Its baseline row is renamed from "view_mode (stored bits, as group 71)" to "view_mode". The two VIEW round-trip tests write the bits 0001, whose group-71 value is 0. Closes #256 (with #263, #279 and #293, every decoded VIEW value now equals the export).
DrunkOnJava
added a commit
that referenced
this pull request
Oct 28, 2026
…d say what measured them (#140, #147, #148, #133, #127) (#398) Seven rows leave partial for closes because no record of any kind errors on the 52 drawings of run 40532346172 and the errors their notes still quote were fixed: TEXT, ATTRIB, ATTDEF (#258), MTEXT (#261), VIEW (#263, #284), DIMSTYLE (#293) and HATCH (#264, the R14 records routed). §22 AcDb:Template goes from missing to partial: dxf_header reads $MEASUREMENT from it (#320). §9 stays closes, now tracked by #127 (R13) and carrying the per-release evidence behind closing #128, #129 and #130. The page's Last measured line and the paragraph that said closes came from a local 19-file corpus are updated.
DrunkOnJava
added a commit
that referenced
this pull request
Oct 28, 2026
…ain run (#195) (#401) * docs(spec-coverage): move the rows the 2026-10-27 main run proves, and say what measured them (#140, #147, #148, #133, #127) Seven rows leave partial for closes because no record of any kind errors on the 52 drawings of run 40532346172 and the errors their notes still quote were fixed: TEXT, ATTRIB, ATTDEF (#258), MTEXT (#261), VIEW (#263, #284), DIMSTYLE (#293) and HATCH (#264, the R14 records routed). §22 AcDb:Template goes from missing to partial: dxf_header reads $MEASUREMENT from it (#320). §9 stays closes, now tracked by #127 (R13) and carrying the per-release evidence behind closing #128, #129 and #130. The page's Last measured line and the paragraph that said closes came from a local 19-file corpus are updated. * docs(criteria): re-measure the 1.0 requirements from the 2026-10-27 main run (#195) Header, R2, R3, R4, R8, X1 and S3 now carry what run 40542129639 (main 61255e9) and docs/data/spec-coverage.tsv say: 52 drawings with 0 errored records and 533 skipped, 53 sections scored by the DXF oracle with 22 values disagreeing, 90 closes, 13 partial, 6 decoder and 29 missing rows, a wasm32 compile of the library in the Clippy job. X1 (DXF) moves from not measured to failed: the HEADER, TABLES, ENTITIES and BLOCKS probes pair the written records with AutoCAD's export and find 0 groups disagreeing, and 342 entity records of 18 kinds and the OBJECTS section are not written. No other status changes. * docs(criteria): R3 counts the rows #398 moves: 97 closes, 7 partial, 6 decoder, 28 missing (#195) The counts are those of docs/data/spec-coverage.tsv with #398, whose moves run 40532346172 proves.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Read the
BL num_reactorsthat §20.4.x prints in every table entry's common data.tables::modern, the R2007+ path, skipped it and compensated in two ways: a flag order that changed with the release, and on R2013+ anRCafter a set binary-data bit. On entries with no reactors the shifted reads used the same bits, so the records closed, but with the xdictionary bit in their 64-flag. On entries with reactors they failed: the six R2007/R2010 DIMSTYLE errors #228 lists. They now close, and every value the new probe compares equals AutoCAD's DXF export.Closes #40. Closes #35. Part of #228 (DIMSTYLE; HATCH is next, VIEW belongs to the oracle lane). Opens #290 for the one question the corpus can't answer.
Spec reference
§20.4.x common table-entry data (for example §20.4.54 LAYER, p. 161), R2000+:
EED,BL Numreactors,B XDic Missing Flag(R2004+), plus the §20.1Bfor AcDs binary data (R2013+). ThenTV name, B 64-flag, BS xrefindex+1, B Xdep.skip_object_prefixnow reads that prefix, whichobjects::modernreads for every other non-entity object, and reads noRCafter the binary-data bit. From R2007 the name is in the string stream and two bits remain on every table entry, soread_entry_flagsreads them asB 64-flag, B Xdepand returnsxrefindex+1as 0.What the old reading took each bit for:
1 0BL01 0BS xrefindex+101 0BL01 0BS xrefindex+10A reactor count above 0 is the code
01plus a byte. On R2013+ the old reading took the01for its two flags and the byte for itsRC; that is where the "8 more bits after the AcDs flag" in ARCHITECTURE §7a came from (8 and 2 are the reactor counts). On R2007/R2010 nothing absorbed the byte, so the three DIMSTYLE records with reactors failed:ISO-250x39Awith 8,custom_dim_style0x994with 2, andcustom_style_ltypes0xC88with 1.Every table entry of the 52 drawings
Each table entry of every pinned drawing, decoded through
entities::decode_from_raw(closed on its data-stream boundary). "skipped" means the dispatcher has no decoder for the record:On main the R2007 and R2010 DIMSTYLE cells read 17 + 3 err. Every R2000-R2018 table entry now closes. The 20 R14 DIMSTYLE records are skipped: the dispatcher has no R13/R14 DIMSTYLE decoder yet (#74), and this PR does not touch that path.
Measured against AutoCAD's DXF
examples/probe_table_prefix.rs(new) reads the prefix and flags of every table entry and matches each one by handle to the twin's record. Over the 32 R2000-R2018 drawings of the public corpus that have a twin there are 1,078 table entries, 1,020 of them with a twin record:BL num_reactors= the330s in{ACAD_REACTORS(18 non-zero){ACAD_XDICTIONARY(53 present)The xdictionary bit sits two bits after the
BL, so its agreement on all 53 entries that have an xdictionary pins theBL's position independently of the reactor counts. Three twins carry an xdictionary the drawing doesn't have. LTYPEGAS_LINE0x6B2in the R2004, R2007 and R2010 exports points at dictionary0x1455, anACAD_XREC_ROUNDTRIPholding anACAD_ROUNDTRIP_2011_LINETYPExrecord. That dictionary isn't an object of those DWGs and isn't in the R2013 export, so the export adds it when writing an older release. The DWG bit says "missing" on all three, and the probe counts them apart rather than as differences.All 676 R2007-R2018 entries read the two flag bits as
1, 0. All 402 R2000/R2004 entries read 64-flag set,xrefindex+10 and Xdep clear. That settles #35's labelling question for the inline path: if the first inline bit were Xdep it would be set on all 402 entries, and group 70 bit 16 is clear on every one. For R2007+ the export rules out the swapped order the same way. A loneBS xrefindex+1of 0, though, is the same two bits1 0, and neither corpus has an xref-dependent entry to tell them apart. That is #290.The six DIMSTYLE records decode to the same values on R2004, R2007, R2010, R2013 and R2018, in all fifteen fields
DimStyleEntrysurfaces.ISO-25's ten non-default groups in the R2007 export (412.5,420.625,441.25,730,740,771,1402.5,1412.5,1430.03937007874016,2830) equal the decoded values. The styles the export writes no overrides for decode to the defaults.Each run ends
RESULT: every compared value equals the twin, and the probe exits non-zero on any difference.Values change on decoded records too: R2007+ entries that have an xdictionary used to report
flag_64 = false, and now reporttrue, as their R2000/R2004 saves do. Any oracle score of the table flags (#248/#277) moves with that.Coverage,
../../samplesUnchanged, TOTAL 4256 / 180 / 9. The two reactor-bearing DIMSTYLEs of
sample_AC1032.dwgclosed before through theRC, and the nextgis drawings' table entries have no reactors.Public corpus:
tools/corpus/baseline.tsv(regenerated, committed)52-file total: 14938 / 831 / 305 → 14944 / 831 / 299. Measured against main at 59154b4. #283 (ACIS) moves the same two rows by 3 decoded each, for different records, and both apply; the merge train regenerates the baseline.
measure.py checkpasses. The spec worked examples (spec_examples --update) are unchanged, since they are R14 records on the inline path.Class census and reference closure
Unchanged on all 19 files of
../../samplesand in the baseline's census and closure columns.Docs
docs/data/spec-coverage.tsv: the §20.1 note, and the §20.4.68 note loses the VIEW, DIMSTYLE, 3DSOLID, REGION and HATCH error on some releases of the public corpus #228 errors (it stayspartialfor R14 DIMSTYLE block order (§20.4.68) unmeasured — 6 records #74).docs/spec-coverage.mdregenerated.BS xrefindex+1.read_entry_flagsloses its unusedversionparameter.Test plan
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningsRUSTFLAGS="-D warnings" cargo test --release --all-features(real-file tests ran against../../samples)RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-featurestools/corpus/measure.py checkpasses against the committed baselinecargo run --release --example spec_examples -- --updateleaves the fixtures unchangedappid,block_record,dimstyle,layer,ltype,style,ucs,viewandvporttests wrote the disproven prefix (B, B, B, B, BS). They now write the measured one:BL 0, then xdictionary, binary data, 64-flag and Xdep bits, with noBS. Onlyblock_record's failed, because it wroteBS 1. The other eight wroteBS 0, which happens to be the same bits.block_record::tests::r2007_split_stream_block_record_reads_name_from_string_streamassertedxref_index_plus_1 == 1, which came from thatBS. It now asserts 0.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:
CLEANROOM.md).My contribution is based on §20.1 and the §20.4.x table sections of the ODA's freely-redistributable Open Design Specification for .dwg files (v5.4.1), including their DXF group codes. It also uses the corpus bytes and AutoCAD's DXF exports of the same drawings, read as data files (ACadSharp
samples/atc30a97ce, MIT, and nextgis/dwg_samples, pinned by #225). 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.