Skip to content

docs: the record types three R13 sets hold, and the ones still unmeasured (#119) - #356

Open
DrunkOnJava wants to merge 49 commits into
mainfrom
docs/r13-type-census
Open

DrunkOnJava wants to merge 49 commits into
mainfrom
docs/r13-type-census

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

The R13 type census (#119's acceptance: "every §20.4 decoder's R13 branch exercised or listed as unmeasured"): which of the §20.4 record types three sets of real R13 drawings hold, how each decodes, and which fixed-code types none of them holds. Documentation only (ARCHITECTURE.md §7aw and spec-coverage notes); the probe it runs, probe_r13_census, is in #355. Stacked on #355 (and so on #323): the diff of this PR alone is its last commit.

Spec reference

ODA v5.4.1 §20.4 (the object type table and every fixed-code section up to MLINESTYLE, 0x49). No state changes in docs/spec-coverage.md: 60 sections gain their R13 record counts and 5 are marked not measured on R13.

Evidence

probe_r13_census over three sets, with #355's decoders:

Set Drawings Records Types Errored No decoder
the 22 pinned (Cabin.dwg and 21 Sovol3d, none AutoCAD-written) 22 27,714 48 0 SUN 21
US Forest Service R6 library (public domain; to be pinned), lower-cased copies 122 345,236 47 0 VP_ENT_HDR 104
Autodesk's own R13 discs (68 distinct drawings; local evidence only, never fetched or committed) 68 110,788 49 0 VP_ENT_HDR 52, a custom OBJECT_PTR 3, MINSERT 2

62 types in the union. Unmeasured on R13 (fixed-code types no set holds): DIMENSION (ORDINATE), DIMENSION (ANGULAR, 3-PT), SHAPE (no decoder), REGION and BODY (3DSOLID is measured), RAY, XLINE and MLINE. The two AutoCAD-written sets are what measures TEXT, VIEWPORT, TRACE, ELLIPSE, GROUP, UCS, VIEW, 3DSOLID and the 3D polyline and vertex types on R13 at all.

One gap this exposes: MINSERT has a section (§20.4.10) and a decoder row in the coverage page, but no dispatch arm routes it, so the walk skips it (2 records on the discs; none in the pinned corpus, which is why the row said "No MINSERT in the corpus"). Not fixed here.

Reproduce:

python3 -I tools/corpus/fetch.py --dest ../dwg-corpus
cargo build --release --features dxf-reader --example probe_r13_census
target/release/examples/probe_r13_census ../dwg-corpus/sketchup/Cabin.dwg ../dwg-corpus/sovol/*.dwg

(The other two sets: the same command on lower-cased copies of the Forest Service drawings once they are pinned, and on the disc drawings, whose per-drawing sha256s are in docs/data/r13-autodesk-discs.tsv.)

Test plan

  • python3 tools/ci/spec_coverage.py --check and python3 tools/maintainer/train/arch.py check
  • Documentation only; the counts above come from the probe on real drawings.

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 (sha256 973628f3...504b) is explicitly allowed (see CLEANROOM.md).
  • No GPL-licensed DWG implementation source (LibreDWG, or any copy of its example files) was consulted or imported.

My contribution is documentation based on the ODA's specification and on counts read from public drawings through this crate's own probe; the Autodesk disc drawings were read as data files only.

Developer Certificate of Origin

I affirm that the contribution complies with the Developer Certificate of Origin 1.1.

… R13-R15 container (#119)

R13 shares the flat section-locator container, the unframed object stream
and the R13-R14 branches of the entity and object prologues with R14, so
every test the crate wrote as 'is R14' for one of those branches becomes
is_r13_r14().
…es, so its size field reaches 2034 (#213)

The walk refused any chunk whose size field passed 2032. That rejected 7
of 22 real R13 drawings and the AutoCAD-saved R14 and R2000 drawings of
ACadSharp, which hold chunks of 2033 and 2034 bytes. The streaming E2E
now walks one of each against an independent framing parse and the
legacy reader.
…§2.10)

The helpers read the R2000+ flag-then-value forms on every release, which
only agrees with the R13-R14 form when thickness is 0 and the extrusion is
(0,0,1). Measured on Cabin.dwg: 18 LINE and 2 POLYLINE_2D records with a
non-default thickness or extrusion now end exactly on their RL boundary.
The synthetic R14 LINE of tests/integration_legacy_container.rs wrote the
one-bit defaults the old reader assumed; it writes the BD and 3BD §2.8 and
§2.10 print.
§20.4.44 prints 'R14 Only' for the RC after Numitems; R13 writes nothing
there. 88 R13 DICTIONARY records missed their RL boundary (by 8 bits
when the dictionary is empty).
…over the R13-R14 branches added since (#119)

header_vars.rs matched Version exhaustively, so the R13 variant needs its
own arm: the table already carries the R13 rows. MTEXT's and LWPOLYLINE's
R13-R14 branches (#261, #264) were written as 'is R14'. Cabin.dwg's 195
header slots end on the stated size; the probe also reports the 21 Sovol
headers, which hold 84 bits more than any table reads.
, #119)

The 21 Sovol R13 drawings write the four 'R14+' unknown shorts of §9 (each
-1; §9 says they 'do not seem to be required') after the R13 slots, and size
the header one byte past the byte holding the last slot, so the R13 rows
left 84 bits and the Corpus job's header probe failed on them. An AC1012
header whose R13 rows leave a whole byte or more is now read with the R14
rows and may end one byte before its data; Cabin.dwg and every other release
read as before. All 22 R13 headers, 199 slots on the Sovol drawings, now
decode to the stated size.
… header-variable failure (#119)

The header-variable arm printed FAIL without setting the exit status, so a
drawing that passed the framing checks but did not decode to its stated end
reported success. Every failure line now goes through one emit that sets it,
including a file that fails to open and a missing object map or header.
Conflicts: ARCHITECTURE.md (the R13 section is 7ac, after main's 7ab),
docs/data/spec-coverage.tsv and docs/spec-coverage.md (my row notes appended
to main's, §3 and §23 kept), src/entities/dispatch.rs (main's R13/R14
DIMSTYLE arm kept as main wrote it; the BT/BE decode_for routing kept), and
tools/corpus/baseline.tsv regenerated: main's rows unchanged, 22 R13 rows
added.
…LE and LEADER (#119)

TEXT (and so ATTRIB and ATTDEF), VIEWPORT, the R13/R14 DIMSTYLE block and
LEADER tested the R13-R14 branch as Version::R14 only, so every R13 record
of ATTRIB, ATTDEF, DIMSTYLE and LEADER took the R2000+ field list and
missed its boundary: 439 errored records across the 22 R13 drawings, none
on any other release.

LEADER's Endptproj is "R14+" in section 20.4.47: R13 skips it and the
field is the zero vector there. Read on R13, none of the 42 Sovol LEADERs
closes; skipped, all 42 do.
… the R14 files (#119)

baseline.tsv: the decoded and errored columns of the 22 R13 rows, nothing
else. ARCHITECTURE.md 7ad, spec-coverage notes for 20.4.3, 20.4.4, 20.4.5,
20.4.38, 20.4.47 and 20.4.68.
…R14 (#119)

#320 matched Version exhaustively; the AC1012 variant it was written
without made clippy --all-targets fail on the merged tree.
…riters (#119, #345)

Autodesk's own R13 discs pad 0000 in 196 of 263 headers and 1111 in 6.
What holds on every AutoCAD-written header: 195 slots, a section of exactly
ceil(bits / 8), three or four locators and a real preview. The Sovol files
are not AutoCAD's on the extra header byte, the blank preview and the
R2007+ SUN object. The byte after 18 in section 26's tail varies on
Autodesk's own files, so Cabin's 18 30 is not evidence against AutoCAD.
…cator layout still waits for Autodesk's discs (#345)
…sha256 and what was read (#119, #345)

Griffin decided on 2026-10-26 that these drawings are measured and cited,
never pinned, fetched by CI or committed. docs/data/r13-autodesk-discs.tsv
has one row per distinct drawing; the ARCHITECTURE section cites the 3- and
4-locator layouts, the 195-slot ceil(bits / 8) header, the padding spread and
the real previews from it.
…does (#119)

trace::decode never took the version, so TRACE kept the R2000+ flag-then-
value forms of thickness and extrusion on R13 and R14: the 3 TRACE records
of the US Forest Service R13 drawings errored. SOLID got decode_for in the
R13 reader; TRACE shares SOLID's stream (section 20.4.36) and takes it too.
…ured (#119)

ARCHITECTURE.md 7al: 62 types over the 22 pinned drawings, the 122 US Forest
Service drawings and Autodesk's 68 distinct disc drawings (local evidence);
none errors; the fixed-code section 20.4 types no set holds are listed as
unmeasured. spec-coverage notes: 60 sections gain their R13 record counts, 5
are marked not measured. No state changes.
@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-27T19:07:53.094058Z 5062a84 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.

…ies and probe_dxf_tables map R13 to no DXF writer, as R14 (#119)

Main matches Version exhaustively in the three probes, so clippy
--all-targets does not compile them once Version::R13 exists.
dxf_entities::writes, the layer and VPORT guards of dxf_tables, entity_refs
and DIMSTYLE's decode_with_vars tested Version::R14 alone where the comment
says R13 and R14. Not measured: they act only when an R13 drawing is
converted to DXF, and none has a DXF twin.
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
* fix(ci): hold a stacked PR until the older PR it builds on lands

A PR stacked on an older open PR targets main but holds that PR's commits. When the train held the
older PR on a review thread it went on to the next one: landed first, that PR would have carried the
older one's work into main under its own title (#337 over #335, #339 over #337 were drafted by hand
to stop it), and its refresh merged main over the older PR's commits, so after that PR landed its
merge base no longer applied and a lane had to merge it by hand. The train now sends such a PR to
the end of the queue while an older open PR (a lower number) shares commits with it that main does
not have. On the queue of 2026-10-28: #324 waits for #323, #355 for #324, #356 for #355, #410 for
#356, #412 for #410, #339 for #337 and #341 for #339; #323, #337, #389 and #296 wait for nothing.

* fix(ci): check every open PR, skip landed work, and defer on a failed lookup

The stack check listed at most 200 open PRs, only those targeting main, treated any shared commit as
outstanding even when it belonged to a PR that had already landed by squash, and let a PR through
when a fetch or gh call failed. It now fetches every PR head to refs/train/pr/<n> in the main clone,
pages through all open PRs whatever they target, ignores a shared commit that a merged PR's head
holds, and returns 2 on any failed lookup, which sends the PR to the end of the queue. Checked in a
scratch repository (two PRs built on a landed PR do not wait for each other; a PR built on another
waits for it; a failing gh returns 2) and on the live queue, where the R13 and unp stacks give the
same order as before.

* fix(ci): count only PRs merged into main as landed when checking a stack

A PR merged into a feature branch has merged_at set too, so its commits were treated as landed and a
newer PR holding them went ahead of the open PR they were waiting in. The exemption now takes only
PRs whose base is main. All 187 merged PRs so far target main, so the live order is unchanged.

This branch has not been deployed

No deployments
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