Repository navigation
fix(entities): decode the whole §20.4.38 VIEWPORT record on every release (#71) - #247
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0152dff99
ℹ️ 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".
…ease (#71) The decoder read only the centre, width and height, so every R2000+ VIEWPORT failed the exact-boundary check (delta -819 on the six records of sample_AC1032.dwg). The field list §20.4.38 prints, with its R2000+, R2004+ and R2007+ branches, closes at delta 0 on all 51 VIEWPORT records of the public corpus, R14 to R2018, and on the 36 that have AutoCAD's DXF export of the same drawing every value equals the DXF, matched by handle (1,686 values). examples/probe_viewport.rs prints each record's values by DXF group and compares them with a DXF twin; ARCHITECTURE.md §7k records the measurement. §20.4.38 moves to closes.
… by their index DXF writes groups 50 and 51 in degrees where the record stores radians, and an indexed CMC (0xC3) keeps its index in the low byte of the BL word, not in the BS that §2.11 says is always 0. Every corpus viewport has zero angles and a true-colour ambient light, so the numbers do not move; ARCHITECTURE.md §7k now says those fields are exercised only trivially.
b3f0625 to
5cde06e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5cde06e573
ℹ️ 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".
# Conflicts: # tools/corpus/baseline.tsv
# Conflicts: # ARCHITECTURE.md # docs/data/spec-coverage.tsv # docs/spec-coverage.md
# Conflicts: # ARCHITECTURE.md # docs/data/spec-coverage.tsv # docs/spec-coverage.md # tools/corpus/baseline.tsv
Summary
Decode the whole §20.4.38 VIEWPORT record, with every version branch as the spec prints it. All 51 VIEWPORT records of the public corpus now close on their data-stream boundary (R14 to R2018), and on the 36 that have an AutoCAD DXF export of the same drawing every value read equals the DXF, matched by handle. Part of #71 (VIEWPORT; LEADER and MESH follow in their own PRs).
Spec reference
§20.4.38 VIEWPORT ENTITY (34): centre, width, height; R2000+ the view block (target, direction, twist, view height, lens, clip planes, snap angle, then four
2RDs and the circle zoom); R2007+BSgrid major; R2000+ frozen-layer count, status flags,TVstyle sheet,RCrender mode, the two UCS flags and the UCS block; R2004+BSshade plot mode; R2007+ the lighting block ending in aCMC. The decoder previously read the first three fields only, so every R2000+ record reporteddelta -819(the old 9 errored records ofsample_AC1032.dwginclude its 6).Nothing is measured against the spec and nothing is added to it: the list closes exactly as printed.
Records it was measured on
examples/probe_viewport.rs(new) prints every VIEWPORT with its values keyed by the DXF group §20.4.38 gives each field and, given the DXF twin, reports every disagreement:~/Library/Caches/dwg-corpus/acadsharp, pinned by #225)sample_AC1014.dwgsample_AC1015.dwgsample_AC1018.dwgsample_AC1021.dwgsample_AC1024.dwgsample_AC1027.dwgsample_AC1032.dwg(=../../samples/sample_AC1032.dwg, same sha256)export_sample.dwgsample_AC1032.dwgdoes have a DXF twin: ACadSharp'ssample_AC1032_ascii.dxf, pinned by #225, is AutoCAD's export of the file whose sha256 (0e8faaca…) is our local R2018 sample. Values no default could produce agree: status flags819232/819808(group 90), circle zoom1000, lens50, every view centre and view height, and the ambient light colour0xC2333333, i.e. group 4213355443. The comparator was checked by tampering one significant digit of group 41 and the status word in a copy of the twin: it reported both.Not measured: the 15 records of the R14 save and
export_sample.dwgclose but have no twin; no R13 file exists; every style sheet name in the corpus is empty; every snap angle and view twist angle is 0 (45 of 45 R2000+ records), so groups 50/51 agree only trivially; every ambient light colour is the true colour0xC2333333(33 of 33 R2007+ records), so an indexed colour has not been seen.Review fixes (b3f0625): the probe now converts the stored radians to the degrees DXF writes for groups 50/51, and compares an indexed (
0xC3) ambient colour through group 63 using the index in theBLword's low byte, not theBS(§2.11: always 0). Re-run on every VIEWPORT with a twin gives the same table: 252 / 258 / 294 / 294 / 294 / 294 values, 0 differ. Neither fix changes a number, for the reasons in the paragraph above.Coverage,
../../samples(the 19-file corpus)cargo run --release --example coverage_report -- ../../samplesEvery other row is unchanged. Error histogram after: MESH 2, LEADER 1.
Coverage, public corpus (
acadsharp/;nextgis/unchanged, it holds no VIEWPORT)export_sample.dwgsample_AC1015.dwgsample_AC1018.dwgsample_AC1021.dwgsample_AC1024.dwgsample_AC1027.dwgsample_AC1032.dwgempty.dwg,geoloc.dwgandsample_AC1014.dwgare unchanged (the R14 VIEWPORTs already closed on their 3-field list). These are thedecoded/skipped/erroredcolumns oftools/corpus/baseline.tsv(#225); no other column moves for a decoder-only change.baseline.tsvis not in this PR because #225 is not onmainyet; it needs regenerating (measure.py run+measure.py baseline) once #225 lands.Class census and reference closure
probe_class_census <f>andprobe_reference_closure <f>on all 19 files of../../samples: every censusRESULT: every class reached its declared num_objects, every closureRESULT: the walk is closed, reference counts unchanged (573 / 542 / 507 / 491 / 369 per R2000-R2013 file, 2852 with the 6 known soft danglers onsample_AC1032.dwg, R14 0 with 292 no-boundary records). Both probes are walk-level and do not run entity decoders.Docs
docs/data/spec-coverage.tsv§20.4.38partial→closes(notcomplete: R14 has no twin, there is no R13 file, and the promotion goes through the oracle scorer of Epic: AutoCAD's own DXF export as the value oracle #99);docs/spec-coverage.mdregenerated withtools/ci/spec_coverage.py --write.examples/dump_decoded_entities.rsprints the VIEWPORT values instead of "(stub)".Test plan
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningsRUSTFLAGS="-D warnings" cargo test --release --all-features(real-file tests ran against../../samples; nothing printed "skipping")RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-featuresroundtrip_viewport_headertest only follows the new signature (it builds the R14 shape, which is still the three fields).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 §20.4.38 (field list, types, DXF group codes) and §20.4.75 (group 421 pairs with a CMC's
BLRGB word) of the ODA's freely-redistributable Open Design Specification for .dwg files (v5.4.1), on the corpus bytes, and on AutoCAD's DXF exports of the same drawings read as data files (ACadSharpsamples/atc30a97ce, MIT, pinned by #225). No third-party 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.