Repository navigation
test(fixtures): run the specification's own worked examples through the crate (#107) - #280
Merged
Merged
Conversation
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. |
3 of 4 tasks
DrunkOnJava
force-pushed
the
test/107-spec-examples
branch
2 times, most recently
from
October 26, 2026 11:44
0171209 to
807c58c
Compare
…he crate (#107) examples/spec_examples.rs runs every worked example and printed table of ODA spec v5.4.1 through the crate's public code: the §2 bit streams, the §2.14 CRC tables, §3.2.6, §4.1, §4.7, §5.10.1, the §9 R14 header dump and the 78 §20.4 R13/R14 object dumps. The fixtures quote the PDF verbatim with page numbers; tools/spec/extract_examples.py regenerates and audits them. CI's Test job runs it, and r14-objects.tsv's expect column fails the run when any outcome moves. Five spec errata are recorded in ARCHITECTURE.md §7k; the crate disagreements are tracked in #71, #226, #227, #256, #272, #273 and #274.
…ir coverage notes (#107)
DrunkOnJava
force-pushed
the
test/107-spec-examples
branch
from
October 26, 2026 11:45
807c58c to
36fde6e
Compare
DrunkOnJava
enabled auto-merge (squash)
October 26, 2026 11:53
3 tasks done
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
Runs every worked example and printed table of the ODA specification through the crate's public code (
examples/spec_examples.rs, a new step in CI's Test job), on fixtures quoted verbatim from the PDF with page numbers (tests/fixtures/spec-examples/), regenerated and audited bytools/spec/extract_examples.py. Closes #107.Spec reference
ODA Open Design Specification for .dwg files v5.4.1 (sha256
973628f3…f504b): §2.2, §2.3, §2.6, §2.7, §2.13, §2.14, §3.2.6, §4.1, §4.7, §5.10.1, §9, §10.1 and every §20.4.N.1 example.What was collected, and what the crate reproduces
BitCursorcrc::crc8,crc::crc32crc::r13_locator_seedcipher::magic_sequencelz77::decompressandstreaming::Lz77Decoderr21_lz::decompressR13R15Header,crc8,streaming::FlatWalker,HeaderVarsBDs equal §9's printed defaultsObjectWalker,decode_from_rawRLboundary, 17 error, 4 have no decoder, 13 are class-numbered (walk and CRC only)91 worked examples and 6 tables in all. The spec prints no decoded values for the §20.4 dumps, so "close" there is the crate's boundary check on the spec's bytes.
r14-objects.tsv'sexpectcolumn holds each outcome, and the example fails when any moves in either direction.Disagreements and how each was resolved
To decide spec erratum vs. crate bug for the §20.4 records, each failing record was decoded with the spec's own R13-R14 field list. It closed exactly on 16 of the 18 records that erred when this was written, so those are crate bugs; the other 2 (RADIUS, TOLERANCE) close only with a correction to the spec, so they are spec errata that the crate also misreads. It also closes on the MINSERT and SHAPE examples, which have no decoder.
Spec errata (recorded in ARCHITECTURE.md §7k):
0xC0C1.BDleader length that DIAMETER prints; its example closes only with it.TV, not aBS, and the R13-R14 record has one more leadingBD; its example closes only with both.Crate disagreements (decoder code, so filed or commented rather than fixed here):
flag & 0x02.BSwithout the curve type.Found alongside, not a worked example: #275 (new).
src/reed_solomon.rsdecodes R2007 system pages with0x11D, §5.13's data-page polynomial; online_2007.dwg's header page all three codewords verify under §5.13's system polynomial0x169and none under0x11D. The reader does not call the module. The fix will be a separate PR.When a decoder PR moves an example
Once this is on main, CI's Test job fails any PR that changes a §20.4 example's outcome until its expectations are updated. One command does it:
It rewrites each moved
expectcell inr14-objects.tsv, the matching "The spec's own example …" sentence indocs/data/spec-coverage.tsv, anddocs/spec-coverage.md(throughtools/ci/spec_coverage.py --write), then lists what moved. Commit those files in the same PR. A record that newly errors is writtenerror #?and keeps failing until its tracking issue is filled in, so a regression cannot be recorded silently.Measured on every open decoder PR's head (#249 and #258 at their own heads, since they conflict with main): none turns a closing example into an error, and these flip from error to closes. Whichever lands second runs
--update.closesWith all of them in, the §20.4 examples move from 44 close / 17 error (on main with #263) to 58 / 3. The three left are #272, #273 and #274.
What does not run, and why
AcDb:Classesfor its drawing, so they cannot be dispatched.docs/data/spec-coverage.tsvnotes now give each exercised section's result; no state changes, since states are defined over corpus records. Its page column agrees with the PDF's section headings on all 139 rows.Test plan
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningscargo test --release --all-featuresRUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-featurescargo +1.85 build --release --all-features --example spec_examplescargo run --release --example spec_examples:OK: 417 checks, every result matches its fixture(on main at 2a219bd, with fix(tables): read the pre-R2007 VIEW record as §20.4.60 gives it #263)--update: a no-op on this tree; a simulated flip is rewritten and the docs come back byte for byte; a simulated regression is writtenerror #?and failspython3 tools/spec/extract_examples.py --pdf <spec.pdf> --check:ok(every fixture equals the PDF; every hand-transcribed quote is on its page)python3 tools/ci/spec_coverage.py --checksrc/change.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).dwg-rsis Apache-2.0 and must remain compatible.My contribution is based on:
NOTICE, with a dated entry inCLEANROOM.md;line_2007.dwg(the Reed-Solomon measurement behind reed_solomon decodes R2007 system pages with the data-page polynomial (§5.13 gives 0x169, the crate uses 0x11D) #275 only).No other project's 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.
Specifically, I affirm that the contribution is my own work (or rightfully
licensed to me) and that it can be distributed under the project's Apache-2.0
license.