Repository navigation
chore(ci): class every tests/ target and run all but the unit ones - #428
Merged
Merged
Conversation
Unit tests are banned in this repository. tools/ci/test-targets.txt classes each tests/*.rs file as real, contract, hardening or unit, with its reason; tools/ci/run_test_targets.sh runs every class but unit, then the documentation examples, and fails on a file the manifest does not class. CI's Test job runs it in place of a bare `cargo test`, under the same job names. The inline #[cfg(test)] suites in src/ stop running with it. The inline test that kept fixed_entity_label and decode_fixed_entity_body in step is replaced by tools/ci/dispatch_arms.py, which reads both lists from src/entities/dispatch.rs, in CI's Spec coverage job. CLAUDE.md, CONTRIBUTING.md, the PR template, AGENTS.md, ARCHITECTURE.md, docs/EXTENDING_DECODERS.md and RELEASE.md say unit tests are banned.
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. |
This was referenced Oct 28, 2026
Merged
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
Unit tests are banned in dwg-rs, on the model rvt-rs already runs (its
tools/ci/test-targets.txtandverify-real-files.sh). This PR classes everytests/*.rsfile, switches CI's Test job to run every class butunit, and says in the docs that unit tests are banned. The inline#[cfg(test)]suites insrc/stop running with it and are deleted area by area in the PRs that follow. Git history is the archive.tools/ci/test-targets.txtclasses the 17 files asreal,contract,hardeningorunit, one reason per line. No file iscli: nothing undertests/drives a built binary.hardeningis a fifth class that rvt-rs keeps for its fuzz-finding replays; here it holdsintegration_fuzz_corpus_regressionalone.tools/ci/run_test_targets.shruns thereal,contractandhardeningtargets in one--no-fail-fastinvocation, each target with askip=list in its own (libtest's--skipapplies to a whole invocation), then--docon its own (cargo refuses--docwith--test). It fails on atests/*.rsfile the manifest does not class, on a stale or duplicate row and on an unknown class. It is bash withshell: bashin CI, so it runs on the Windows leg without a Python install.main-protectionruleset is unchanged.cargo test --release --all-featuresbecomestools/ci/run_test_targets.sh --release --all-features(toolchain throughRUSTUP_TOOLCHAIN, so the 1.85 leg still runs 1.85), and a--check-onlystep before the build fails a bad manifest in seconds.cargo build --all-targetsstays, which still compiles theunitfiles under-D warnings.Classing
The
unitfiles stay as unrun source, as in rvt-rs. They still build under--all-targets.integration_svg_goldensisunitbecause two of its three tests pin text from synthetic documents and the third renders a hard-coded SVG tagged with a drawing's version; none reads a drawing's content.Invariants carried over before anything is deleted
entities::dispatchfixed_entity_label_covers_every_body_arm(the one CLAUDE.md names) becomestools/ci/dispatch_arms.py --check, a step of CI's Spec coverage job. The inline test checked a hand-written list of codes against the label function, one direction only. The script readsfixed_entity_labelanddecode_fixed_entity_bodyfrom the source and compares them both ways, so a new decoder that adds its arm to one list and not the other fails. A body arm without a label (records come backUnhandled, counted as skipped) fails; so does a label without a body arm (records come back as errors). I mutation-tested it on copies ofdispatch.rs(a dropped label, a dropped body arm, a narrowed|group) and ran it on thedispatch.rsof the open PRs feat(entities): decode SHAPE from §20.4.37 (#140) #310, feat(objects): decode VIEWPORT ENTITY HEADER from §20.4.70 (#146) #311, feat(corpus): pin the 122 US Forest Service AC1012 drawings by Wayback URL (#345) #412, feat(entities): route LIGHT by class name and read it with the layout its R14 record closes on (#152) #426 and feat(objects): decode RAPIDRTRENDERENVIRONMENT to its record boundary (#152) #427: all pass.OBJECT_TYPE_GEODATAhas a label arm and no body arm. It cannot be reached: GEODATA is a non-entity object, sodecode_in_pagesends it todispatch_objectfirst. The script lists it as the one tolerated label-only code, and fails the day it stops being one. Removing the arm needsdispatch.rs, which ten open PRs touch, so it waits.tests/code_table_agreement.rs(classcontract), which no open PR touches. On real data, the Corpus job'stools/corpus/baseline.tsvturns a lost label into a changed skipped count.limits.rsprofile ordering anddefault == safe;known_section_names_are_unique;version_magic_matches_spec_table; the CRC, cipher, bit-cursor and LZ77 known answers (every R2004-family drawing in the corpus opens through them, andexamples/spec_examplesruns the specification's own worked examples in CI's Test job); the Reed-Solomon and R2007 LZ tests (probe_r2007_rson every pinned R2007 page); the class-map and handle-map writer round trips (probe_class_roundtrip --stricton every pinned drawing, and the canonical fixtures regenerated and diffed incoverage-smoke). No pure-maths module is kept: a kept suite that no job runs checks nothing.Not in this PR
integration_dxf_roundtrip,integration_gltfandintegration_legacy_container's four corpus tests read../../samplesbut are not among the targets the Corpus job lists, so they skip on every job today. That is its own finding and its own PR (chore(ci): run every corpus-reading real target in the Corpus job #435).dispatch.rs's doc comment still names the deleted-to-be inline test; it is fixed with that file's deletion, since ten open PRs touch the file.Spec reference
Not a decoder change. Issue: none.
Test plan
tools/ci/run_test_targets.sh --check-onlypasses, and fails on an unlisted file, a stale row, a duplicate and an unknown class (checked on a scratch copy).python3 tools/ci/dispatch_arms.py --checkpasses, and fails on each of three mutations.python3 tools/ci/spec_coverage.py --check,python3 tools/maintainer/train/arch.py checkandpython3 tools/maintainer/readme_status.py --checkpass.== 10 targets: block_names canonical_corpus class_census corpus_roundtrip integration_dxf_roundtrip integration_gltf r2013_entity_values samples code_table_agreement integration_fuzz_corpus_regression, then== integration_legacy_container, without 7 synthetic-fixture tests(4 passed, 7 filtered out), then the documentation examples (10 passed). 93 tests per leg, against the 921 of a barecargo test; the corpus-gated ones skip, as before. Windows ran it undershell: bashwith no Python.41 decoded codes all labelled; 1 labelled without a body (OBJECT_TYPE_GEODATA).skippingin the log.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:
See
CLEANROOM.mdfor the full allowed/forbidden source list and the honest scope of what "clean-room" means for this project.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.