Skip to content

fix(partitions): read Revit 2023 records' container and Levels' Building Story in their 32-bit forms - #738

Merged
DrunkOnJava merged 2 commits into
DrunkOnJava:mainfrom
pinterbanget:fix/2023-container-building-story
Oct 18, 2026
Merged

DrunkOnJava merged 2 commits into
DrunkOnJava:mainfrom
pinterbanget:fix/2023-container-building-story

Conversation

@pinterbanget

Copy link
Copy Markdown
Contributor

Summary

This fixes two 32-bit fields that Revit 2023 records are read with:

  • The element record's container reference is the u32 22 bytes before the marker, not the u64 at 2024's place.
  • A Level's Building Story frame is ff ff ff ff 00 01 · f64 · u32 id · setting, not the u64 form.

Together they read rac_basic 2023's Levels, which were not read at all before, and raise storey agreement on all three Autodesk 2023 samples.

Motivation

I found these while measuring Autodesk's 2023 sample projects against their 2024 copies (the RE-140 pairs, joined on ElementId; ElementIds and GlobalIds survive the re-save).

  • The container. The u64 at 2024's place relative to the marker, 8 bytes after the category, is not the container. On rac_basic it is an all-0xFF run, so no 2023 record was ever a container member. As a result, Level 800333 (a container member on 2024, container 800214) was taken for a seventh standalone Level, recovered_levels_are_a_storey_set failed, and no Level of the project was read.
  • The Building Story frame. The u64 anchor found an unrelated run after the name, so every Level read None or false.

Changes

  • src/partition_element_records_2023.rs: the container is the u32 at marker - 22, 0xffff_ffff meaning unset. The unused u64 closure is removed.
  • src/partition_level_records.rs:
    • find_level_records_2023 reads the same u32 (16 after the category).
    • building_story_after takes the id width, and reads the 32-bit frame when it is 4.
  • examples/probe_32bit_container.rs: joins a 2023 file with its 2024 copy and counts which reading of the container agrees.
  • reports/element-framing/32bit-container-and-building-story.md, CHANGELOG.md.

Testing

  • tools/check-local.sh passes (231 passed).
  • Verified end to end on real files: Autodesk's 2023 and 2024 rac_basic, rst_basic and rac_advanced, fetched with tools/fetch-autodesk-samples.sh (SHAs pinned in research/autodesk-sample-projects.tsv).
    • With RVT_SAMPLES_DIR (the 11 phi-ag families) and RVT_PROJECT_CORPUS_DIR (Einhoven, Core Interior), the whole integration binary passes except three targets that fail identically on main 120e2f9:
      • elem_table_corpus::declared_element_ids_returns_sorted_deduped_set (skipped in test-targets.txt);
      • ifc_synthetic_project (classed unit);
      • project_count_fixtures (needs the magnetar IFC Exports folder, which I did not fetch).
  • Witness verdicts / Measure on the reference models: not run here. The admitted 2023 reference projects are not available to me. A measure.yml run with -f samples=true would score this against them.
  • Performance: N/A.
probe_32bit_container 2023-<model>.rvt 2024-<model>.rvt
rac_basic:    1,201 records shared, 3 in a container on 2024; u64 at marker-30 agrees on 1,192 (0 of the members), u32 at marker-22 on 1,201
rst_basic:    5,858 records shared, 0 in a container;          u64 agrees on 1,675,                                 u32 on 5,858
rac_advanced: 8,901 records shared, 32 in a container;         u64 agrees on 8,806 (0 of the members),             u32 on 8,901

Storey agreement of each 2023 export with its 2024 copy's, per element:

project main this branch
rac_basic 15.5 % 81.7 %
rst_basic 91.9 % 95.2 %
rac_advanced 90.0 % 97.8 %

The Building Story setting of every Level now equals its 2024 copy's:

  • rac_basic: 6 Levels, all stories.
  • rac_advanced: 5 Levels, all stories.
  • rst_basic: 9 Levels, none a story.

rac_basic's one element that 2024 does not export, a container member, is no longer exported. The 2024 exports of the three projects are unchanged apart from timestamps.

Audit-honesty checklist

  • Docs reflect the current state. The 2023 claim "where its Levels are read, each element on the storey of the Level its record names" still holds; this widens where it applies.
  • No limitation introduced.
  • Commit message says what changed and why.
  • No emojis in code, docs or commit messages.
  • No private paths, personal emails or internal jargon in committed files.
  • Reverse-engineering finding: the probe is examples/probe_32bit_container.rs and the dated report is in reports/element-framing/. I did not add an addendum to docs/rvt-moat-break-reconnaissance.md; happy to if you want one.

Legal and contribution hygiene

  • I agree this work is licensable under Apache-2.0.
  • No Autodesk proprietary source, decompiled internals, or NDA'd SDK content. Everything here comes from byte observation of Autodesk's published sample files.
  • No fixtures added.

Breaking changes

None. Exports of 2023 files change: Levels are read where they were not, and container members are left out as on 2024.

Related issues

Refs #421. Related findings: RE-107, RE-118, RE-140.

🤖 Generated with Claude Code

@puzzbobb puzzbobb mentioned this pull request Oct 7, 2026
…ing Story in their 32-bit forms

A 2023 element record's container reference is the u32 22 bytes before
its marker (16 after the category), followed by ff ff ff ff, not the u64
at 2024's place relative to the marker. Joined on ElementId with the 2024
copy of Autodesk's same sample projects, the u32 agrees with 2024's
container on every shared record of rac_basic, rst_basic and
rac_advanced 2023 (1,201, 5,858 and 8,901), where the u64 disagrees on
9, 4,183 and 95, every container member among them. The Level reader
takes the same field, so rac_basic's Level 800333, a container member,
no longer fails the storey-set check and its six Levels are read.

A 2023 Level's Building Story frame is ff ff ff ff 00 01, an f64, a u32
ElementId and the setting; the u64 frame found an unrelated run. Every
Level of the three projects now gives the setting its 2024 copy gives.

Storey agreement of the 2023 exports with the 2024 copies: 15.5 to 81.7
per cent (rac_basic), 91.9 to 95.2 (rst_basic), 90.0 to 97.8
(rac_advanced). 2024 exports are unchanged. Probe:
examples/probe_32bit_container.rs; report:
reports/element-framing/32bit-container-and-building-story.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@DrunkOnJava

Copy link
Copy Markdown
Owner

Thank you, this is a careful piece of work. Joining each 2023 sample with its 2024 copy on ElementId is a strong oracle for a release that has no export of its own here, and the two fields are fail-closed in the right way (0xffff_ffff reads as unset, as 2024's all-0xFF does).

As on #737, I replaced your commit with the same change, signed and rebased onto current main, with you still the author. main requires signed commits. The CHANGELOG conflict with today's merges is resolved by keeping both entries, and the rest of the change is identical to yours line for line. CI on the original base passed everything except the source-map-js lockfile advisory that #747 fixed.

On your open checkbox: I'll run the Measure workflow with Autodesk's samples (-f samples=true) on this branch, so your storey-agreement table is reproduced on the runners against the pinned 2023 and 2024 samples. This lands once CI is green and that run agrees; I'll post the run here.

@DrunkOnJava

Copy link
Copy Markdown
Owner

The Measure run is in: run 39114116073, this branch (b9c0a03) against main (6ee3158), over the six reference models and Autodesk's 2016 to 2027 sample projects.

  • 47 of 50 models have identical diagnostics, every 2024 sample among them, as your PR says.
  • The three 2023 samples change, and only in the direction you measured:
    • rac_basic: 3 storeys named by their elevation become Revit's six Levels (Foundation, Level 1 Living Rm., Level 1, Ceiling, Level 2, Roof Line). Storey-bound elements go from 151 to 452, and one container member (an electrical equipment proxy) is no longer exported (465 to 464 elements).
    • rac_advanced: 2 storeys become 5 (01 - Entry Level to Parapet), storey-bound elements go from 5,086 to 5,620, and elements skipped for a missing Level drop from 571 to 37.
    • rst_basic: the 2 storeys it called Level 1 and Ceiling become 5 storeys named by elevation. That fits your finding that none of its Levels is a building story. Its 2024 and 2025 copies likewise name their storeys by elevation (2 of them), so the 2023 file now reads its Levels' setting as 2024 does. The storey count still differs (5 against 2), from how elements bind to elevations, which this PR doesn't touch.

Arming it now.

@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 18, 2026 09:21
@DrunkOnJava
DrunkOnJava merged commit e2fab72 into DrunkOnJava:main Oct 18, 2026
25 checks passed
DrunkOnJava added a commit that referenced this pull request Oct 18, 2026
[Unreleased] becomes [0.5.0] — 2026-10-18, with an introduction, the
contributors, and what to change when upgrading from 0.4. The community
pull requests' entries are added and credited (#737, #738, #744, #751,
#752, #753, #755, #757, #758), and the repeated Added, Changed, Fixed and
Research headings are folded into one each, keeping every entry (107) and
its order; everything from [0.4.0] down is unchanged.

CITATION.cff said 0.1.2 (2026-04-20), though RELEASE.md has it agree with
Cargo.toml at every tag. Its abstract now describes the project as the
README does, without the "first open-source tool" and "verified against
11 releases" claims.
DrunkOnJava added a commit that referenced this pull request Oct 18, 2026
## Summary

Prepare v0.5.0. Merging this is not the release: the release is the signed `v0.5.0` tag on the merged commit, which runs `publish.yml` (crates.io, PyPI, the release binaries and the container image). The tag waits for the maintainer's go-ahead.

## Motivation

`main` is 0.4.0 plus everything under `[Unreleased]`: Revit 2026 projects (experimental), MEP ports, connections and systems, Revit's level, category, family, type and phase properties, rooms aggregated into their storeys, Snowdon Towers exporting again, and the first pull requests from outside contributors. Before 1.0 a breaking change bumps the minor version, and these are breaking for a 0.4 user:

- The MSRV is 1.87 (was 1.85).
- `rvt` has no `wasm` feature; the bindings are the `rvt-wasm` crate (C6).
- Each `IfcSpace` is aggregated into its storey instead of contained in it (#744).
- `ElemTableHeader::record_count` is a `u32` (#764).
- Type objects take Revit's GlobalIds (RE-167).

## Changes

- **Versions 0.4.0 → 0.5.0:** `rvt`, `rvt-py` and its pin, `rvt-wasm`, the `stream_evidence` pin, both lockfiles (only the workspace crates' version lines change), `.release-please-manifest.json` and `viewer/package.json`.
- **`CHANGELOG.md`:** `[Unreleased]` becomes `[0.5.0] — 2026-10-18`.
  - An introduction, the contributors, and an **Upgrading from 0.4** section.
  - The community pull requests' entries are added and credited (#737, #738, #744, #751, #752, #753, #755, #757, #758).
  - The repeated Added, Changed, Fixed and Research headings, which later merges had appended, are folded into one each. All 107 entries are kept as written (checked as a multiset) and in their order, and everything from `[0.4.0]` down is byte-identical.
  - #778's clean-room policy change is added under Changed, so the section has 108 entries.
- **`CITATION.cff`:** it said 0.1.2 (2026-04-20), though `RELEASE.md` has it agree with `Cargo.toml` at every tag. Its abstract now describes the project as the README does, without the "first open-source tool" and "verified against 11 releases" claims.
- **Registry descriptions:** crates.io showed 0.4.0's description, which leaves out Revit 2023, and PyPI one that called element extraction and geometry "active research" and the export "document-level IFC4 scaffolding". `Cargo.toml` and `pyproject.toml` now say what the README says: typed elements from Revit 2023 to 2025 projects, 2026 experimental.
- **Witnesses:** the IFC header carries the version (#417), so both Core Interior `rvt-rs.json` observations and their verdicts are refreshed from this pull request's CI run.

## Testing

- CI on this pull request: every job `CI passed` requires, the witness replays among them.
- On the tag, the publish workflow runs its own checks before anything is published: wheel install and model open on each OS, `cargo install` and the CLI sample smoke, the docs.rs build preview and the viewer load smoke. crates.io and PyPI publish only after all of them pass, and PyPI only after crates.io.

## Audit-honesty checklist

- The docs keep describing 0.4.0 as the latest release until each 0.5.0 channel has been checked from what was published. That follows in a separate pull request (`docs/install.md`, `docs/python.md`, `docs/status.md`, `docs/supported-profile.md` and the README's release section).
- crates.io's trusted publisher (repository DrunkOnJava/rvt-rs, workflow `publish.yml`, environment `crates-io`) has to be in place before the tag, as `docs/maintaining.md` says; it is a registry-side setting this repository cannot check.

## Legal and contribution hygiene

N/A: release metadata only. Contributors are credited by their GitHub names in the CHANGELOG.

## Breaking changes

Listed under Motivation, with the migration for each in the CHANGELOG's **Upgrading from 0.4**.
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.

2 participants