Skip to content

feat(objects): decode SORTENTSTABLE from §20.4.93 (#149) - #307

Merged
DrunkOnJava merged 6 commits into
mainfrom
obj/sortents-table
Oct 26, 2026
Merged

DrunkOnJava merged 6 commits into
mainfrom
obj/sortents-table

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Decode SORTENTSTABLE (§20.4.93): BL numentries and that many sort handles, typed H but written with handle code 0 in the main bit stream, the one handle a non-entity object keeps in its data stream. The dispatcher had no class-name arm for it, so all 27 corpus records were skipped on every release.

Spec reference

§20.4.93 SORTENTSTABLE (tracking #149). The spec's field list closes as printed. A sort handle whose code is not 0 would be an offset from the record's own handle and is refused rather than read as a handle; the entity each sort handle orders is in the handle stream and is not read.

Test plan

  • cargo fmt --all -- --check and cargo clippy --all-targets --all-features -- -D warnings pass on this branch. cargo test, cargo doc and the 1.85 MSRV check run once on a merge of this lane's open branches instead of per branch (the machine is at memory pressure red); the result goes in a comment.

  • Shown on real files, no new unit tests: cargo run --release --example probe_sortentstable -- <corpus> over the 52 pinned drawings. It closes on the boundary and compares the entry count and every sort handle with AutoCAD's DXF export by handle (the DXF writes each entry as group 331, the entity, then a further group 5, the sort handle).

    Release Records Close Values compared with the DXF Differ
    R14 3 3 no twin (boundary only)
    R2000 3 3 11 0
    R2004 3 3 11 0
    R2007 3 3 11 0
    R2010 3 3 11 0
    R2013 3 3 11 0
    R2018 9 9 11 0
  • Corpus baseline regenerated: decoded +27, skipped -27, errored unchanged (8 rows).

  • Tests touched: none. examples/probe_sortentstable.rs and the shared harness examples/support/twin.rs are new examples, not tests.

  • The DXF oracle does not score SORTENTSTABLE yet.

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 (v5.4.1, sha256 973628f3…f504b) is explicitly allowed (see CLEANROOM.md).
  • No GPL-licensed DWG implementation source (LibreDWG, etc.) was consulted or imported.

My contribution is based on:

  • The ODA's freely-redistributable Open Design Specification for .dwg files (v5.4.1);
  • The corpus bytes and AutoCAD's own DXF exports of the pinned drawings (the oracle);
  • No reading of comments or code in any other project.

Developer Certificate of Origin

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

The draw-order table is a BL entry count and that many code-0 sort handles
in the data stream. The dispatcher had no class-name arm for it, so all 27
records of the corpus were skipped; all 27 close on their data-stream
boundary from R14 to R2018.

Against AutoCAD's DXF export (R2000 to R2018) the entry count and every sort
handle of the 24 records with a twin equal it: 66 values, none differing.
@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-26T21:10:31.917855Z 6fe40e6 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.

…in the list sits apart from its siblings' (rustfmt sorts the list)
# Conflicts:
#	ARCHITECTURE.md
#	docs/spec-coverage.md
#	tools/corpus/baseline.tsv
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 26, 2026 21:11
@DrunkOnJava
DrunkOnJava merged commit 96015a1 into main Oct 26, 2026
26 checks passed
@DrunkOnJava
DrunkOnJava deleted the obj/sortents-table branch October 26, 2026 21:16
DrunkOnJava added a commit that referenced this pull request Oct 26, 2026
The SORTENTSTABLE decoder (#307) reads §20.4.93's BL entry count and
that many sort handles, handle code 0 in the data stream. The DXF writes
each entry as 331 (the entity, a handle of the handle stream the decoder
does not read) then 5 (the sort handle), after the record's own 5. The
oracle compares the entry count with the number of those 5 groups and
each sort handle with the next one, all entries under one field, and
files the class under §20.4.93.

On the 49 drawing pairs: 18 records, R2000 to R2018 (three per
release), all 66 values equal the export, the 66 the decoder's probe
reports. tools/oracle/baseline.tsv gains the 12 new rows, and the
§20.4.93 row of docs/spec-coverage.md says what the oracle measured.

Refs #99, #102, #149
DrunkOnJava added a commit that referenced this pull request Oct 26, 2026
The SORTENTSTABLE decoder (#307) reads §20.4.93's BL entry count and
that many sort handles, handle code 0 in the data stream. The DXF writes
each entry as 331 (the entity, a handle of the handle stream the decoder
does not read) then 5 (the sort handle), after the record's own 5. The
oracle compares the entry count with the number of those 5 groups and
each sort handle with the next one, all entries under one field, and
files the class under §20.4.93.

On the 49 drawing pairs: 18 records, R2000 to R2018 (three per
release), all 66 values equal the export, the 66 the decoder's probe
reports. tools/oracle/baseline.tsv gains the 12 new rows, and the
§20.4.93 row of docs/spec-coverage.md says what the oracle measured. That
row's probe sentence said the export equals "the 24 R2000 to R2018
records"; the probe compares 18, and the other 6 R2018 records are
export_sample.dwg's, which has no DXF twin.

Refs #99, #102, #149
DrunkOnJava added a commit that referenced this pull request Oct 27, 2026
The SORTENTSTABLE decoder (#307) reads §20.4.93's BL entry count and
that many sort handles, handle code 0 in the data stream. The DXF writes
each entry as 331 (the entity, a handle of the handle stream the decoder
does not read) then 5 (the sort handle), after the record's own 5. The
oracle compares the entry count with the number of those 5 groups and
each sort handle with the next one, all entries under one field, and
files the class under §20.4.93.

On the 49 drawing pairs: 18 records, R2000 to R2018 (three per
release), all 66 values equal the export, the 66 the decoder's probe
reports. tools/oracle/baseline.tsv gains the 12 new rows, and the
§20.4.93 row of docs/spec-coverage.md says what the oracle measured. That
row's probe sentence said the export equals "the 24 R2000 to R2018
records"; the probe compares 18, and the other 6 R2018 records are
export_sample.dwg's, which has no DXF twin.

Refs #99, #102, #149
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