Skip to content

feat(elements): recover all 15 Revit Level names and elevations from partition Level records (#218) (RE-24) - #230

Merged
DrunkOnJava merged 2 commits into
mainfrom
feat/storey-names-and-elevations
Aug 30, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
feat/storey-names-and-elevations

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Aug 30, 2026 •

Copy link
Copy Markdown
Owner

The Levels are elements

#213 derived storey elevations from the bounding-box distribution of the recovered column records: 11 of the export's 15, with no names, because a rank join of 12 name candidates onto 11 elevations mislabels — it puts Level 6 at 91 ft where Revit puts Level 7. The four it missed (−40, −20, 15, 185.5 ft) carry no column record, so no distribution over column bases can ever contain them.

The Levels are in the file as elements. A Revit Level has a BuiltInCategory (OST_Levels, −2000240), so it is framed like one.

The record: an element prologue with no bounding box

Scanning the eight partition streams for the 8-byte LE encoding of −2000240 finds 190 hits; partition_element_records::decode_at accepts zero. The prologue is not the problem — on Partitions/46 +228578:

+0x00  87 3c 01 00 00 00 00 00   ElementId 81031, declared in Global/ElemTable
+0x08  8f 00 00 00               flags
+0x0c  9f 05 00 00               0x0000059f, as on every element record
+0x10  00 00                     0
+0x12  90 7a e1 ff ff ff ff ff   BuiltInCategory −2000240 = OST_Levels
+0x1a  ff × 24                   sentinel padding
+0x32  85 3c 01 00 00 00 00 00   container ElementId 81029
+0x3a  ff × 8                    sentinel
+0x42  7f ef ff ff               placement kind, PLACED
+0x46  0a 00 00 00               unattributed
+0x4a  76 09                     unattributed
+0x4c  00 00 00 00               0   (0xffffffff on a bbox-bearing record)
+0x50  ff ff ff ff ab 05         record marker
+0x56  03 00                     record kind

The divergence is at +0x4c. A bbox-bearing record carries ff ff ff ff there, 46 01 at +0x50, ff ff ff ff ab 05 at +0x52 and 48 bbox bytes at +0x58. A Level record carries 00 00 00 00 at +0x4c and the same six marker bytes two bytes earlier, then a u16, then the next record — 151 bytes apart. A datum plane is not a solid, so it has no bounding box, so the reader that requires one at +0x50 rejects it. src/partition_level_records.rs is that reader with the bbox requirement replaced by the six-byte marker; nothing else about the prologue changes.

75 records carry OST_Levels. Which of them is a Level element is the #211 instance test, unchanged:

selection n
OST_Levels records total 75
container member (+0x32 set) 59
type / symbol envelope (+0x42 = 0xffff8000) 1 (ElementId 1673)
standalone placed instance 15

The name / elevation block

Framed the way RE-22 framed the per-instance IFC Export As override — an owning ElementId at a fixed negative offset from the value:

V-0x47  u64  owning ElementId
V-0x3f  56B  0xff sentinel run
V-0x07  3B   0x00
V-0x04  u32  name length, UTF-16 code units
V       2n   the name, UTF-16LE
…            variable-length parameter run
M       8B   05 00 00 00 48 02 00 00
M+55    f64  elevation, feet
M+208   f64  the same elevation again

Two things were found the hard way:

  • The gap between the name and the marker is not fixed — 347 bytes for fourteen levels, 363 for Basement 2, whose block carries one extra entry. A fixed name_end + 402 offset read 0.0 there, a plausible elevation that would have shipped a wrong storey. The marker is searched forward within 2048 bytes and the copy at +153 must agree bit-for-bit.
  • The owner slot is the discriminator, not the name. Level 3 - Wall Layouts 1 appears nine times in Partitions/46; at +21322916 it is paired with 46.0 ft and at +21323710 Level 4 - Wall Layouts 2 with 61.0. Every wrong pair is owned by an OST_Levels record that is a container member (31636, 31637, 33628, 33629, 21990, …) — exactly what the Partition element-record recovery for walls / doors / windows: recall is 100%, precision is not #211 test already excludes. Filtering to the 15 standalone Level ids leaves 15 blocks in the whole file.

The scan itself walks maximal 0xff runs, requires the owner to be declared in Global/ElemTable and requires the two elevation copies to agree. A run of exactly 56 is required, which the owner's own encoding guarantees can only start where the framing says (an ElementId is a u32, so its high four bytes are zero).

15 / 15, names and elevations

ElementId recovered name recovered elevation (ft) export Name export Elevation
20273 Basement 2 −40 Basement 2 −40. ✓
20272 Basement 1 −20 Basement 1 −20. ✓
20268 Level 1 0 Level 1 0. ✓
20275 Mez 1-2 15 Mez 1-2 15. ✓
20274 Level 3 - Wall Layouts 1 31 Level 3 - Wall Layouts 1 31. ✓
20276 Level 4 - Wall Layouts 2 46 Level 4 - Wall Layouts 2 46. ✓
20277 Level 4 - Wall Layouts 3 61 Level 4 - Wall Layouts 3 61. ✓
20308 Level 6 76 Level 6 76. ✓
20307 Level 7 91 Level 7 91. ✓
20306 Level 8 106 Level 8 106. ✓
20305 Level 9 121 Level 9 121. ✓
20304 Level 10 136 Level 10 136. ✓
20303 Level 11 151 Level 11 151. ✓
20302 Level 12 166 Level 12 166. ✓
65128 Level 13 185.5 Level 13 185.5 ✓

No wrong pair, no missing storey, no extra storey — on both reference exports, which carry the same 15 IfcBuildingStorey. Note the ElementId order and the elevation order do not agree (65128 is the top level, 20302…20308 run downwards), so a rank join on ids would have been as wrong as the rank join on names #213 rejected. The pairing survives because the file states it.

Recovery is all-or-nothing per file: a Level with no accepted block emits nothing, and the whole set is discarded unless every Level record owns exactly one block and no two levels share an elevation. element_record_storeys survives as the fallback.

Binding, before and after

Containment logic is untouched — exact elevation match, plates by their record top face, fail-closed on a miss and on an ambiguity. Only the storey set is wider.

11 storeys (#213) 15 storeys (RE-24)
IFCCOLUMN 256 / 256 256 / 256
IFCDOOR 132 / 132 132 / 132
IFCWALL 355 / 360 359 / 360
IFCSLAB 41 / 80 44 / 80
IFCSHADINGDEVICE 10 / 20 10 / 20
IFCWINDOW 0 / 6 0 / 6
IFCSPACE 0 / 18 0 / 18
total bound 794 / 872 801 / 872

Two #219 expectations did not hold, and the numbers say so rather than the prose:

  • The 6 windows still bind to nothing. Never an elevation-set problem: a window record's base is its sill height (80.73, 95.73, … ft), which RE-21 already measured at 0 of 6. Binding a window needs its host level, not more elevations.
  • 46 of the 49 unbound plates stay unbound (36 IFCSLAB + all 10 unbound IFCSHADINGDEVICE); three bind. RE-22 measured why: they sit 0.1667 ft below their level, at the structural-slab / architectural-topping interface. That is 82 emitted elements have no storey containment: 64 plan-loop slabs and 18 name-only spaces carry no element-record bbox #219's real content — a thickness question.

Cross-witness surface

levels moves from decoder_baseline to known at tolerance 0 on both manifests (diagnostics.exported.storey_count = 15, both references carry 15 IfcBuildingStorey).

A count is a weak claim, so the pair set is gated too, as OctetProof 1.1.0's second additive field class (storeys, spec §20.2 — a separate top-level payload key and a separate verdict field class from #222's relations). One complication is real: the two sides declare different length units. Revit's export of this imperial project declares FOOT as an IfcConversionBasedUnit over METRE and writes -40.; rvt-rs declares METRE and writes -12.192000. Both are faithful; the raw numbers differ by 3.28.

So each witness resolves its own file's LENGTHUNIT before emitting and renders feet at 1e-6 as a fixed six-decimal string (a string, not a number, so §7.3's canonical form stays integer/string only):

witness reads unit resolution
rvt-rs its own emitted STEP walks IfcProject → IfcUnitAssignment itself
IfcOpenShell 0.8.5 Revit's .ifc ifcopenshell.util.unit.calculate_unit_scale
IFClite 7.1.1 Revit's .ifc ifc_lite_core::extract_length_unit_scale

All three payloads are byte-identical on both artifacts.

Verdicts

magnetar-2024-core-interior: PASS — witnesses ifc-lite, ifcopenshell, rvt-rs
  surface: 6 fields, excluded: 10, diffs: 0
magnetar-2024-core-interior-slim: PASS — witnesses ifc-lite, ifcopenshell, rvt-rs
  surface: 13 fields, excluded: 3, diffs: 0

Claimed surface, slim (11 → 13): entity_counts.IFCBUILDINGSTOREY, …IFCWALL, …IFCSLAB, …IFCROOF, …IFCDOOR, …IFCWINDOW, …IFCCOLUMN, …IFCBEAM, …IFCFLOWTERMINAL, …IFCUNITASSIGNMENT, …IFCSHADINGDEVICE, relations.IFCRELFILLSELEMENT, storeys.IFCBUILDINGSTOREY.
Element fixture (4 → 6): entity_counts.IFCBUILDINGSTOREY, …IFCROOF, …IFCBEAM, …IFCFLOWTERMINAL, …IFCUNITASSIGNMENT, storeys.IFCBUILDINGSTOREY. Unusually for this corpus the thin 20 KB fixture supports the field as strongly as the 19879-entity export: Revit writes the complete fifteen-storey hierarchy into an export carrying one building element.

Storey payload, identical across all three witnesses:

"storeys": {
  "IFCBUILDINGSTOREY": [
    ["Basement 1", "-20.000000"], ["Basement 2", "-40.000000"],
    ["Level 1", "0.000000"], ["Level 10", "136.000000"],
    ["Level 11", "151.000000"], ["Level 12", "166.000000"],
    ["Level 13", "185.500000"], ["Level 3 - Wall Layouts 1", "31.000000"],
    ["Level 4 - Wall Layouts 2", "46.000000"], ["Level 4 - Wall Layouts 3", "61.000000"],
    ["Level 6", "76.000000"], ["Level 7", "91.000000"],
    ["Level 8", "106.000000"], ["Level 9", "121.000000"],
    ["Mez 1-2", "15.000000"]
  ]
}

Spec / schema changes (1.1.0 additive, §20.2)

  • §7.2 — new field class storey sets: exact equality of the sorted set of (name, elevation rounded to 1e-6 ft), no tolerance concept. Documents the unit normalization, why the elevation is a string, and why Unicode normalization is deliberately not applied to the name (three runtimes, three Unicode tables — a normalizer that disagrees between them would launder a real difference into agreement; the strict direction is correct for a gate).
  • §9.4 — storeys joins the coverage vocabulary next to relations.
  • §6.1 — manifests gain a storeys block parallel to counts and relations.
  • §6.2 — the observation payload gains an optional storeys object under its own top-level key.
  • §20.2 — the release note for the field class.
  • docs/schemas/witness-observation.schema.json — storeys in the surface enum and in the payload; docs/schemas/witness-verdict.schema.json — only_in_a / only_in_b re-described as covering both set-valued field classes.

Merged origin/main (#226) first and kept both fields in every emitter: relations and storeys are separate top-level payload keys and separate verdict field classes.

Gates

  • cargo fmt --all, cargo clippy --all-targets -- -D warnings, cargo clippy on the out-of-workspace witness-ifc-lite — all clean.
  • cargo +1.85.0 check --all-targets — clean (MSRV).
  • cargo test --profile ci --test witness_verdict --test witness_registry --test project_count_fixtures --test support_matrix with RVT_PROJECT_CORPUS_DIR — 2 / 3 / 4 / 2 passed.
  • Tier-two decoder gates (fix(elem-table): recover the last declared record on the 40-byte project variant, and gate the test that missed it #209): elem_table_corpus, arc_wall_corpus, partition_scanner, iter_elements_typed, re15_geometry_invariants, re19_door_window_wall_negative, walker_to_ifc_integration — all green.
  • tools/ci/ifc_schema_arity.py on a fresh export — passed, 18209 instances across 40 entity types; IfcBuildingStorey at its declared arity of 10 with Elevation as IfcLengthMeasure (REAL).
  • tools/check-local.sh --ifcopenshell — passed.
  • All six observations and both verdicts regenerated; both verdicts PASS.

Closes #218
Refs #219

https://claude.ai/code/session_01BaHKf1Rw5aJBGK5y3xmx7C


Note

Medium Risk
Changes core IFC spatial hierarchy and cross-witness CI gates on golden artifacts; logic is fail-closed and heavily tested, but binary layout decoding is Revit 2024–specific and affects many emitted entities.

Overview
Revit 2024 IFC export now uses real Level names and elevations from partition OST_Levels records instead of the eleven column-bbox-derived storeys with placeholder labels (#213). New partition_level_records decodes Level prologues (no bbox), joins name/elevation parameter blocks by ElementId, and fails closed unless all 15 standalone levels recover uniquely; apply_partition_level_storeys replaces the storey list in the IFC path, with column-derived storeys kept as fallback.

OctetProof 1.1.0 gains storeys: witnesses compare exact sorted [name, elevation-in-feet] sets with per-file LENGTHUNIT normalization (FOOT vs METRE). rvt-ifc --observation, IfcOpenShell, IFClite, witness-verdict.py, schemas, manifests, and golden observations/verdicts are updated; levels / IFCBUILDINGSTOREY move to known at 15 on both magnetar artifacts (verdicts stay PASS). Wider storey set improves elevation containment binding (801 / 872 elements vs 794).

Docs (CHANGELOG, status.md, support matrix, RE-24 report) and CI fixture validation for manifest storeys blocks accompany the decoder change.

Reviewed by Cursor Bugbot for commit cf608bb. Configure here.

…partition Level records (#218) (RE-24)

#213 derived storey elevations from the bounding-box distribution of the
recovered column records: 11 of the export's 15, with no names, because a
rank join of 12 name candidates onto 11 elevations mislabels (it puts
Level 6 at 91 ft where Revit puts Level 7). The Levels are in the file as
elements.

A Level record carries the same 88-byte element prologue with OST_Levels
(-2000240) at +0x12 but no bounding box - a datum plane is not a solid -
so it ends at +0x56 where a column record's bbox marker would start,
which is why the #211 reader rejected all 190 category hits. Of the 75
OST_Levels records on 2024_Core_Interior.rvt the #211 instance test (no
container at +0x32, placement kind 0xffffef7f at +0x42) selects exactly
15, the number of IfcBuildingStorey Revit's own export writes.

Each of the 15 owns exactly one name/elevation parameter block, framed
the way RE-22 framed the IFC Export As overrides: the owning ElementId
as a u64 at value-0x47, a 56-byte 0xff sentinel run, three zero bytes,
the u32 UTF-16 length, then the name. The elevation is an f64 in feet 55
bytes past an 8-byte marker (05 00 00 00 48 02 00 00) searched forward
from the end of the name, repeated 153 bytes later, both copies required
to agree. The marker is searched rather than assumed because the run
between name and marker is variable - 347 bytes for fourteen levels, 363
for Basement 2 - and a fixed offset read 0.0 there. The owner slot is the
discriminator: the same name string appears in blocks owned by
container-member Level records that pair it with the wrong elevation, and
the #211 instance test already excludes those.

Measured: 15 of 15 (name, elevation) pairs equal an IfcBuildingStorey
Name/Elevation in Revit's export exactly - Basement 2 -40, Basement 1
-20, Level 1 0, Mez 1-2 15, Level 3/4/4 - Wall Layouts 1/2/3 at 31/46/61,
Level 6..13 at 76/91/106/121/136/151/166/185.5 ft - including the four
elevations no column stands on. The names are asserted rather than
joined: the block is keyed by the Level's own ElementId. Recovery is
all-or-nothing per file; a partial read emits nothing and falls back to
the #213 column-derived path.

Containment is unchanged (exact elevation match, plates by their record
top face) but the wider set binds more: 801 of 872 building elements land
in a specific storey, up from 794 - all 256 columns, all 132 doors, 359
of 360 walls (was 355), 54 of 100 record-backed plates (was 51). The 6
windows still bind to nothing, because a window record's base is its sill
height; the 46 plates that stay unbound sit 0.1667 ft below their level
at the structural-slab / architectural-topping interface (#219).

levels moves from decoder_baseline to known at tolerance 0 on both
manifests, and OctetProof 1.1.0 gains a second additive field class:
storeys, the exact set of [name, elevation] pairs. It is the first
surface where the two sides express the same quantity in different
declared units - Revit's export declares FOOT, rvt-rs writes METRE - so
each witness resolves its own file's LENGTHUNIT and renders feet at 1e-6
as a six-decimal string, keeping the canonical form integer/string only.
All three witnesses emit byte-identical payloads on both artifacts.
Claimed surfaces: slim 11 -> 13 fields, element fixture 4 -> 6. Both
verdicts stay PASS.

Refs #219

Claude-Session: https://claude.ai/code/session_01BaHKf1Rw5aJBGK5y3xmx7C
@cursor

cursor Bot commented Aug 30, 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_93931888-cff0-42eb-9063-f8c769482a79)

@DrunkOnJava
DrunkOnJava merged commit a0044f4 into main Aug 30, 2026
25 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/storey-names-and-elevations branch August 30, 2026 18:22
DrunkOnJava added a commit that referenced this pull request Aug 31, 2026
…partition Level records (#218) (RE-24) (#230)

## The Levels are elements

#213 derived storey elevations from the bounding-box distribution of the
recovered column records: 11 of the export's 15, with no names, because
a rank join of 12 name candidates onto 11 elevations mislabels — it puts
`Level 6` at 91 ft where Revit puts `Level 7`. The four it missed (−40,
−20, 15, 185.5 ft) carry no column record, so no distribution over
column bases can ever contain them.

The Levels are in the file as elements. A Revit `Level` has a
`BuiltInCategory` (`OST_Levels`, −2000240), so it is framed like one.

### The record: an element prologue with no bounding box

Scanning the eight partition streams for the 8-byte LE encoding of
−2000240 finds **190** hits; `partition_element_records::decode_at`
accepts **zero**. The prologue is not the problem — on `Partitions/46
+228578`:

```text
+0x00  87 3c 01 00 00 00 00 00   ElementId 81031, declared in Global/ElemTable
+0x08  8f 00 00 00               flags
+0x0c  9f 05 00 00               0x0000059f, as on every element record
+0x10  00 00                     0
+0x12  90 7a e1 ff ff ff ff ff   BuiltInCategory −2000240 = OST_Levels
+0x1a  ff × 24                   sentinel padding
+0x32  85 3c 01 00 00 00 00 00   container ElementId 81029
+0x3a  ff × 8                    sentinel
+0x42  7f ef ff ff               placement kind, PLACED
+0x46  0a 00 00 00               unattributed
+0x4a  76 09                     unattributed
+0x4c  00 00 00 00               0   (0xffffffff on a bbox-bearing record)
+0x50  ff ff ff ff ab 05         record marker
+0x56  03 00                     record kind
```

The divergence is at `+0x4c`. A bbox-bearing record carries `ff ff ff
ff` there, `46 01` at `+0x50`, `ff ff ff ff ab 05` at `+0x52` and 48
bbox bytes at `+0x58`. A Level record carries `00 00 00 00` at `+0x4c`
and the same six marker bytes two bytes earlier, then a `u16`, then the
next record — 151 bytes apart. A datum plane is not a solid, so it has
no bounding box, so the reader that requires one at `+0x50` rejects it.
`src/partition_level_records.rs` is that reader with the bbox
requirement replaced by the six-byte marker; nothing else about the
prologue changes.

75 records carry `OST_Levels`. Which of them is a *Level element* is the
#211 instance test, unchanged:

| selection | n |
|---|---:|
| `OST_Levels` records total | 75 |
| container member (`+0x32` set) | 59 |
| type / symbol envelope (`+0x42` = `0xffff8000`) | 1 (ElementId 1673) |
| **standalone placed instance** | **15** |

### The name / elevation block

Framed the way RE-22 framed the per-instance `IFC Export As` override —
an owning `ElementId` at a fixed negative offset from the value:

```text
V-0x47  u64  owning ElementId
V-0x3f  56B  0xff sentinel run
V-0x07  3B   0x00
V-0x04  u32  name length, UTF-16 code units
V       2n   the name, UTF-16LE
…            variable-length parameter run
M       8B   05 00 00 00 48 02 00 00
M+55    f64  elevation, feet
M+208   f64  the same elevation again
```

Two things were found the hard way:

- **The gap between the name and the marker is not fixed** — 347 bytes
for fourteen levels, **363** for `Basement 2`, whose block carries one
extra entry. A fixed `name_end + 402` offset read `0.0` there, a
plausible elevation that would have shipped a wrong storey. The marker
is searched forward within 2048 bytes and the copy at `+153` must agree
bit-for-bit.
- **The owner slot is the discriminator, not the name.** `Level 3 - Wall
Layouts 1` appears nine times in `Partitions/46`; at `+21322916` it is
paired with **46.0 ft** and at `+21323710` `Level 4 - Wall Layouts 2`
with **61.0**. Every wrong pair is owned by an `OST_Levels` record that
is a container member (31636, 31637, 33628, 33629, 21990, …) — exactly
what the #211 test already excludes. Filtering to the 15 standalone
Level ids leaves 15 blocks in the whole file.

The scan itself walks maximal `0xff` runs, requires the owner to be
declared in `Global/ElemTable` and requires the two elevation copies to
agree. A run of exactly 56 is required, which the owner's own encoding
guarantees can only start where the framing says (an `ElementId` is a
`u32`, so its high four bytes are zero).

## 15 / 15, names and elevations

| ElementId | recovered name | recovered elevation (ft) | export `Name`
| export `Elevation` | |
|---:|---|---:|---|---:|:-:|
| 20273 | `Basement 2` | −40 | `Basement 2` | −40. | ✓ |
| 20272 | `Basement 1` | −20 | `Basement 1` | −20. | ✓ |
| 20268 | `Level 1` | 0 | `Level 1` | 0. | ✓ |
| 20275 | `Mez 1-2` | 15 | `Mez 1-2` | 15. | ✓ |
| 20274 | `Level 3 - Wall Layouts 1` | 31 | `Level 3 - Wall Layouts 1` |
31. | ✓ |
| 20276 | `Level 4 - Wall Layouts 2` | 46 | `Level 4 - Wall Layouts 2` |
46. | ✓ |
| 20277 | `Level 4 - Wall Layouts 3` | 61 | `Level 4 - Wall Layouts 3` |
61. | ✓ |
| 20308 | `Level 6` | 76 | `Level 6` | 76. | ✓ |
| 20307 | `Level 7` | 91 | `Level 7` | 91. | ✓ |
| 20306 | `Level 8` | 106 | `Level 8` | 106. | ✓ |
| 20305 | `Level 9` | 121 | `Level 9` | 121. | ✓ |
| 20304 | `Level 10` | 136 | `Level 10` | 136. | ✓ |
| 20303 | `Level 11` | 151 | `Level 11` | 151. | ✓ |
| 20302 | `Level 12` | 166 | `Level 12` | 166. | ✓ |
| 65128 | `Level 13` | 185.5 | `Level 13` | 185.5 | ✓ |

No wrong pair, no missing storey, no extra storey — on **both**
reference exports, which carry the same 15 `IfcBuildingStorey`. Note the
ElementId order and the elevation order do not agree (65128 is the top
level, 20302…20308 run *downwards*), so a rank join on ids would have
been as wrong as the rank join on names #213 rejected. The pairing
survives because the file states it.

Recovery is all-or-nothing per file: a Level with no accepted block
emits nothing, and the whole set is discarded unless every Level record
owns exactly one block and no two levels share an elevation.
`element_record_storeys` survives as the fallback.

## Binding, before and after

Containment logic is untouched — exact elevation match, plates by their
record top face, fail-closed on a miss and on an ambiguity. Only the
storey set is wider.

| | 11 storeys (#213) | 15 storeys (RE-24) |
|---|---:|---:|
| `IFCCOLUMN` | 256 / 256 | 256 / 256 |
| `IFCDOOR` | 132 / 132 | 132 / 132 |
| `IFCWALL` | 355 / 360 | **359 / 360** |
| `IFCSLAB` | 41 / 80 | **44 / 80** |
| `IFCSHADINGDEVICE` | 10 / 20 | 10 / 20 |
| `IFCWINDOW` | 0 / 6 | 0 / 6 |
| `IFCSPACE` | 0 / 18 | 0 / 18 |
| **total bound** | **794 / 872** | **801 / 872** |

Two #219 expectations did **not** hold, and the numbers say so rather
than the prose:

- **The 6 windows still bind to nothing.** Never an elevation-set
problem: a window record's base is its *sill height* (80.73, 95.73, …
ft), which RE-21 already measured at 0 of 6. Binding a window needs its
host level, not more elevations.
- **46 of the 49 unbound plates stay unbound** (36 `IFCSLAB` + all 10
unbound `IFCSHADINGDEVICE`); three bind. RE-22 measured why: they sit
0.1667 ft below their level, at the structural-slab /
architectural-topping interface. That is #219's real content — a
thickness question.

## Cross-witness surface

`levels` moves from `decoder_baseline` to `known` at tolerance 0 on both
manifests (`diagnostics.exported.storey_count` = 15, both references
carry 15 `IfcBuildingStorey`).

A count is a weak claim, so the pair set is gated too, as OctetProof
1.1.0's second additive field class (`storeys`, spec §20.2 — a separate
top-level payload key and a separate verdict field class from #222's
`relations`). One complication is real: **the two sides declare
different length units.** Revit's export of this imperial project
declares `FOOT` as an `IfcConversionBasedUnit` over `METRE` and writes
`-40.`; rvt-rs declares `METRE` and writes `-12.192000`. Both are
faithful; the raw numbers differ by 3.28.

So each witness resolves its *own* file's `LENGTHUNIT` before emitting
and renders feet at 1e-6 as a fixed six-decimal string (a string, not a
number, so §7.3's canonical form stays integer/string only):

| witness | reads | unit resolution |
|---|---|---|
| `rvt-rs` | its own emitted STEP | walks `IfcProject` →
`IfcUnitAssignment` itself |
| IfcOpenShell 0.8.5 | Revit's `.ifc` |
`ifcopenshell.util.unit.calculate_unit_scale` |
| IFClite 7.1.1 | Revit's `.ifc` |
`ifc_lite_core::extract_length_unit_scale` |

All three payloads are byte-identical on both artifacts.

### Verdicts

```
magnetar-2024-core-interior: PASS — witnesses ifc-lite, ifcopenshell, rvt-rs
  surface: 6 fields, excluded: 10, diffs: 0
magnetar-2024-core-interior-slim: PASS — witnesses ifc-lite, ifcopenshell, rvt-rs
  surface: 13 fields, excluded: 3, diffs: 0
```

Claimed surface, slim (11 → 13): `entity_counts.IFCBUILDINGSTOREY`,
`…IFCWALL`, `…IFCSLAB`, `…IFCROOF`, `…IFCDOOR`, `…IFCWINDOW`,
`…IFCCOLUMN`, `…IFCBEAM`, `…IFCFLOWTERMINAL`, `…IFCUNITASSIGNMENT`,
`…IFCSHADINGDEVICE`, `relations.IFCRELFILLSELEMENT`,
**`storeys.IFCBUILDINGSTOREY`**.
Element fixture (4 → 6): `entity_counts.IFCBUILDINGSTOREY`, `…IFCROOF`,
`…IFCBEAM`, `…IFCFLOWTERMINAL`, `…IFCUNITASSIGNMENT`,
**`storeys.IFCBUILDINGSTOREY`**. Unusually for this corpus the thin 20
KB fixture supports the field as strongly as the 19879-entity export:
Revit writes the complete fifteen-storey hierarchy into an export
carrying one building element.

Storey payload, identical across all three witnesses:

```json
"storeys": {
  "IFCBUILDINGSTOREY": [
    ["Basement 1", "-20.000000"], ["Basement 2", "-40.000000"],
    ["Level 1", "0.000000"], ["Level 10", "136.000000"],
    ["Level 11", "151.000000"], ["Level 12", "166.000000"],
    ["Level 13", "185.500000"], ["Level 3 - Wall Layouts 1", "31.000000"],
    ["Level 4 - Wall Layouts 2", "46.000000"], ["Level 4 - Wall Layouts 3", "61.000000"],
    ["Level 6", "76.000000"], ["Level 7", "91.000000"],
    ["Level 8", "106.000000"], ["Level 9", "121.000000"],
    ["Mez 1-2", "15.000000"]
  ]
}
```

## Spec / schema changes (1.1.0 additive, §20.2)

- **§7.2** — new field class *storey sets*: exact equality of the sorted
set of (name, elevation rounded to 1e-6 ft), no tolerance concept.
Documents the unit normalization, why the elevation is a string, and why
Unicode normalization is deliberately **not** applied to the name (three
runtimes, three Unicode tables — a normalizer that disagrees between
them would launder a real difference into agreement; the strict
direction is correct for a gate).
- **§9.4** — `storeys` joins the coverage vocabulary next to
`relations`.
- **§6.1** — manifests gain a `storeys` block parallel to `counts` and
`relations`.
- **§6.2** — the observation payload gains an optional `storeys` object
under its own top-level key.
- **§20.2** — the release note for the field class.
- `docs/schemas/witness-observation.schema.json` — `storeys` in the
surface enum and in the payload;
`docs/schemas/witness-verdict.schema.json` — `only_in_a` / `only_in_b`
re-described as covering both set-valued field classes.

Merged `origin/main` (#226) first and kept both fields in every emitter:
`relations` and `storeys` are separate top-level payload keys and
separate verdict field classes.

## Gates

- `cargo fmt --all`, `cargo clippy --all-targets -- -D warnings`, `cargo
clippy` on the out-of-workspace `witness-ifc-lite` — all clean.
- `cargo +1.85.0 check --all-targets` — clean (MSRV).
- `cargo test --profile ci --test witness_verdict --test
witness_registry --test project_count_fixtures --test support_matrix`
with `RVT_PROJECT_CORPUS_DIR` — 2 / 3 / 4 / 2 passed.
- Tier-two decoder gates (#209): `elem_table_corpus`, `arc_wall_corpus`,
`partition_scanner`, `iter_elements_typed`, `re15_geometry_invariants`,
`re19_door_window_wall_negative`, `walker_to_ifc_integration` — all
green.
- `tools/ci/ifc_schema_arity.py` on a fresh export — passed, 18209
instances across 40 entity types; `IfcBuildingStorey` at its declared
arity of **10** with `Elevation` as `IfcLengthMeasure` (REAL).
- `tools/check-local.sh --ifcopenshell` — passed.
- All six observations and both verdicts regenerated; both verdicts
`PASS`.

Closes #218
Refs #219

https://claude.ai/code/session_01BaHKf1Rw5aJBGK5y3xmx7C

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes core IFC spatial hierarchy and cross-witness CI gates on
golden artifacts; logic is fail-closed and heavily tested, but binary
layout decoding is Revit 2024–specific and affects many emitted
entities.
> 
> **Overview**
> **Revit 2024 IFC export now uses real Level names and elevations**
from partition `OST_Levels` records instead of the eleven
column-bbox-derived storeys with placeholder labels (#213). New
`partition_level_records` decodes Level prologues (no bbox), joins
name/elevation parameter blocks by ElementId, and **fails closed**
unless all 15 standalone levels recover uniquely;
`apply_partition_level_storeys` replaces the storey list in the IFC
path, with column-derived storeys kept as fallback.
> 
> **OctetProof 1.1.0 gains `storeys`**: witnesses compare exact sorted
`[name, elevation-in-feet]` sets with per-file `LENGTHUNIT`
normalization (FOOT vs METRE). `rvt-ifc --observation`, IfcOpenShell,
IFClite, `witness-verdict.py`, schemas, manifests, and golden
observations/verdicts are updated; **`levels` / `IFCBUILDINGSTOREY` move
to `known` at 15** on both magnetar artifacts (verdicts stay `PASS`).
Wider storey set improves elevation containment binding (**801 / 872**
elements vs 794).
> 
> Docs (`CHANGELOG`, `status.md`, support matrix, RE-24 report) and CI
fixture validation for manifest `storeys` blocks accompany the decoder
change.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
99b2a7dddce9d630a6ddaf30c20f13a06d987471. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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.

Storeys: four export elevations (-40, -20, 15, 185.5 ft) carry no OST_Columns record; names stay unpaired with the 11 recovered elevations

1 participant