Repository navigation
feat(objects): R13 and R14 reference closure from the RL inside the common data (#84), stacked on #323 - #324
DrunkOnJava wants to merge 42 commits into
Conversation
… 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.
…e common data (#84) The walk's reference closure skipped every R13 and R14 record, because nothing in the prologue states where the data stream ends. §20.1 and §20.4.1 put the RL after the EED chain (objects) or the graphics block (entities); r13_r14_data_end reads it, and a record of a custom class is told apart by its class's item class id (§10.1: 0x1F2 entity, 0x1F3 object), which the walker now takes from the class table.
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. |
…er's R13, not AutoCAD's format (#119)
… 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.
…14-reference-closure
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.
…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.
…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.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: edf032c605
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| sketchup SketchUp/sketchup-developer-tools 06e7d5f1690a85bdccebaec8e3c652b91a538ba2 src/sketchup-developer-tools/testup/tests/functional_tests/TC_importers_sanity/Cabin.dwg Apache-2.0 not recorded AC1012 dwg 222587 ade8a9fc56ac23b0a36fb49dcc3cc98e3eb81469bbfee12c283d2027e0126443 e5c92fce5f2f045541a4eff5f3efb616bafb8714 - no | ||
| sovol Sovol3d/SOVOL-ZERO d745b00b87eab492a1917b6f16550f740fa1cffe PDF/钣金/JXHMP4602-11083-b 铁片.dwg none stated not recorded AC1012 dwg 55112 39b3842f531dc1e1e90c9e57e90f49fa90e46900f7852682820539e1d3a02609 43ee35e1004fbca5da7c10dcb46b89e73a2812b6 - no |
There was a problem hiding this comment.
Commit the regenerated corpus baseline
When the corpus is available, the required Corpus (public DWG) job will fail: these additions bring the pinned drawings to 74, but tools/corpus/baseline.tsv still contains only 52 rows, with none of the 22 new R13 drawings. The existing R14 rows also retain refs = 0 and nonzero no_boundary counts despite the new reference decoding. In .github/workflows/ci.yml, the measurement step invokes measure.py check, whose check() rejects both new rows and changed counts, including improvements. Regenerate the baseline from the full corpus measurement and commit it with this change, as required by the repository guidance. CLAUDE.mdL75-L75
Useful? React with 👍 / 👎.
| return Err(Error::NotDwg { got: *magic }); | ||
| } | ||
| Ok(match magic { | ||
| b"AC1012" => Self::R13, |
There was a problem hiding this comment.
Keep R13 conversions on the primitive DXF exporter
For an AC1012 drawing with a closed header and decoded layers, conversion to R2000-or-later DXF now succeeds but drops all geometry. Adding Version::R13 makes dxf_entities::writes() return true because it excludes only R14, so dxf_convert::convert() selects the reference-aware exporter instead of its primitive fallback. However, every entity fails entity_refs(): its handle_stream_start() helper still returns None for R13 because these records have neither a modern trailer nor obj_size_bits. The loop in dxf_entities::build() therefore skips every entity, and the converter returns that empty export without trying the fallback. Exclude R13 from this path, as R14 already is, until the exporter's reference readers support its inline boundary.
Useful? React with 👍 / 👎.
* 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.
Summary
The walk's reference closure covers R13 and R14: the handle stream is located from the
RLinside the common data, so no R13 or R14 record counts asreferences_uncheckedany more (#84). Stacked on #323 (its commits come first; the diff of this PR alone is the last two commits).Spec reference
ODA v5.4.1 §20.1 and §20.4.1 ("R13-R14 Only":
RLsize of object in bits, not including end handles, after the EED chain of an object or after the graphics block of an entity), §10.1 (item class id0x1F2for classes that produce entities,0x1F3for objects), §2.13. ARCHITECTURE.md §7av.What changes
object::r13_r14_data_end(obj, is_entity)readsBStype,Hhandle, the EED chain, for an entity the graphics flag and graphics, then theRL, and refuses a value that is not a position inside the record after its own prefix.for_each_handle_referenceuses it on R13/R14; the newfor_each_handle_reference_intakes the class table.0x1F2(15) or0x1F3(306).ObjectWalker::with_classestakes the table;DwgFile::all_objects_lossypasses it. Without it a custom-class record stays unchecked rather than guessed.RawObject::obj_size_bitsis unchanged (stillNoneon R13/R14), so no decoder's boundary logic and no existing test moves.Evidence
Corpus run (
measure.py), rows oftools/corpus/baseline.tsv: 30 rows change, only inrefsandno_boundary; every other column of every row is identical.The walk is now closed on all 74 pinned drawings (STATUS.md updated). The check is not vacuous: the same walk with the boundary moved one bit later leaves 38 of 295 references unanswered (23 hard) on
line_R14.dwg, 583 of 1,725 (28 hard) onsample_AC1014.dwg, 711 of 4,437 (9 hard) onCabin.dwgand 140 of 874 (1 hard) on a Sovol drawing, where the right boundary decodes 789, 3,657, 7,866 and 1,304 with none unanswered.Test plan
cargo fmt --all -- --check,cargo clippy --all-targets --all-features -- -D warnings,RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features,cargo +1.85 check --all-featurescargo test --release --all-features --no-fail-fast: no unit test added, none touched.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 the ODA's freely-redistributable Open Design Specification for .dwg files (v5.4.1) and on the public drawings pinned in
tools/corpus/pins.tsv. No other DWG implementation's comments were read.Developer Certificate of Origin
I affirm that the contribution complies with the Developer Certificate of Origin 1.1.