Skip to content

ci: run only real-file, CLI and contract verification; unit tests are banned - #428

Merged
DrunkOnJava merged 1 commit into
mainfrom
ci/unit-test-ban
Sep 27, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
ci/unit-test-ban

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

Unit tests are banned in this repository (maintainer directive, restated 2026-09-27: no unit tests created or run, directly or through scripts, hooks, CI or release jobs). CI and tools/check-local.sh ran the lib/bin/doc unit suites, synthetic-fixture targets and a pytest suite on every PR, and the required check cargo test / ubuntu-latest / stable depended on them. This keeps the real verification and stops running the rest.

Changes

  • tools/ci/test-targets.txt: every tests/*.rs target classed once: real (21: reads real Revit files, compares with the file or Revit's own export), cli (6: runs the built binaries end to end), contract (7: support matrix, binary inventory, witness registry/verdict, JSON schemas, field-type coverage, count manifests), unit (14: synthetic-only, property, fuzz-regression; kept as source, not run). Mixed targets skip their synthetic tests by name.
  • tools/ci/verify-real-files.sh: runs real/cli/contract targets; fails on an unclassified or duplicate target (so elem_table_corpus: 2024 project parse_records returns 26424, header declares 26425 (never exercised in CI) #206's silent-skip failure mode cannot return); --check-only checks the manifest alone.
  • ci.yml: the build matrix job is now build + real files / <os> / <rust> (build every target, then the script with the family corpus on Linux/Windows; no --lib --bins or doc unit runs). Tier-two corpus job uses the script. Removed the synthetic IFC smoke and tier-one synthetic jobs (IfcOpenShell still validates the committed fixtures and the real-project exports). Python wheel job: the installed wheel is smoke-tested on Revit files (tools/ci/wheel-smoke.py, a real Autodesk family on Linux) instead of the pytest suite.
  • tools/check-local.sh: build every target + the script; --corpus runs it under --profile ci.
  • PR template, CONTRIBUTING, AGENTS, release checklist, validation-evidence, Layer 5b guide: end-to-end verification on real files instead of unit tests. Test sources are not deleted.
  • Unchanged: fmt, clippy, rustdoc, docs.rs preview, bench compile, MSRV compile, PII guard, IfcOpenShell and witness gates, deploy-viewer browser tests, nightly real-file corpus jobs, release publish smoke tests.

Verified

  • tools/ci/verify-real-files.sh --profile ci --no-fail-fast with the family and project corpora (magnetar, RE1): 34 targets, 0 failures; the skips filtered exactly 1, 2 and 4 synthetic tests in the three mixed targets.
  • --check-only passes; with an unclassified tests/zz_unlisted.rs it fails naming it.
  • tools/ci/wheel-smoke.py against the PyPI 0.3.0 wheel: tier-one project and racbasicsamplefamily-2024.rfa both export IFC.

Required checks

The ruleset requires cargo test / ubuntu-latest / stable, which this PR renames to build + real files / ubuntu-latest / stable. Once that check passes here, the ruleset's required context is swapped to the new name (.github/rulesets/main-protection.proposed.json updated to match), so no obsolete check can deadlock delivery.


Note

Medium Risk
This rewires the merge gate and local contributor workflow: lib/bin/doc unit suites and 14 integration targets no longer run in CI, so regressions those caught must be found via real-file/contract paths instead.

Overview
CI and local gates stop running unit tests and instead verify changes through real Revit corpora, built CLIs, and contract checks. Unit test sources stay in the tree but are explicitly banned from creation and execution per maintainer policy.

A new tools/ci/test-targets.txt manifest classifies every tests/*.rs integration target as real, cli, contract, or unit (14 unit-only targets, including fuzz/proptest and synthetic IFC). tools/ci/verify-real-files.sh runs only the first three classes, supports per-target skip= for synthetic cases inside mixed files, and fails closed if a target is missing, duplicated, or unlisted.

The main CI job is renamed to build + real files (replacing cargo test as the required check in main-protection.proposed.json): it builds targets then runs the script, with RVT_REQUIRE_CORPUS on Linux/Windows. Tier-two corpus uses the same script. Removed dedicated ifc-smoke and corpus-tier1 jobs (IfcOpenShell and other gates still cover fixtures/real exports). The Python wheel job drops tests/python pytest for tools/ci/wheel-smoke.py on tier-one and Autodesk family files.

tools/check-local.sh, PR template, CONTRIBUTING, AGENTS, release checklist, Layer 5b guide, and CHANGELOG are aligned to tools/check-local.sh / verify-real-files.sh instead of cargo test --lib/--doc.

Reviewed by Cursor Bugbot for commit 36cb410. Configure here.

@cursor

cursor Bot commented Sep 27, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_c578c97c-e4b5-4040-8f80-9addf6560e4f)

@DrunkOnJava
DrunkOnJava merged commit d7f0338 into main Sep 27, 2026
19 checks passed
@DrunkOnJava
DrunkOnJava deleted the ci/unit-test-ban branch September 27, 2026 23:16
DrunkOnJava added a commit that referenced this pull request Sep 28, 2026
…rgo (#512)

## What

Since #428, `tools/check-local.sh` runs `cargo build --workspace
--all-targets --all-features`. That links rvt-py's pyo3 cdylib. On macOS
the link needs `-undefined dynamic_lookup`, because Python's symbols
come from the interpreter at load time. maturin adds that flag and plain
cargo does not, so the documented gate failed on every fresh macOS
checkout with `Undefined symbols for architecture arm64:
"_PyBaseObject_Type"...`. Linux links a shared library with undefined
symbols anyway, so CI never showed it.

`rvt-py/build.rs` now calls
`pyo3_build_config::add_extension_module_link_args()`, the
pyo3-documented fix. It only adds the flag to this cdylib's link, and
only on macOS.

## Verified

On macOS arm64, `cargo build --workspace --all-targets --all-features`
fails on `main` and links with this change.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Build-only change for the Python extension link step on macOS; no
runtime or binding logic changes.
> 
> **Overview**
> Fixes **macOS workspace builds** of the `rvt-py` PyO3 cdylib after
`tools/check-local.sh` started running `cargo build --workspace
--all-targets --all-features` (#428). Plain `cargo` was missing
**`-undefined dynamic_lookup`**, so linking failed with undefined Python
symbols (`_PyBaseObject_Type`, etc.); **maturin** already added that
flag.
> 
> Adds **`rvt-py/build.rs`** that calls
**`pyo3_build_config::add_extension_module_link_args()`**, plus
**`pyo3-build-config`** as a build dependency—scoped to this extension
crate, macOS-only behavior from PyO3. Linux was unaffected because it
allows undefined symbols in shared libs.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
108b471. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@puzzbobb puzzbobb mentioned this pull request Oct 26, 2026
DrunkOnJava pushed a commit that referenced this pull request Oct 26, 2026
Acceptance item 1 of #421: "`bbox_marker` derives the marker from
`RevitFile::schema_classes` and is cross-checked against the 2024 and
2025 constants". On all 84 2024 to 2027 files I have, the marker from
each file's own schema equals the release's constant.

**What changes.** Every scan that needs the bbox marker now gets it from
`file_bbox_marker(rf, release)`:

- The marker is the one the file's schema gives (`schema_bbox_marker`,
RE-80: `[tag of Outline][0xFF x4][tag of ElementParents]`).
- The release's measured constant (`bbox_marker`) is the cross-check. If
the schema and the constant disagree, the file isn't scanned (fail
closed).
- If the schema doesn't parse, the constant is used. A release with no
constant needs the schema.
- `supports_revit_version` no longer depends on a constant being
recorded. It is only the proven-shape list (2024 to 2027).

`file_bbox_marker` already existed, but it returned the constant, and
only some scans called it. Before this patch, these callers read the
per-release table directly:

- `partition_names::compute_element_names`
- `partition_schema_mvp::attach_stair_names`
- `partition_type_records::scan_type_records`
- `partition_level_records::level_records` (64-bit path)
- `partition_type_parameters` / `partition_type_materials`, which only
use it as a "supported?" test and now call `supports_revit_version`

The `BBOX_MARKER*` constants and `bbox_marker` stay as the cross-check
table. The 2024-only legacy helpers that take `&BBOX_MARKER` are left
alone.

**Measurement.** The probe below, on 93 files (the phi-ag/Autodesk
samples, Core Interior, the RE1 set, Einhoven and 68 2025 projects):

| release | files | schema marker | `ElementHeader` | = constant | =
`file_bbox_marker` |
|---|---:|---|---:|:---:|:---:|
| 2024 | 5 | `46 01 ff ff ff ff ab 05` | 1439 | ✓ | ✓ |
| 2025 | 68 | `59 01 ff ff ff ff d3 05` | 1479 | ✓ | ✓ |
| 2026 | 4 | `61 01 ff ff ff ff f1 05` | 1509 | ✓ | ✓ |
| 2027 | 7 | `64 01 ff ff ff ff 10 06` | 1540 | ✓ | ✓ |

On every one of the 84 files, `record_prologue_constant(schema marker)`
(ElementParents x12) is the schema's `ElementHeader` tag, the `u16` that
each record chain header carries (RE-35).

**One finding for older releases.** That a 12 rule doesn't hold before
2019:

| release | ElementParents | ElementHeader | difference |
|---|---:|---:|---:|
| 2016 | 1210 | 1201 | 9 |
| 2017 | 1227 | 1218 | 9 |
| 2018 | 1268 | 1259 | 9 |
| 2019–2023 | | | 12 |

This is harmless today, because the 32-bit path
(`partition_element_records_2023`) takes the header tag from the schema.
But `record_prologue_constant` shouldn't be used for a 2016 to 2018
file. The patch says so in its doc comment, and the test below pins the
gap on each 2016 to 2023 family.

**Test.** `tests/schema_bbox_marker.rs` (registered in
`tests/integration/main.rs` and `tools/ci/test-targets.txt`) asserts
three things on each file:

- schema marker == `bbox_marker(release)`;
- `file_bbox_marker` returns it;
- the prologue == `ElementHeader`.

It runs on the 2024 to 2026 phi-ag families (`RVT_SAMPLES_DIR`, so CI
runs it) and on every project in `RVT_PROJECT_CORPUS_DIR`. A third test
checks the ElementParents − ElementHeader gap on the 2016 to 2023
families: 9 on 2016 to 2018, 12 from 2019. All three skip absent files.

**Checks**, on `3d2df24`, with the changelog fragment
`changelog.d/changed/re421-schema-marker.md`:

- rustfmt `--check`: clean;
- clippy `--all-features -D warnings` (lib, integration, probe): clean;
- `cargo check` with `-D warnings -D unnameable_types`: clean;
- `cargo test -p rvt --lib --test integration` on the local corpora: 134
+ 290 passed, the one failure being the stale test below;
- `tools/check-local.sh`: all gates passed.

**Also in this PR: a stale test.** On the full suite one test failed, on
unpatched `3d2df24` too:
`elem_table_corpus::declared_element_ids_returns_sorted_deduped_set`.
Since #553 and #559 the declared ids include the table's first record,
at `0x06`, which on Einhoven is id 0, but the test still expected the
first id to be 1. CI hadn't caught it because
`tools/ci/test-targets.txt` skipped the test by name (added in #428,
before the fix). The second commit makes the test expect ids 0 and 1
first and removes the skip, so CI runs it again. All six
`elem_table_corpus` tests pass.

**Still per-release tables:**

- `elevation_marker`;
- the Level `record_marker(revit_version)` table. `level_records` no
longer uses it on the 64-bit path, but it's still pub.

`schema_elevation_marker` exists, so the same change could be made for
those. Also, `schema_classes` isn't memoised, so each scan re-reads the
schema. That costs about 0.1 s per file in a debug build (Core Interior
0.10 s, Snowdon 0.14 s), which is small, but caching it on `RevitFile`
would be a tidy follow-up.

<details>
<summary>Probe: <code>examples/probe_421_schema_marker.rs</code> (one
JSON line per file)</summary>

```rust
//! #421, item 1: the element-record marker each file's schema gives, against
//! the release's measured constant.
//!
//! One JSON object per file: `release`, `schema` (the marker from
//! `Outline` and `ElementParents`, RE-80), `constant` (`bbox_marker`),
//! `header_tag` (the schema's `ElementHeader`) and `prologue`
//! (`record_prologue_constant` of the schema's marker), and `scanned`, the
//! marker `file_bbox_marker` hands the scans.
//!
//! Usage:
//!   cargo run --profile ci --example probe_421_schema_marker -- FILE.rvt ...

use rvt::RevitFile;
use rvt::research::partition_element_records as per;
use rvt::research::partition_element_records_2023::record_marker;

fn hex(marker: Option<[u8; 8]>) -> String {
    marker.map_or_else(
        || "null".into(),
        |m| format!("\"{}\"", m.map(|b| format!("{b:02x}")).join(" ")),
    )
}

fn main() {
    for path in std::env::args().skip(1) {
        let file = std::path::Path::new(&path)
            .file_name()
            .map(|n| n.to_string_lossy().into_owned())
            .unwrap_or_default();
        let mut rf = match RevitFile::open(&path) {
            Ok(rf) => rf,
            Err(e) => {
                println!("{{\"file\":{file:?},\"error\":{:?}}}", e.to_string());
                continue;
            }
        };
        let release = rf.basic_file_info().map(|i| i.version).unwrap_or(0);
        let schema = record_marker(&mut rf);
        let marker = schema.map(|(m, _)| m);
        println!(
            "{{\"file\":{file:?},\"release\":{release},\"schema\":{},\"constant\":{},\
             \"header_tag\":{},\"prologue\":{},\"scanned\":{}}}",
            hex(marker),
            hex(per::bbox_marker(release)),
            schema.map_or_else(|| "null".into(), |(_, t)| t.to_string()),
            marker.map_or_else(
                || "null".into(),
                |m| per::record_prologue_constant(&m).to_string()
            ),
            hex(per::file_bbox_marker(&mut rf, release)),
        );
    }
}
```

</details>
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