Skip to content

fix(elem_table): the header's record count is the u32 the table states (#745) - #764

Merged
DrunkOnJava merged 2 commits into
mainfrom
fix/elem-table-record-count-u32
Oct 18, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
fix/elem-table-record-count-u32

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

ElemTableHeader::record_count kept the low 16 bits of the u32 at 0x02,
documented as safe because no table measured held 65,536 records. A
Nordic LCA office project's table states 72,798 (#745), so rvt-elem-table
reported 7,262 declared records and the implicit fallback layout would
parse only that many (helenkwok noted the loose end). The field is a u32
now, and parse_records takes its limit from the stated count on both
layouts. Two comparisons in existing tests cast the parsed length instead
of the count; their assertions are unchanged.

Testing

  • CI's real-file targets cover the 28- and 40-byte tables of the family corpus, Core Interior, Einhoven and RE1, all under 65,536 records, where the stated count reads the same as before. elem_table_corpus and project_corpus_smoke keep their assertions; only the side of each comparison that is cast changes.
  • The Nordic LCA table that motivated this (72,798 records) is not in CI's corpora; helenkwok measured the u16 truncation on it in Nordic LCA office as-built (Revit 2024, 14 streams, one 62 MB partition): walker finds levels and materials only #745.
  • rustfmt --check is clean on every changed file. CI runs the rest.

Legal and contribution hygiene

  • I agree this work is licensable under Apache-2.0.
  • No Autodesk proprietary source, decompiled internals or NDA material.
  • No fixtures added.

Note

Medium Risk
Changes core ElemTable header parsing and record limits; low blast radius but affects how large Revit projects are read and exported.

Overview
Fixes ElemTable parsing for projects whose table declares more than 65,535 records. ElemTableHeader::record_count is now the full u32 at 0x02 instead of truncating to 16 bits, which mis-reported counts (e.g. 72,798 → 7,262) and capped how many records were parsed on the implicit fallback layout.

parse_records always uses the same stated_count limit for explicit and implicit layouts, so both paths honor the full declared count. The rvt-elem-table JSON output and corpus tests were updated to compare against the widened type without changing the intended assertions.

Reviewed by Cursor Bugbot for commit 0a5ff8b. Configure here.

#745)

ElemTableHeader::record_count kept the low 16 bits of the u32 at 0x02,
documented as safe because no table measured held 65,536 records. A
Nordic LCA office project's table states 72,798 (#745), so rvt-elem-table
reported 7,262 declared records and the implicit fallback layout would
parse only that many (helenkwok noted the loose end). The field is a u32
now, and parse_records takes its limit from the stated count on both
layouts. Two comparisons in existing tests cast the parsed length instead
of the count; their assertions are unchanged.
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 18, 2026 09:58
@DrunkOnJava
DrunkOnJava merged commit 32aa12d into main Oct 18, 2026
26 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/elem-table-record-count-u32 branch October 18, 2026 10:03
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.

1 participant