Skip to content

fix(ifc): aggregate each IfcSpace into its storey instead of containing it - #744

Merged
DrunkOnJava merged 4 commits into
DrunkOnJava:mainfrom
helenkwok:fix/space-aggregation
Oct 18, 2026
Merged

DrunkOnJava merged 4 commits into
DrunkOnJava:mainfrom
helenkwok:fix/space-aggregation

Conversation

@helenkwok

@helenkwok helenkwok commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Each IfcSpace is now an aggregated part of its storey (or of the IfcBuilding where no storey join reached it) through IfcRelAggregates, instead of an element of the storey's IfcRelContainedInSpatialStructure. Fixes #743.

Motivation

A space is a spatial element. Written as a contained element, it had no parent in the spatial tree: buildingSMART validation rules SPS002 and SPS007 flag it, and IfcOpenShell-based readers found no storey for the room or for the furniture B63 contains in it.

Changes

  • src/ifc/step_writer.rs: spaces go to their own per-storey list (and an unplaced list for the building) instead of the containment lists; one IFCRELAGGREGATES per storey with spaces (GlobalId from ["aggregates", <storey gid>]) and one for the building (["aggregates", "building", "spaces"]). B63's containment of elements in spaces is unchanged. Both parents are allowed by the spatial composition table (IfcSpace under IfcBuildingStorey or IfcBuilding).
  • tests/space_containment.rs: spaces_are_aggregated_into_their_storey, end to end on 2024_Core_Interior.rvt and RE1-Architecture.rvt (corpus-gated, like the file's existing test).

Testing

  • cargo fmt --check, cargo clippy --all-targets --locked -- -D warnings: clean.
  • cargo test --release --test integration -- space_containment:: project_count_fixtures:: witness with RVT_PROJECT_CORPUS_DIR = magnetar fd755e18 + the RE1 files (hashes as in CI): 11 passed. The new test fails on 120e2f9 (Core Interior 116 of 116 spaces not aggregated, RE1-Architecture 11 of 11) and passes with the change (0 and 0).
  • End to end on Snowdon Towers Sample Architectural (Autodesk sample, measured locally, not committed), with fix(elem_table): detect the record size by the ElementId, the second id #737 merged so the file reads, against a Revit 2024 IFC4 RV export of the same file: all 54 spaces have a storey as parent (IfcOpenShell 0.9.0 get_aggregate); elements on Revit's storey 5,581 of 5,945, as with v0.4.0 (main + fix(elem_table): detect the record size by the ElementId, the second id #737 alone: 4,813).
  • Witness: no observation records containment or aggregation counts (entity_counts names element types; relations is IFCRELFILLSELEMENT; storeys unchanged), so no verdict changes.
  • tools/check-local.sh --corpus (rustc 1.99.0, Debian bookworm): fmt, clippy, rustdoc and the workspace build clean; verify-real-files.sh 232 passed, 0 failed, both by default and against the corpora (phi-ag d2eb1f3, magnetar fd755e18 + RE1).
  • N/A: performance.

…ng it

A space is a spatial element. rvt-rs listed every IfcSpace among its
storey's IfcRelContainedInSpatialStructure elements, which IFC4 reserves
for elements, grids and annotations, so no space had a parent in the
spatial tree (buildingSMART validation rules SPS002 and SPS007), and
IfcOpenShell and similar readers found no storey for a space or for the
furniture B63 contains in it.

Each space is now an aggregated part of its storey, or of the building
where no storey join reached it, through IfcRelAggregates.
@helenkwok
helenkwok marked this pull request as ready for review October 10, 2026 05:28
…regates

Each storey with rooms now aggregates its spaces (10 storeys), so the
source witness counts 13 IFCRELAGGREGATES where it counted 3. Nothing
else in either observation moves, and both bridge witnesses still
replay. Taken from this PR's octetproof-core-interior artifact (run
38027323816).
@DrunkOnJava

Copy link
Copy Markdown
Owner

Thank you, this is the right fix: IFC4's spatial composition puts a space under its storey through IfcRelAggregates, and the GlobalId seeds (["aggregates", storey] and ["aggregates", "building", "spaces"]) don't collide with the existing project, site, building and element-aggregate seeds.

Sorry for the wait on CI. GitHub held this PR's runs as a first-time contribution, and nobody was watching the queue for two weeks. Runs from established accounts no longer wait for approval.

The run did catch one thing: the source witness's entity_counts includes IFCRELAGGREGATES, which goes from 3 to 13 on Core Interior (one per storey with rooms). So the committed rvt-rs observations replayed as drift. Nothing else in either observation moved, and both bridge witnesses still replay. I pushed two commits to your branch: a merge of main (for #747's lockfile, which clears the source-map-js advisory that failed viewer dependency audit on every open PR) and the two refreshed rvt-rs.json observations taken from this run's artifact. It merges once CI is green on top of #737.

@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 18, 2026 08:38
@DrunkOnJava
DrunkOnJava merged commit b88b543 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.

IfcSpace is written into its storey's IfcRelContainedInSpatialStructure instead of IfcRelAggregates (SPS002, SPS007)

2 participants