Skip to content

chore(ci): class every tests/ target and run all but the unit ones - #428

Merged
DrunkOnJava merged 2 commits into
mainfrom
test/class-test-targets
Oct 28, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
test/class-test-targets

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Unit tests are banned in dwg-rs, on the model rvt-rs already runs (its tools/ci/test-targets.txt and verify-real-files.sh). This PR classes every tests/*.rs file, switches CI's Test job to run every class but unit, and says in the docs that unit tests are banned. The inline #[cfg(test)] suites in src/ stop running with it and are deleted area by area in the PRs that follow. Git history is the archive.

  • tools/ci/test-targets.txt classes the 17 files as real, contract, hardening or unit, one reason per line. No file is cli: nothing under tests/ drives a built binary. hardening is a fifth class that rvt-rs keeps for its fuzz-finding replays; here it holds integration_fuzz_corpus_regression alone.
  • tools/ci/run_test_targets.sh runs the real, contract and hardening targets in one --no-fail-fast invocation, each target with a skip= list in its own (libtest's --skip applies to a whole invocation), then --doc on its own (cargo refuses --doc with --test). It fails on a tests/*.rs file the manifest does not class, on a stale or duplicate row and on an unknown class. It is bash with shell: bash in CI, so it runs on the Windows leg without a Python install.
  • CI: the Test job keeps its name and its matrix, so the main-protection ruleset is unchanged. cargo test --release --all-features becomes tools/ci/run_test_targets.sh --release --all-features (toolchain through RUSTUP_TOOLCHAIN, so the 1.85 leg still runs 1.85), and a --check-only step before the build fails a bad manifest in seconds. cargo build --all-targets stays, which still compiles the unit files under -D warnings.
  • Docs: CLAUDE.md, CONTRIBUTING.md (a new "Unit tests are banned" section), the PR template, AGENTS.md, ARCHITECTURE.md section 10, docs/EXTENDING_DECODERS.md and RELEASE.md.

Classing

Class Targets
real block_names, canonical_corpus, class_census, corpus_roundtrip, integration_dxf_roundtrip, integration_gltf, integration_legacy_container (without its 7 byte-built tests), r2013_entity_values, samples
contract code_table_agreement
hardening integration_fuzz_corpus_regression
unit dispatch_roundtrip, integration_entity_regression, integration_svg_goldens, integration_write_roundtrip, mutation_failure_modes, proptest_roundtrip

The unit files stay as unrun source, as in rvt-rs. They still build under --all-targets. integration_svg_goldens is unit because 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::dispatch fixed_entity_label_covers_every_body_arm (the one CLAUDE.md names) becomes tools/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 reads fixed_entity_label and decode_fixed_entity_body from 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 back Unhandled, counted as skipped) fails; so does a label without a body arm (records come back as errors). I mutation-tested it on copies of dispatch.rs (a dropped label, a dropped body arm, a narrowed | group) and ran it on the dispatch.rs of 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.
  • A finding. OBJECT_TYPE_GEODATA has a label arm and no body arm. It cannot be reached: GEODATA is a non-entity object, so decode_in_page sends it to dispatch_object first. The script lists it as the one tolerated label-only code, and fails the day it stops being one. Removing the arm needs dispatch.rs, which ten open PRs touch, so it waits.
  • Already external and kept: the object-type and DIMENSION table agreement against the specification's Table 4 is tests/code_table_agreement.rs (class contract), which no open PR touches. On real data, the Corpus job's tools/corpus/baseline.tsv turns a lost label into a changed skipped count.
  • Considered and not ported, because they check a constant against itself or are covered on real files: limits.rs profile ordering and default == 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, and examples/spec_examples runs the specification's own worked examples in CI's Test job); the Reed-Solomon and R2007 LZ tests (probe_r2007_rs on every pinned R2007 page); the class-map and handle-map writer round trips (probe_class_roundtrip --strict on every pinned drawing, and the canonical fixtures regenerated and diffed in coverage-smoke). No pure-maths module is kept: a kept suite that no job runs checks nothing.

Not in this PR

  • integration_dxf_roundtrip, integration_gltf and integration_legacy_container's four corpus tests read ../../samples but 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).
  • README.md and STATUS.md still quote "921 tests" from 2026-10-27. Open PRs touch both files, so the counts are replaced in a docs PR that lands after the deletions (docs(readme): stop quoting a unit-suite pass count #436).
  • 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-only passes, 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 --check passes, and fails on each of three mutations.
  • python3 tools/ci/spec_coverage.py --check, python3 tools/maintainer/train/arch.py check and python3 tools/maintainer/readme_status.py --check pass.
  • CI evidence, run 40674359229, all 24 checks green:
    • each of the six Test legs (ubuntu, macOS and Windows, stable and 1.85) logs == 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 bare cargo test; the corpus-gated ones skip, as before. Windows ran it under shell: bash with no Python.
    • Spec coverage: 41 decoded codes all labelled; 1 labelled without a body (OBJECT_TYPE_GEODATA).
    • Corpus (public DWG): its five corpus targets pass with the corpus present and no skipping in 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:

  • No Autodesk DWG SDK source (RealDWG, ObjectARX, ObjectDBX) or NDA-protected Autodesk documentation was consulted or imported.
  • No Open Design Alliance Teigha / Drawings SDK source was consulted or imported. The ODA's public Open Design Specification for .dwg files PDF is explicitly allowed (see CLEANROOM.md).
  • No GPL-licensed DWG implementation source (LibreDWG, etc.) was consulted or imported. This matters because dwg-rs is Apache-2.0 and must remain compatible.

My contribution is based on:

  • The ODA's freely-redistributable Open Design Specification for .dwg files (v5.4.1);
  • Public reverse-engineering notes, research papers, or blog posts cited inline;
  • Reading algorithm-description comments (not executable code) in permissively-licensed projects (MIT / Apache / BSD) to resolve spec ambiguities: none were read for this change.

See CLEANROOM.md for 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.

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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T11:37:49.023438Z 059d21c New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 28, 2026 11:40
@DrunkOnJava
DrunkOnJava merged commit 67547c3 into main Oct 28, 2026
24 checks passed
@DrunkOnJava
DrunkOnJava deleted the test/class-test-targets branch October 28, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant