Repository navigation
feat(corpus): pin the 122 US Forest Service AC1012 drawings by Wayback URL (#345) - #412
DrunkOnJava wants to merge 78 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.
…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.
…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.
… set and how it decodes (#119)
… 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.
…XF writer, as R14 (#119) Both match Version exhaustively, so clippy --all-targets fails on a tree with Version::R13, as it did for probe_dxf_header and probe_dxf_entities.
…-map entry claims as records (#345) On the US Forest Service R13 drawings, 87 of 122 have runs between the records the object map names. Every run tiles exactly into records with a valid CRC; most carry a handle the map names elsewhere.
…longer names (#345) ARCHITECTURE.md 7av: what the container, the header and the decoders show on the 122 AutoCAD-written drawings, and the 1,484 runs of whole CRC-valid records between the records the map names in 87 of them. STATUS, ROADMAP and the coverage notes of sections 3, 23 and 26 say the same; measure.py's report no longer counts a drawing that is both open and unmeasured twice.
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. |
…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: e2cfb3a65d
ℹ️ 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".
| return Err(Error::NotDwg { got: *magic }); | ||
| } | ||
| Ok(match magic { | ||
| b"AC1012" => Self::R13, |
There was a problem hiding this comment.
Keep R13 conversion on the primitive DXF exporter
Accepting AC1012 also enables the modern DXF entity exporter for R13: dxf_entities::writes excludes only Version::R14. For an R13 drawing with a readable header and LAYER table, dxf_convert::convert therefore selects that exporter, but entity_refs cannot locate any entity's handle stream because tables::block_record::handle_stream_start still relies on raw.obj_size_bits, which is absent on R13. Every entity is consequently skipped, and conversion returns successfully with an empty ENTITIES section instead of exporting the decoded geometry. Extend the exporter's pre-R2000 guard to include R13 until its handle-reference path supports the newly added format.
Useful? React with 👍 / 👎.
| # decodes, leaves unresolved, and of those hard; no_boundary: records with no | ||
| # handle-stream boundary, whose references go unchecked. | ||
| file source release decoded skipped errored walk_skips handle_mismatches census between refs unanswered hard no_boundary | ||
| 801-1.dwg usfs AC1012 308 0 0 0 0 - 8932 0 0 0 308 |
There was a problem hiding this comment.
Regenerate the USFS reference-closure baseline
The new USFS rows retain the reference measurements from before this commit's R13 handle-stream support: for example, this row says all 308 successfully decoded records have no boundary and zero references. ObjectWalker::collect_all_lossy now locates those boundaries through r13_r14_data_end, and probe_reference_closure reports that walker's updated reference counts directly. Consequently, the corpus measurement cannot match these rows: .github/workflows/ci.yml runs measure.py check, which rejects improvements as well as regressions. Re-run the pinned USFS corpus with the final reader and commit the regenerated reference columns. CLAUDE.mdL75-L75
Useful? React with 👍 / 👎.
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.
* 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
Pins the 122 US Forest Service R13 drawings, the first AC1012 drawings the corpus holds that the agency says AutoCAD Release 13 itself wrote (#345). They are public domain and exist only as Wayback Machine captures, so
pins.tsvgains aurlcolumn andfetch.pya Wayback route with retry and back-off. Stacked on #355 and #324 (and so on #323): their commits come first; this PR's own commits arefeat(corpus): pin the 122 US Forest Service AC1012 drawings,feat(examples): probe_unclaimed_runs, the baseline rows, the documentation, and two small fixes listed below. It needs #355's decoders for the baseline to show 0 errored, and #324's reference closure for the baseline'srefscolumns.What changes
tools/corpus/pins.tsv: aurlcolumn (-for every GitHub row); 122 rows forftp.fs.fed.us/pub/acad/dev/{roads,trails}pinned by capture URL, size and sha256. Provenance and licence are inCLEANROOM.md("Public corpus: the US Forest Service R13 drawings"). Any PR that adds a pins row must now append a-column.tools/corpus/fetch.py: a row with aurlis fetched from that URL alone.web.archive.orgrequests are spaced 1.1 s apart; a refusal (429, 503, reset) is retried 6 times with a doubling back-off from 5 s (capped at 60 s) inside--deadline; a body that does not match its pin is requested again up to 3 times (a capture is immutable, so a mismatch is a bad transfer) before it fails the job. An outage still ends in exit 69 and a NOT MEASURED Corpus job, and the retry paths were exercised against a stubbed transport (429, reset, 503 then success; 404 toGone; six 503s toUnreachable; the deadline stops a back-off). Three drawings were also fetched live from Wayback (6 s, all matching their pins).~/dwg-corpusunderdwg-corpus-${{ hashFiles('tools/corpus/pins.tsv') }}and save it only after a measured run, so the Wayback Machine is requested once per change to the pins, not once per run, and an outage does not poison the cache.examples/probe_unclaimed_runs.rs: reads the object-stream bytes no map entry claims as object records (see Evidence).tools/corpus/measure.py: the report's "Reference closure: N drawings closed" subtracted a drawing that is both open and unmeasured twice (it printed -43 on this corpus before feat(objects): R13 and R14 reference closure from the RL inside the common data (#84), stacked on #323 #324); it now counts the union.examples/probe_dxf_classes.rsandprobe_dxf_tables.rs(andprobe_dxf_entities.rs): main matchesVersionexhaustively there; R13 maps to no DXF writer, as R14, or clippy--all-targetsdoes not compile.tools/corpus/baseline.tsv: to be regenerated from the Corpus job'scorpus-measurementartifact (Griffin's 2026-10-27 rule: tests and builds run only on GitHub runners). The committed rows are from a local run before that rule and from before feat(objects): R13 and R14 reference closure from the RL inside the common data (#84), stacked on #323 #324 was merged in; the first Corpus run will show the differences.Evidence
All numbers below were measured locally before the rule, on this tree's code, and are to be re-confirmed by CI.
probe_r13_containerpasses all 122 (locator CRC, sentinels, preview sentinel, §9 and §10.1 sections, every §23.1 chunk). Four locators and code page 30 in all 122; bytes 0x06-0x0C00 00 00 00 00 06 01(59),04 01(36),00 01(27); the §26 body follows the section as printed on all 122, tail18 78 01 04. The preview is a real 2,276 to 16,592-byte image. Header variables close on all 122: 195 slots, a section of exactlyceil(bits / 8).coverage_report, with fix(entities): R13 takes the R13-R14 branch of TEXT, VIEWPORT, TRACE, DIMSTYLE and LEADER (#119) #355's decoders): 345,236 records, 345,132 decoded, 104VP_ENT_HDRskipped (no decoder), 0 errored, 0 handle mismatches, 0 walk skips. Against feat(container): open and walk AC1012 (R13), pinned on 22 real drawings (#119) #323 alone: 7,354 errored (TEXT 7,016, DIMSTYLE 126, LEADER 116, VIEWPORT 52, ATTDEF 41, TRACE 3), which is fix(entities): R13 takes the R13-R14 branch of TEXT, VIEWPORT, TRACE, DIMSTYLE and LEADER (#119) #355's evidence.probe_unclaimed_runs: all 1,484 runs tile exactly into records with a valid CRC (11,677 of 11,677); 9,764 carry a handle the map names at another offset (older copies of rewritten objects) and 1,913 a handle it does not name (erased objects). That is what an incremental save leaves behind, stated as a reading of the measurement. None of the 22 pinned R13 drawings, the 8 R14 or the later releases has any, and Autodesk's own install-disc drawings (local evidence) have one run of 172 bytes in 68 distinct drawings. Thebetweencount of each drawing is pinned in the baseline;measure.py's report now says "109 closed, 87 open".Reproduce:
Test plan
cargo fmt --all -- --check,cargo clippy --all-targets --all-features -- -D warnings,RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features,cargo test --release --all-features --no-fail-fast,cargo +1.85 check --all-features,spec_examples,spec_coverage --check,arch.py check, the DXF oracle ratchet,probe_header_vars,probe_r2007_rs,probe_data_page_header --strict,verify_walk.py. CI is the gate from here.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 byte-level inspection of the 122 public-domain drawings pinned in
tools/corpus/pins.tsv, read only through this crate and its probes (the drawings are data files; no code from the Forest Service or the Internet Archive was consulted). Nothing needs adding toCLEANROOM.mdbeyond the corpus provenance entry in this PR.Developer Certificate of Origin
I affirm that the contribution complies with the Developer Certificate of Origin 1.1.