Repository navigation
feat(ifc)!: bind storeys from the Level ElementId the element record names - #267
Merged
Merged
Conversation
…ames #219 asked for a storey for the 82 elements the record-bbox join leaves unbound: 64 plan-loop IFCSLAB and 18 name-only IFCSPACE. Measured first, that set no longer exists. #212 replaced the plan-loop annotations with 100 record-backed plates and #218 replaced the eleven column-derived elevations with the fifteen real Revit Levels, so on main the unbound set is 71: 36 IFCSLAB and 10 IFCSHADINGDEVICE whose top face sits 0.1667 ft (2 in) below a storey at the structural-slab / architectural-topping interface, 6 IFCWINDOW whose record base is a 4.73 ft sill height, 1 wall starting mid-storey, and the 18 spaces. The file states the binding those elevations cannot infer. A partition element record's counted reference list at +0x88 -- the same list RE-23 reads for a door's host wall and RE-25's second list for a sketch line's owner -- names the Revit Level that hosts the element, as a plain ElementId slot. Accepted only when the list names exactly one of the recovered Levels. That is not a threshold: a Revit column or wall carries a base and a top constraint and both are in the list, so all 344 OST_Columns records that name a Level name two of them and resolve to nothing, keeping the elevation join they already bind exactly on. The uniqueness test runs against every standalone OST_Levels record id, not only the fifteen the RE-24 name/elevation recovery validates, so a Level the full recovery would drop still makes a record ambiguous; the binding half then uses only the validated fifteen. Measured on 2024_Core_Interior.rvt (sha256 c805df44...): over the 537 elements both joins answer, the two agree 537 of 537, with 0 disagreements, which is why the stated join runs first and the inferred one fills in behind it. Storey containment moves 801 -> 853 of 872, and no element bound before moves or is lost: type level ref base elev top elev unbound IFCCOLUMN 0 256 0 0 IFCDOOR 132 0 0 0 IFCSHADINGDEVICE 20 0 0 0 IFCSLAB 80 0 0 0 IFCSPACE 0 0 0 18 IFCWALL 134 225 0 1 IFCWINDOW 6 0 0 0 Reference side NOT MEASURED: the paired Revit IFC exports are not in this checkout, so none of the 853 is scored against Revit's own IfcRelContainedInSpatialStructure. Also fixes the container the unbound fall to. The STEP writer clamped a missing storey index with storey_index.unwrap_or(0), so those 71 elements -- some of them plates at 185 ft -- were emitted as contained in IfcBuildingStorey 'Basement 2' at -40 ft, indistinguishable from the 5 that belong there. Elements with no recovered storey are now contained in the IfcBuilding, which states what rvt-rs actually knows; Basement 2 drops 76 -> 6. The 18 IFCSPACE rows stay unbound and are not placed by proximity: they are recovered from partition strings, carry no element record, and so have no elevation evidence of any kind. Emitted-STEP effect on the sample: IFCRELCONTAINEDINSPATIALSTRUCTURE 13 -> 14 and IFCPROPERTYSINGLEVALUE 8435 -> 9231; IFCPROPERTYSET, IFCBUILDINGSTOREY, IFCRELFILLSELEMENT, IFCMATERIAL and every by_ifc_type count are unchanged, so no scored row in either project-count manifest moves. Both rvt-rs witness observations are regenerated for the two counts that did. Refs #219
Bugbot couldn't run - usage limit reachedBugbot 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_cfc05b74-a9f7-49bf-94c3-64c428e76c5d) |
DrunkOnJava
enabled auto-merge (squash)
September 19, 2026 18:35
2 of 3 tasks
DrunkOnJava
added a commit
that referenced
this pull request
Sep 19, 2026
…tainment of unbound elements (#268) ## Summary #267 stopped fabricating storey containment: elements with no storey evidence are now related to the `IfcBuilding` itself. The validator's ceiling of one `IfcRelContainedInSpatialStructure` per storey counted that relation as a regression on the Einhoven sample (5 against 4 storeys) and failed the `IfcOpenShell validates synthetic project` job on main (run 723). ## Changes - `tools/ci/validate-real-ifc.py`: count storey-level and building-level relations separately; storeys between 1 and the storey count, at most one building relation, nothing else; summary line reports both. ## Testing - [x] `python3 -m py_compile` clean - [ ] This PR's `IfcOpenShell validates synthetic project` job is the verification (ifcopenshell is not installed locally) ## Legal and contribution hygiene - [x] Licensable under Apache-2.0; no Autodesk material; no PII <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > CI-only assertion changes in `validate-real-ifc.py`; no runtime export or application logic is modified. > > **Overview** > Updates the real-project IFC CI validator so it matches export behavior from **#267**: elements without storey evidence may be contained via an **`IfcRelContainedInSpatialStructure`** relating to **`IfcBuilding`**, not only per-storey relations. > > Instead of requiring the total containment relation count to stay between 1 and the storey count, validation now splits relations into storey-level vs building-level, requires every relation to target one of those structures, keeps storey relations in the existing 1…storey range, and allows **at most one** building-level relation for unbound elements. The pass summary line reports storey and building relation counts separately. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a1c3c94. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
15 of 16 tasks
DrunkOnJava
added a commit
that referenced
this pull request
Sep 19, 2026
… dozen times (#266) ## Summary The weekly Performance Budgets workflow fails the `medium` category on `2024_Core_Interior.rvt`. The cost is not the geometry the August element-record work added — it is that work re-inflating the same partition bytes more than twenty times per export. This memoises the inflate on the `RevitFile` handle and fixes the two per-byte scans that dominated what was left. IFC output is byte-identical. Measured against `main` at `8425a3f` (i.e. **after** #267, #268 and #269), `ifc_export` goes **17.88 s to 1.45 s** and peak RSS **2642.0 MiB to 516.2 MiB**, and every `medium` budget passes. ## Motivation Every partition consumer opened the CFB stream, inflated all its gzip members and concatenated them for itself: - `partition_element_records::scan_category_records_multi` — once per `BuiltInCategory`: columns (RE-26), walls (#211), doors and windows (RE-23), and floors / building pads / sketch lines (RE-22, RE-25) - `partition_arc_walls::scan_partition_arc_walls_with_limits` - `partition_schema_mvp::floors_from_partition_plan_loops` and `rect_openings_from_partitions` - `partition_level_records::scan_partition_levels` (RE-24) and `scan_partition_level_ids` (RE-27, #267) - `partition_ifc_export_overrides::scan_ifc_export_overrides` - `partition_scanner::scan_partitions_with_control` - `object_graph::string_records_from_partitions`, asked for separately by unit recovery, storey names and the partition MVP `RvtDocExporter::export_with_diagnostics` then walks the document a second time to build diagnostics, doubling all of it. On this file the eight `Partitions/*` streams inflate to 178.9 MiB, so that is well over 3 GiB of redundant inflate per export — plus a byte-at-a-time `chunks.into_iter().flatten().collect()` per pass, which profiled higher than the inflate itself. Hotspot shares from a `samply` profile of `rvt-ifc --mode geometry` on the pre-change tree (inclusive, 14,467 samples): | region | share | what it was | | --- | --- | --- | | inflate + per-pass concat | 33 % + 24 % | `inflate_all_chunks_for_stream` and the `flatten().collect()` join, repeated per consumer | | `object_graph::extract_string_records` | 34 % (26 % in encoding_rs) | UTF-16 decode of the whole `Partitions/NN`, run once per consumer | | `find_category_records` | 3.6 % before, 21 % once inflate was cached | hand-rolled substring search, once per category over every partition byte | ## Changes - `src/compression.rs` — new `InflatedStream`: all gzip members of one stream inflated and concatenated once, with each member's end offset. That is exactly the two shapes the callers were rebuilding (plain concatenation; concatenation plus `chunk_ends` for the scanner), and it reserves the exact total instead of growing through `Flatten`. - `src/reader.rs` — `RevitFile::inflated_partition` memoises it per stream path, `RevitFile::partition_stream_names` replaces six copies of the same filter, and `RevitFile::partition_string_records` memoises the `Partitions/NN` string extraction. `RevitFile` never writes a stream, so one inflate is valid for the life of the handle. - `src/partition_element_records.rs`, `src/partition_arc_walls.rs`, `src/partition_level_records.rs`, `src/partition_ifc_export_overrides.rs`, `src/partition_scanner.rs`, `src/partition_schema_mvp.rs` — read through the cache instead of re-inflating. - `src/object_graph.rs` — `extract_string_records` screens candidates on the raw code units before decoding. The strict test it applies (every char graphic, space, tab or newline) is decidable on the bytes: only ASCII encodes as `[byte, 0x00]` in UTF-16LE, and every other sequence — non-ASCII, an astral pair, a lone surrogate that decodes to U+FFFD — yields a char outside that set. Previously it decoded and heap-allocated at every offset whose length field happened to land in `1..=400`, which binary data does at a large fraction of offsets, then threw nearly all of them away. - `src/partition_element_records.rs` — `find_subslice` now calls `memchr::memmem::find`, the vectorised form of the first-byte-then-compare loop it spelled out by hand. The category sweep runs it over ~180 MiB per category. - `src/ifc/mod.rs` — `recover_project_units` and `collect_partition_building_storey_names` take the shared string records. - `Cargo.toml` — adds `memchr = "2"`. **This adds no crate to the build graph**: `cargo tree -p rvt -e normal -i memchr` shows memchr 2.8.0 is already a normal (non-dev) transitive dependency through both quick-xml and serde_json. `cargo deny check` passes (advisories ok, bans ok, licenses ok, sources ok). ### Second commit: the RE-27 sweep #267 landed while this was in review and added `scan_partition_level_ids`, a new sweep over every `Partitions/*` stream — the ~2 s its author measured on Core Interior. The follow-up commit here routes it through `RevitFile::inflated_partition` like every other partition consumer, so it costs a scan rather than a decompress. With that, no partition sweep in `src/` re-inflates: ``` $ grep -rn "inflate_all_chunks_for_stream\|read_stream(&stream)\|read_stream(&partition)" src/ | grep -v "^src/compression.rs" (no matches) ``` No behaviour flags, no new public semantics, no geometry changes. ## Testing All numbers below were re-taken against `main` at `8425a3f`, after merging it into this branch. - [x] `cargo test --all` passes locally — `tools/check-local.sh` (fmt, clippy `-D warnings`, rustdoc `-D warnings`, `cargo test --workspace --all-targets --all-features`) exits 0. With `RVT_PROJECT_CORPUS_DIR` set to the magnetar Revit tree: **1252 passed, 0 failed**, including #267's new `core_interior_2024_storey_containment_is_evidence_backed` corpus gate. - [x] `cargo clippy --all-targets --all-features -- -D warnings` passes - [x] `cargo fmt --check` passes - [x] New / changed code has unit tests — no new behaviour to test; the change is covered by the existing suite plus the byte-identity evidence below. `tests/project_count_fixtures.rs` and `tests/witness_registry.rs` pass against the real reference exports (`IFC Exports/2024_Core_Interior_slim.ifc` sha256 `bfdf36ff…` and `Revit/2024_Core_Interior.ifc` sha256 `d07c7462…`, both matching the manifests), so every scored count — 15 storeys, 360 walls, 80 slabs, 132 doors, 6 windows, 256 columns, 20 shading devices, 138 `IFCRELFILLSELEMENT` pairs — is reproduced. - [x] IFC exporter byte-identity — see below. - [ ] `tools/bench.sh` — **not run**: it needs the phi-ag `rac*.rfa` sample family, which is not in this checkout. `tools/perf_budget.py` was used instead, which is the harness the failing workflow actually runs. ### Byte-identical output `rvt-ifc --mode geometry`, a binary built from `main` at `8425a3f` versus this branch, same input: | file | main `8425a3f` | this branch | | | --- | --- | --- | --- | | `2024_Core_Interior.rvt` | 1,633,625 bytes | 1,633,625 bytes | identical | | `Revit_IFC5_Einhoven.rvt` | 44,701 bytes | 44,701 bytes | identical | `diff` of the two STEP files with the `FILE_NAME` timestamp line stripped reports exactly one remaining line, the other wall-clock field the writer stamps: ``` 12c12 < #5=IFCOWNERHISTORY(#3,#4,$,.ADDED.,$,#3,#4,1789844650); --- > #5=IFCOWNERHISTORY(#3,#4,$,.ADDED.,$,#3,#4,1789844652); ``` Normalising both clock fields (drop `FILE_NAME(`, replace the `IFCOWNERHISTORY` epoch), the two sides hash the same: ``` 2024_Core_Interior main/branch sha256 4d1382e93b012761c7b1d7810760b0a0f4b9dabdbed0a9b336e407e0b738d489 Revit_IFC5_Einhoven main/branch sha256 f6c32f237338b1236757b2849148d421e7672ee5b569fc4f15545c80af640382 ``` Note these hashes differ from the pre-#267 ones — that is #267's intended storey-binding change, which this branch reproduces exactly. There is no deterministic-timestamp switch (no `SOURCE_DATE_EPOCH` support in `ifc::step_writer`), so the two clock fields cannot be pinned without a behaviour change; adding one is out of scope here. ### Performance `tools/perf_budget.py --require-category medium`, release profile, `RVT_PROJECT_CORPUS_DIR` on the magnetar Revit tree. Both columns measured on the same machine (Apple Silicon, macOS) minutes apart, baseline from a clean `main` tree at `8425a3f`: | operation | main `8425a3f` | this branch | budget | | --- | --- | --- | --- | | `open` | 14.86 ms / 34.6 MiB | 13.13 ms / 34.6 MiB | 1500 ms / 512 MiB | | `summarize` | 18.12 ms / 36.0 MiB | 18.64 ms / 36.0 MiB | 5000 ms / 768 MiB | | `schema_parse` | 14.61 ms / 35.8 MiB | 13.75 ms / 35.7 MiB | 1500 ms / 768 MiB | | `element_decode` | **6116 ms / 1858.0 MiB** | 919 ms / 478.5 MiB | 12000 ms / 1024 MiB | | `ifc_export` | **17880 ms / 2642.0 MiB** | 1454 ms / 516.2 MiB | 15000 ms / 1024 MiB | | `viewer_parse_render` | **18014 ms / 2642.6 MiB** | 1469 ms / 498.8 MiB | 18000 ms / 1024 MiB | On this machine `main` fails all three heavy rows — `ifc_export` and `viewer_parse_render` on time, all three on peak RSS. After, every row passes with an order of magnitude of headroom. `rvt-ifc --mode geometry` on `2024_Core_Interior.rvt` under `/usr/bin/time -l`, best of three: | | wall | peak RSS | | --- | --- | --- | | main `8425a3f` | 26.07 s | 2641.4 MiB | | this branch | **1.69 s** | **490.1 MiB** | `Revit_IFC5_Einhoven.rvt` control: 0.44 s / 25.1 MiB on main, 0.12 s / 20.7 MiB on this branch. For reference, the same comparison taken before #267 landed (main at `730699c`): `ifc_export` 17352 ms to 1366 ms, `element_decode` 5682 ms to 866 ms. #267 added roughly 0.5-0.9 s of `ifc_export` on the unoptimised side and none on this one, because its new sweep now reads an already-inflated buffer. **No budget change is proposed and none is needed.** Extrapolating to the GitHub runner from the ratio the workflow reported on the pre-#267 tree — CI `element_decode` 8.5 s against 5.62 s here, CI `ifc_export` 24.5 s against 17.25 s here, so roughly 1.4–1.5× — these numbers project to about 1.3 s for `element_decode`, 2.1 s for `ifc_export` and 2.1 s for `viewer_parse_render`, against budgets of 12 s, 15 s and 18 s. Worth noting that on this machine #267 pushed `viewer_parse_render` past its 18 s budget too (18014 ms against 18000 ms), so the `medium` category was getting worse, not stable. One honest caveat on the memory column: the workflow reported ~480–510 MB peak RSS for the failing baseline, where this macOS machine measures ~2640 MiB for the same baseline binary. That is an allocator difference, not a measurement error — glibc returns freed pages to the OS where macOS libmalloc retains them, and the baseline's repeated 180 MiB transient allocations are exactly the pattern that exposes it. The direction of the change is the same on both platforms: one retained copy of the inflated partitions replaces many transient ones, and peak RSS should fall on Linux too. ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR — no doc claims change; this is a pure performance change with identical output - [x] If a limitation was resolved, the relevant docs are updated — N/A, no limitation resolved - [x] If a new limitation was introduced, it is documented — one tradeoff, documented in-code on `RevitFile::inflated` and `InflatedStream`: the inflated `Partitions/*` bytes (178.9 MiB on this file) now stay resident for the life of the handle rather than being rebuilt per consumer. Measured peak RSS falls sharply anyway, because the transient copies it replaces cost more than the one it keeps. - [x] Commit messages describe WHAT changed and WHY - [x] No emojis in code, docs, or commit messages - [x] No private paths, personal email addresses, or internal jargon in committed files - [x] If this is a reverse-engineering finding: N/A, no new finding — no decoder, offset or record shape changes ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 - [x] No Autodesk proprietary source, decompiled internals, or NDA'd SDK content - [x] No new test fixtures ## Breaking changes None. Three additions to `RevitFile`'s public surface (`inflated_partition`, `partition_stream_names`, `partition_string_records`) and one new public type (`compression::InflatedStream`); `object_graph::string_records_from_partitions` keeps its signature and now returns a clone of the shared result. ## Screenshots or output samples IFC output is byte-identical to `main` at `8425a3f` — see the diff and hashes above. ## Related issues Refs the `Performance Budgets` workflow `medium` category failure. Builds on #267 (RE-27), whose new partition sweep the second commit routes through the same cache. No issue number was given for the budget failure.
Merged
17 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Sep 19, 2026
…ype record (#88) (RE-28) (#273) ## Summary Finds the Revit wall **type** record in the partition streams and uses it to give every exported wall the `IfcWallType` Revit's own export assigns — **360 of 360, exact**, up from RE-26's 356 of 360. Then reports, with numbers, why #88's compound-layer thicknesses do **not** follow from it: they are not near the record, and this corpus's reference export cannot witness them at all. No layer set is emitted and none is invented. ## Motivation #88 (RE-15-08) asks to decode `WallType.CompoundStructure`, build one `IfcMaterialLayerSet` per WallType, and emit `IfcMaterialLayerSetUsage` + `IfcRelAssociatesMaterial` per wall. #34 is the umbrella. Three prior passes on #88 were skipped for want of evidence. This pass goes and gets the evidence, and half of it comes back negative — so half of the issue's acceptance criteria are shown to be unmeetable against `2024_Core_Interior.rvt` rather than approximated. Report: `reports/element-framing/RE-28-wall-type-records.md`. ### What was proven A wall type has a partition record of the bbox-less shape RE-24 found for Levels — the element prologue, `ff ff ff ff ab 05` at `+0x50` instead of a bounding box, then a counted `u64` slot list at `+0x56`. Its placement-kind word at `+0x42` takes a **third** value, `0xffff8080`, beside the placed-instance `0xffffef7f` and type-symbol `0xffff8000` RE-21 recorded. Eight `OST_Walls` records carry that shape on this file — `1710 1711 3897 11356 17328 17337 17339 17341`. Revit exports four of them as `IfcWallType` and never places the other four, so the set is a superset by construction and is **not** used as an `IfcWallType` recovery on its own. What it is used for is the join: | rule | correct | wrong | none | |---|---:|---:|---:| | RE-26 positional `references[1]` | 356 | 4 | 0 | | **unique type-record slot in `references`** | **360** | **0** | **0** | Every one of the 360 exported wall instance records names **exactly one** distinct type-record id — never zero, never two — so the rule needs no tie-break and declines nothing. The recovered distribution equals the export's own `IfcRelDefinesByType`: 129 / 127 / 100 / 4. That closes RE-26 §9's open `18" Basement` id-space question. Those four walls carry `refs1 = [3, 1851, 3897, 20268, 20273, …]`: `1851` is a record of category −2009014 and is not a wall type, `3897` is, and a set test picks the right one where a position cannot. ### What stayed negative, and why **1. The compound layers are not near the type record.** A 128 KiB span (±64 KiB) centred on each of the four exported wall-type records, swept for every `f64` in `(0, 3]` ft and every 8-byte-aligned run of consecutive plausible `f64`: | type | nominal (ft) | plausible `f64` | equal to a nominal | runs summing to a nominal | |---:|---:|---:|---:|---:| | 3897 | 1.5 | 392 | 5 | **0** | | 17328 | 0.6667 | 202 | 2 | **0** | | 17337 | 0.5 | 202 | 2 | **0** | | 17341 | 0.5 | 204 | 2 | **0** | Not one run. And the nine exact-nominal hits are all `0.6666666666666666`, the nearest 26301 bytes away, while the two 6" types have no `0.5` hit anywhere in their span — so they are not the types' own widths either. **2. The reference export cannot witness a layer set at all.** `2024_Core_Interior_slim.ifc` is a `ViewDefinition [ReferenceView_V1.2]` export: **0** `IFCMATERIALLAYERSET`, **0** `IFCMATERIALLAYER`, **0** `IFCMATERIALLAYERSETUSAGE`, against 150 `IFCMATERIALCONSTITUENTSET` and 309 `IFCMATERIALCONSTITUENT`. All 360 `IFCWALL` associate to a **single** `IFCMATERIAL` (`Default Wall` ×356, `Concrete` ×4), never to a constituent set, so the export does not even say how many layers a wall type has. The only compound-layer widths in the whole file are three **dangling** `IFCQUANTITYLENGTH` rows under `IFCSLABTYPE 'Floor:Basement Slab'` (4" + 14" = 18") that nothing references. So #88's criterion "layer thicknesses round-trip from Revit-bytes within tolerance" has **no oracle on this artifact**, and its "at least 5 distinct `IfcMaterialLayerSet`" would be five entities this file's own author never wrote. Closing #88 needs a layer-set-carrying export of the same `.rvt` (DesignTransferView / full `Qto_WallBaseQuantities`) or an owner-supplied wall-type schedule. Until one exists, nothing emits a layer. **3. Materials are bounded, not recovered.** `OST_Materials` is −2000700, and **86** records carry it in the same bbox-less shape — a closed, byte-derived set against the display-name filter's 102 and the export's 10. But they carry **no name**: the RE-24 owner/sentinel/UTF-16 name block resolves **0 of 86**, and relaxing its elevation-marker requirement produces 165 blocks that are mostly garbage (`'ڱ'`, `'ï¿¿ï¿¿קï¿¿'`) — measured negative, the elevation marker was doing the fail-closed work. The name does live in a parameter table (the owner id appears twice, 58–60 bytes apart, at a **variable** distance before the string, with 12-byte entries carrying large negative `i32` parameter ids between), but that framing is recorded, not decoded. The manifest rows stay `known_gap`. One material join the bytes do make, recorded as corroboration only: type `3897`'s slot list leads with `3652`, an `OST_Materials` record, and the four walls of type `3897` are exactly the four Revit associates with `Concrete`. The other three exported wall types carry no material slot at all while their walls all export as `Default Wall`, so there is no rule here yet and none ships. ## Changes - `src/partition_type_records.rs` (new) — the record shape, fail-closed at every step (undeclared id, wrong prologue magic, non-zero `+0x10`, category outside the published band, the element-record marker, a zero / absurd / overrunning slot count, and a slot list that does not name the record's own id all reject), plus `type_definition_ids` and `unique_type_reference`, which returns `None` rather than guessing when a list names two different types. - `src/lib.rs` — one module declaration. - `examples/probe_re28_walltype_layers.rs` (new) — the probe behind every number above, in three modes (`ids`, `category`, `string`), with the layer sweep built in so the negative is reproducible. - `tests/iter_elements_typed.rs` — two corpus gates: `core_interior_2024_wall_type_record_join` (the eight-record set, the 360/360 join, the 129/127/100/4 histogram, and the four basement walls explicitly) and `core_interior_2024_material_record_family` (86 records, own-id-in-slots on all 86, and the 3897 → 3652 slot). - `tests/fixtures/project-counts/2024-core-interior{,-slim}.json` — the `materials` notes record the 86 and the §5/§6 reasons; the slim `walls` note records the join. Statuses and every expected/decoder number are unchanged. - `reports/element-framing/RE-28-wall-type-records.md` (new). ## Testing - [x] `cargo test --all` passes locally — `tools/check-local.sh` green (fmt, clippy `-D warnings`, rustdoc `-D warnings`, full workspace suite); plus the corpus-enabled run with `RVT_PROJECT_CORPUS_DIR` set, 155 green test binaries, 0 failures. - [x] `cargo clippy --all-targets --all-features -- -D warnings` passes - [x] `cargo fmt --check` passes - [x] New / changed code has unit tests — 14 unit tests on synthetic records in `partition_type_records::tests`, written before the corpus gates, covering the happy path, the undeclared id, the element-record shape, a slot list missing the own id, an overrunning and an absurd slot count, the category scan skipping element records, and all five `unique_type_reference` branches. - [x] `RVT_PROJECT_CORPUS_DIR=… cargo test --profile ci --test project_count_fixtures` passes (both manifests). - [x] IFC exporter: **not touched**. No emitted entity, property or relation changes; `tests/fixtures/synthetic-project.ifc` is byte-identical (untouched since #267), and every committed OctetProof observation and both `verdict.json` are byte-identical. Wiring the join onto the emitted wall would add 360 `IFCPROPERTYSINGLEVALUE` rows and move both committed witness observation hashes; that is deliberately left to a follow-up so this PR carries no observation churn. - [x] N/A: no element decoder added (this is a record decoder, not an `elements::` class decoder), no performance change. ## Audit-honesty checklist - [x] README / docs reflect the current state — nothing here claims a shipped feature that is not in this PR; the layer set is explicitly *not* shipped. - [x] Limitations resolved: RE-26 §9's `18" Basement` type-slot question is closed and the report says so. - [x] New limitations documented: RE-28 §8 (Open) lists the layer-thickness block, the material-name parameter table, the unattributed slot-list slots, and the deliberate non-wiring of the join into the export. The module's `# Honesty` section carries the same. - [x] Commit message describes what changed and why. - [x] No emojis. - [x] No private paths, personal emails, or internal jargon in committed files. - [x] Reverse-engineering finding: reproducible probe under `examples/` and a dated report at `reports/element-framing/RE-28-wall-type-records.md`. The `docs/rvt-moat-break-reconnaissance.md` addendum stream ended at 2026-04-19; every element-framing finding since RE-21 lands in `reports/element-framing/` instead, and this follows that precedent. ## Legal and contribution hygiene - [x] Apache-2.0. - [x] No Autodesk proprietary source, decompiled internals, or NDA'd SDK content. **Clean-room declaration:** the changes in this PR are based on §Accepted sources 1 (public byte observations of an MIT-licensed corpus file), 3 (publicly-published `BuiltInCategory` enumeration listings, for `OST_Materials = -2000700` and the `-2009014` / `-2000576` values that are *recorded*, not relied on), and 4 (the IFC4 / buildingSMART specification, for reading the reference export). I have not used Autodesk SDK source, ODA SDK source, leaked internal documentation, NDA material, or decompiled internal Revit implementation code beyond public symbol exports. - [x] No new test fixtures; no PII. ## Breaking changes None. Additive module plus two new corpus tests; no public API changed, no emitted output changed. ## Screenshots or output samples IFC output did not change. The probe's layer-sweep output is the §4 table above; reproduce with the commands in RE-28 §9. ## Related issues Refs #88 #34 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Additive decoder module, tests, and documentation; no export or public API breakage and no change to emitted IFC output. > > **Overview** > Adds **`rvt::partition_type_records`** to decode bbox-less partition *type* records (wall types, materials) with fail-closed validation, plus **`unique_type_reference`** so each exported wall picks the single wall-type id in its reference list — **360/360** on `2024_Core_Interior.rvt`, fixing RE-26’s positional `references[1]` misses for `18" Basement` walls. > > **Library and research only:** no IFC entities, properties, or manifest count changes; the join is not yet emitted on walls. A new **`probe_re28_walltype_layers`** example and **RE-28** report document measured negatives — no compound layer thicknesses near type records, ReferenceView export has no layer-set oracle, and **86** `OST_Materials` records without a name recovery path. Corpus gates and project-count **notes** capture the join and material bounds. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c6aea23. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
8 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Sep 19, 2026
## Summary Docs-only. PR #261 described the state at that moment; #266, #267/#268, #272, #273 and #274 landed after it and left several pages understating or contradicting what ships. Every number here is re-read from the linked report, the corpus gate, or the count manifest that backs it — nothing is carried over from the PR descriptions. ## Motivation Two pages disagreed with themselves. `docs/user-guide.md` gave both 853 of 872 and 801 of 872 storey containment in adjacent paragraphs, and quoted 336 of 360 walls, which #274 superseded. `docs/status.md` still said the wall-join decision "is in neither wall's box nor in 4 KiB past its record" — #274 found the carrier. Four pages still promised a ~28 second browser decode that #266 cut to about 3 seconds. The audit-honesty rule cuts both ways here: the same pass also had to avoid over-claiming #273, whose wall-type join is exact but emits nothing. ## Changes - **`docs/status.md`** — re-dated the RE-26 wall and column residuals as historical; added RE-29 (wall ends 689 → 711 of 720, bodies 336 → 351 of 360, 15 improved / 345 unchanged / 0 regressed, 9 residual ends at two true L corners; columns 176 → 256 of 256 at a worst residual of 9.4e-13 ft, `difference_box` fail-closed, `IFCPROPERTYSINGLEVALUE` 9231 → 9311) and RE-28 (the `0xffff8080` wall-type record, 360 of 360, distribution 129/127/100/4, #240 as an index artifact) with an explicit **library-side only, nothing emitted** paragraph; recorded #88's no-oracle finding and the 86-record `OST_Materials` bound; new `## Performance` section. - **`docs/user-guide.md`** — deleted the contradictory 801 of 872 paragraph; 336 → 351 of 360 plus the 256 of 256 column cut; added the #272 panel/schedule paragraph and a `### Performance` note; corrected the demo-gallery decode time. - **`README.md`** — the headline paragraph, the gaps table row and the demo-gallery line now carry the RE-27/RE-28/RE-29 state; new `### Performance on large projects`. - **`docs/contribution-map.md`** — the closed-issue list is now twelve issues, not six; the #33 / #219 row reads 853 of 872 and keeps the reference side marked `NOT MEASURED`; new rows for #238, #88, #227, #34 and #90; the closed #32 row is gone. - **`docs/support-matrix.json`** — `reviewed` to 2026-09-19; the walls and columns rows carry the RE-29 measurements and **stay `partial`**; a new `element-record-wall-type-join` row records RE-28 at `partial` with "None yet in the exported file" as its user impact; the instance-recovery and level-record rows no longer read 801 as current. - **`docs/supported-profile.md`** — IFC output and browser viewer rows; the compound-layer and family-profile bullets now name the no-oracle finding and the 9-end residual. - **`docs/ifc-compare.md`** — divergence table updated to the measured state, plus a plain statement that `catalogued_divergence_notes` in `src/ifc/compare.rs` still quotes the pre-#274 figures and still names #219 for slabs and windows. - **`docs/viewer-api.md` / `docs/viewer-build-pipeline.md`** — the #266 throughput and the `DECODE_BYTES_PER_SECOND` basis; the pre-#266 figures are kept but dated; the `build_gltf` `extras` fix and the panel / schedule contract from #272. ## Testing - N/A: docs-only PR — no Rust, viewer, workflow or test file is touched. - `docs/support-matrix.json` re-validated against `docs/schemas/support-matrix.schema.json` (required keys, `additionalProperties`, id pattern, status vocabulary, unique ids) and against the `honesty_invariants` that `tests/support_matrix.rs` enforces: `never_verified_capability_ids`, `max_status_by_capability_id`, and the COR-001 converter-grade rule. All pass; the new row is `partial`. - Every test and function name cited in the new prose was checked to exist: `the_surviving_side_of_a_true_l_corner_is_still_over_trimmed`, `core_interior_2024_column_join_cut_plan_extents`, `core_interior_2024_wall_joins_are_named_in_the_reference_list`, `core_interior_2024_wall_type_record_join`, `core_interior_2024_material_record_family`, `core_interior_2024_wall_join_trimmed_bodies`, `core_interior_2024_column_type_symbol_join`, plus `partition_type_records::{type_definition_ids, unique_type_reference}` and `element_record_column_cuts::{difference_box, column_cut_boxes}`. - `core_interior_2024_wall_join_trimmed_bodies` asserts `resolved == 360` and `trimmed == 322`, which is what the support-matrix evidence string now says. - Every relative link and repo path added resolves on disk. ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR — no claims of features that are not actually shipped - [x] Resolved limitations updated: #239 (columns), #240 (the `18" Basement` slot), and the plate / window storey containment #219 tracked - [x] New limitations documented: the 9 true-L-corner ends, and #88 being unwitnessable on this corpus - [x] No emojis, no private paths, no personal email addresses - [x] N/A: no reverse-engineering finding is introduced here — the reports (RE-27, RE-28, RE-29) already shipped with their own PRs **Three claims deliberately not written:** 1. **Nothing about rooms.** `gh pr view 275` reported `OPEN` (checked twice, at the start and just before committing), so the existing space claims are untouched and `IFCSPACE` still reads "name-only, placeholder body" everywhere. 2. **The wall → `IfcWallType` join is never described as shipping in the export.** RE-28 §7 says "Library only. No emitted IFC entity, property or relation changes", and §8 says the join "is not yet a property on the emitted wall". Every mention says so explicitly. 3. **README's "419 MB of linear memory" is left alone.** That is a wasm32 figure from #256. #266 re-measured native peak RSS (490.1 MiB) and the browser decode time, but not wasm linear memory, so there is no measurement to replace it with. Also left as-is, and now flagged in `docs/ifc-compare.md` rather than silently papered over: the note constants in `src/ifc/compare.rs` still say "31 over-trimmed wall ends" and still name #219 for `IFCSLAB` and `IFCWINDOW`. Fixing those is a code change and out of scope for a docs-only PR. ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 - [x] No Autodesk proprietary source, decompiled internals, or NDA'd SDK content - [x] N/A: no new test fixtures ## Breaking changes None. ## Screenshots or output samples N/A: docs-only PR — no UI or IFC output changed. ## Related issues Refs #88, #219, #238, #239, #240, #266, #272, #273, #274. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Documentation and support-matrix metadata only; no Rust, viewer, or export logic changes. > > **Overview** > **Docs-only refresh** so README, status, user guide, contribution map, supported profile, IFC compare notes, viewer docs, and `docs/support-matrix.json` match what landed after #266–#274 — without changing runtime behavior. > > **Capability numbers and gaps** are brought up to date: wall runs trimmed using the record **reference list** (351/360 world-exact, 9 L-corner ends still wrong), **column bodies** as prism minus named cutting walls (256/256), **storey binding** via record Level ids (853/872), and **wall→wall-type** join exact in the library but **not written to IFC** (#88 compound layers marked **no oracle** on the ReferenceView corpus). > > **Performance narrative** is added/updated everywhere it was still ~28s: partition inflate **memoized on `RevitFile`** (#266), Core Interior **~1.7s / ~490 MiB** native and **~3s** browser decode, byte-identical IFC aside from timestamps. > > **Viewer docs** now describe **glTF `extras`** for picking (#272), the typed info panel / schedule / host navigation, and **`DECODE_BYTES_PER_SECOND`** for loading hints. > > **Contribution map & matrix** list twelve closed issues, new remainder rows (#238, #88, #227, …), RE-29 evidence on wall/column rows, and a new **`element-record-wall-type-join`** row at `partial`. **`docs/ifc-compare.md`** documents the measured divergence table and explicitly notes that **`catalogued_divergence_notes` in `src/ifc/compare.rs` still lags** (separate code fix). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit d5c32eb. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This was referenced Sep 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A Revit 2024 partition element record names the
Levelthat hosts the element, in the counted reference list at+0x88. Binding on that — accepted only when the list names exactly one recovered Level — moves storey containment on2024_Core_Interior.rvtfrom 801 to 853 of 872 emitted building elements, with 0 disagreements against the existing elevation join across the 537 elements both answer. Separately, an element with no recovered storey is now contained in theIfcBuildinginstead of being written into whichever storey happens to be first.Motivation
#219 asked for a storey for 82 unbound elements: 64 plan-loop
IFCSLABand 18 name-onlyIFCSPACE. Measured first, that set no longer exists. #212 replaced the plan-loop annotations with 100 record-backed plates and #218 replaced the eleven column-derived elevations with the fifteen real Revit Levels, so the unbound set onmainis 71:IFCSLABIFCSHADINGDEVICEIFCWINDOWIFCWALLIFCSPACEAnd all 71 were nevertheless emitted as contained in
IfcBuildingStoreyBasement 2at −40 ft, because the writer clamped a missing index withstorey_index.unwrap_or(0)— 71 containment claims nothing had measured, indistinguishable from the 5 that belong there.The rule
A record that names no Level, or two or more, resolves to nothing and keeps whatever the elevation join gives it. That is not a tuning threshold: a Revit column or wall carries a base constraint and a top constraint and both are in the list, so every one of the 344
OST_Columnsrecords that names a Level names two, as do 432 of 638OST_Walls. Nothing in the bytes says which slot is the base, so picking one would be a guess. The columns lose nothing — all 256 already bind exactly on their base elevation.The uniqueness test runs against the broader id set (every standalone
OST_Levelsrecord, not only the fifteen RE-24's name/elevation recovery validates), so a Level the full recovery would drop still makes a record ambiguous. The binding half then uses only the validated fifteen; a named Level outside them binds nothing.Measured agreement, per category (placed instances):
OST_FloorsOST_BuildingPadOST_ColumnsOST_WallsOST_DoorsOST_Windows537 of 537 agree, which is why the stated join runs first and the inferred one fills in behind it.
Changes
src/element_record_level_refs.rs(new) —unique_level_reference, them_levelIdfield andLevelElementIdproperty names, and five unit tests covering both fail-closed edges.src/partition_level_records.rs—scan_partition_level_ids: the broad Level id set in one sweep, no name/elevation blocks.src/partition_schema_mvp.rs—element_record_decodedattachesm_levelIdand flipsm_level_bound; the level-id set is recovered once inrecover_partition_schema_mvpand threaded to every category rather than re-scanned per category.src/ifc/export_content.rs—LevelBindResolvedis nowtruewhen a Level was named, withLevelElementIdandLevelBindSourcebeside it.src/ifc/mod.rs—apply_record_level_reference_storeys, running before the Bind recovered columns to storeys via the record bbox base elevation #213 elevation join, which now leaves an already-bound element alone;apply_partition_level_storeysrecords the Level id → storey index map into aLevelStoreyBind; the stale "ElementId↔Level binding is still pending" warning now reports the real count.src/ifc/step_writer.rs— storey-less elements are contained in theIfcBuilding, not instorey[0].tests/iter_elements_typed.rs— new corpus gatecore_interior_2024_storey_containment_is_evidence_backed(skips when the sample is absent).tests/ifc_synthetic_project.rs+tests/fixtures/synthetic-project.ifc— the storey-less element now gets its own containment relation on the building; see "IFC output" below.reports/element-framing/RE-27-level-reference-storey-bind.md+examples/probe_re27_level_reference.rs— the finding and its reproducible probe.docs/status.md,docs/user-guide.md,docs/export-diagnostics.md,docs/support-matrix.json,CHANGELOG.md, both project-count manifests, bothrvt-rswitness observations.IFC output
target/ci/rvt-ifc _project_corpus/Revit/2024_Core_Interior.rvt --mode geometry:IFCCOLUMNIFCDOORIFCSHADINGDEVICEIFCSLABIFCSPACEIFCWALLIFCWINDOWBefore: 0 / 747 / 54 / 71.
IfcBuildingStoreyIFCRELCONTAINEDINSPATIALSTRUCTUREIFCPROPERTYSINGLEVALUEIFCPROPERTYSET/IFCBUILDINGSTOREY/IFCRELFILLSELEMENT/IFCMATERIAL/ everyby_ifc_typeBasement 2contained elementsEvery element bound in both exports keeps the same storey: 801 of 801, 0 moved, 0 lost.
tests/fixtures/synthetic-project.ifcis not byte-identical, and the diff is the intended behaviour change: the one element withstorey_index: Nonemoves out of#146(Ground Floor) into its own#148=IFCRELCONTAINEDINSPATIALSTRUCTURE(...,(#130),#20)on theIfcBuilding, and itsIfcLocalPlacementparent moves from the Ground Floor placement to the building placement (both are at the origin, so no coordinate changes). The header timestamp moved because the fixture was regenerated.What is NOT claimed
IFC Exports/2024_Core_Interior_slim.ifc,Revit/2024_Core_Interior.ifc) are not in this checkout, so none of the 853 is scored against Revit's ownIfcRelContainedInSpatialStructure. Every number above is measured on the.rvtand on rvt-rs's own emitted STEP. Noexpected_*value in either manifest was touched.IFCSPACErows stay unbound and are not placed by proximity — they come from partition strings, carry no element record, and have no elevation evidence of any kind. So doesWall 55840, whose record names no single Level. 82 emitted elements have no storey containment: 64 plan-loop slabs and 18 name-only spaces carry no element-record bbox #219 is thereforeRefs, notCloses.level_bind.rsbinds a typedFloor/Roomthrough anm_level_idschema field; that field is still unrecovered andlevel-elementid-storey-bindstaysunsupportedin the support matrix. A new, narrowerrecord-level-reference-storey-bindrow carries this claim with its scope stated.partition_element_recordsorpartition_level_recordsdecline, the level-id set is empty, the join resolves nothing, and every element keeps the elevation join it had. Verified unchanged on the 2023 Einhoven sample.Testing
cargo test --allpasses locally —tools/check-local.shgreen (fmt, clippy-D warnings, rustdoc-D warnings,cargo test --workspace --all-targets --all-features)cargo clippy --all-targets --all-features -- -D warningspassescargo fmt --checkpasseselement_record_level_refs, 3 inifc::tests(a_named_level_reference_binds_an_element_no_elevation_join_reaches,an_unknown_level_reference_stays_unbound,the_elevation_join_leaves_a_level_reference_bind_alone), all written failing firsttests/fixtures/synthetic-project.ifcdiff documented above with rationaleRVT_PROJECT_CORPUS_DIRset (both magnetar.rvtsamples): 54 suites green, includingiter_elements_typed(11),witness_verdict(2),ifc_roundtrip,ifc_export_modes,arc_wall_corpus,support_matrix,json_schema_contracts,witness_registryproject_count_fixtures::project_count_manifests_match_available_corpuscannot complete locally — it panics at manifest resolution onreference IFC missing at .../IFC Exports/2024_Core_Interior_slim.ifc, which is absent from this corpus checkout, before any decoder work runs. It fails identically onmainhere. The schema half (project_count_manifests_are_complete_and_explicit) passes, and nodecoder_*value in either manifest moved.tools/bench.shnot rerun; export wall time on the 33.7 MB sample went 25.2 s → 27.2 s for the one added partition sweep)Audit-honesty checklist
docs/status.md,docs/user-guide.md,docs/export-diagnostics.mdanddocs/support-matrix.jsonall updated, including correcting the Storeys: four export elevations (-40, -20, 15, 185.5 ft) carry no OST_Columns record; names stay unpaired with the 11 recovered elevations #218 row's now-stale "46 plates remain unbound" sentencestatus.md, the RE-27 report and the manifest notesexamples/probe_re27_level_reference.rsand a dated report atreports/element-framing/RE-27-level-reference-storey-bind.md, matching where RE-21…RE-26 live.docs/rvt-moat-break-reconnaissance.mdcarries no RE-2x addenda and was not touched.Legal and contribution hygiene
BuiltInCategoryconstantsBreaking changes
Rust API only, within the pre-1.0 crate:
partition_schema_mvp::{columns,walls,slabs,openings,instances}_from_partition_category_recordsand{column,wall,opening}_instances_from_records/instances_from_records/columns_from_recordstake a&BTreeSet<u32>of Level ElementIds (obtain it with the newpartition_schema_mvp::level_element_ids, or pass an empty set to keep the old behaviour). IFC output changes as described above.Related issues
Refs #219. Refs #86 / RE-20 (still unsupported for the typed
m_level_idjoin).Note
Medium Risk
Changes IFC spatial containment semantics and export ordering (record Level bind before elevation); scope is Revit 2024 partition records with fail-closed rules, but downstream viewers comparing containment will see different grouping for previously mis-placed elements.
Overview
Revit 2024 IFC export now binds building elements to storeys using the host Level ElementId named in each partition element record (#219, RE-27), when the record’s
+0x88reference list names exactly one recovered Level. That join runs before the existing elevation match, leaves already-bound elements alone, and surfacesLevelBindResolved,LevelElementId,LevelBindSource, andStoreyBindSource = record_level_referenceon emitted elements. Columns and walls that name two Levels (base/top constraints) are declined and keep the elevation join.Elements with no recovered storey are no longer written into the first storey. The STEP writer used to use
storey_index.unwrap_or(0); they are now related toIfcBuildingvia a separateIfcRelContainedInSpatialStructure, so “storey unknown” is explicit instead of falsely placing items (e.g. 71 elements intoBasement 2on Core Interior).On
2024_Core_Interior.rvt, measured containment rises 801 → 853 of 872 building elements in a named storey (plates below level, windows at sill height, etc.), with 19 still unbound (18 name-only spaces, one wall). Docs, support matrix, corpus gates, RE-27 report, and witness observation hashes reflect the new properties and relation count.Reviewed by Cursor Bugbot for commit 0ba6217. Configure here.
BREAKING CHANGE: the five
partition_schema_mvpentry points now take the recoveredLevelElementId set (&BTreeSet<u32>, seelevel_element_ids) so the record reference list can be tested for a unique Level; callers that used the previous two-argument forms must pass it.