Skip to content

feat(elements): bind every recovered door and window to its host wall and emit the IFC4 opening chain (#222) - #226

Merged
DrunkOnJava merged 1 commit into
mainfrom
feat/door-window-host-binding
Aug 30, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
feat/door-window-host-binding

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Aug 30, 2026 •

Copy link
Copy Markdown
Owner

The rule

Past the 88-byte prologue and the 48-byte bounding box, at +0x88, every
Revit 2024 partition element record carries a counted reference list: a
u32 length then that many u64 slots. The host wall is the slot
immediately before the record's own ElementId.

Door ElementId 25947, Partitions/46:

+0x88  06 00 00 00                    n = 6
+0x8c  03 00 00 00 00 00 00 00        3
+0x94  32 4f 00 00 00 00 00 00        20274
+0x9c  cc 5c 00 00 00 00 00 00        23756   door type symbol (RE-21 §5)
+0xa4  ed 5e 00 00 00 00 00 00        24301   door type symbol (RE-21 §5)
+0xac  90 63 00 00 00 00 00 00        25488   ← host wall
+0xb4  5b 65 00 00 00 00 00 00        25947   ← the record's own id

Window ElementId 20898 has the same framing with n = 18, its host at
+0x10c and its own id at +0x114.

The value is accepted only when it is one of the 360 ElementIds the RE-21
instance rule selects as exported walls
, so a wrong read fails closed
instead of inventing a host. Both halves are required: the slot is where the
byte says the host is, the wall-set membership is what makes the join
self-checking.

Evidence

138 door/window instances are framed by 273 records. Scoring every record,
not just the one the per-id selection keeps:

rule correct wrong no value
slot before the record's own id 273 0 0
u64 @ +0xac (list index 4) 186 87 0
u64 @ +0xa4 (list index 3) 81 192 0
last two slots are (host, self) 192 81 0

All three rejected candidates assume a shape the list does not have. The
length varies — 6 on every door record, 18 on every window record, up to 101
elsewhere — and 81 door records continue past their own id with a trailing
type-symbol slot (only 132750, 132824, 132825, 132875 ever appear
there, all +0x42 == 0xffff8000 symbols RE-21 already excludes).

The predecessor read applied to every category (instances only) shows what
the rule is not:

category records predecessor is an exported wall something else
OST_Doors 267 267 0
OST_Windows 6 6 0
OST_Walls 638 528 110
OST_Columns 344 0 344
OST_Floors 121 0 121

528 wall records also have a wall predecessor, so "the predecessor is a wall"
is not a category discriminator — it is a fail-closed check on a value only
the two categories RE-21 already identifies by BuiltInCategory are asked for.

Pair-set agreement

rvt-ifc emits the chain Revit itself emits — IfcOpeningElement (bodied
with the door/window's own record bounding box, Tag repeating the filling
element's, as the reference does on all 138) + IfcRelVoidsElement (wall →
opening) + IfcRelFillsElement (opening → door/window). The
(host Tag, filling Tag) pairs read back out with IfcOpenShell 0.8.5:

rvt-rs Revit export
IFCRELFILLSELEMENT pairs 138 138
distinct pairs 138 138
in the export, missing from rvt-rs 0 —
in rvt-rs, absent from the export 0 —

Exact set equality, no tolerance. 132 doors + 6 windows across 92 distinct
host walls (65 hold one opening, 8 hold two, 19 hold three). The export's
other 63 IfcOpeningElement — 42 slab penetrations, 20 shading-device
penetrations, 1 unfilled wall opening — are not recovered: rvt-rs emits no
opening that is not filled by a recovered element.

Entity counts are unchanged: IFCWALL 360, IFCDOOR 132, IFCWINDOW 6,
IFCCOLUMN 256, IFCSLAB 80, IFCSHADINGDEVICE 20.
tools/ci/ifc_schema_arity.py passes on the fresh export — 18 192 instances
across 40 entity types
, IfcOpeningElement at its declared arity of 9
ending in PredefinedType, IfcRelVoidsElement and IfcRelFillsElement at 6.

Two writer bugs the binding exposed

Neither was reachable before, because no real-file door had ever carried a host.

  1. The host lookup sat in a dead branch. ifc::export_content consulted
    recover_door_host / recover_window_host only in the else arm of the
    element-record geometry check, so every door with a record bounding box —
    which is every door recovered since Partition element-record recovery for walls / doors / windows: recall is 100%, precision is not #211 — skipped it.
  2. Void/fill resolution depended on emission order. ifc::step_writer
    resolved host_element_index against entity_index_to_el_id inside the
    element loop, so a host emitted after its own opening silently dropped the
    whole chain. Both relationships are now emitted after the loop.

OctetProof: a second field class

Entity counts are a weak agreement — two witnesses can report the same 138
fill relationships while disagreeing about every wall those openings belong
to. relations (spec 1.1.0, §7.2 / §9.4 / §20.1) is the sorted multiset
of [host Tag, filling Tag] pairs, compared as an exact set with no
tolerance concept
; a diff names the pairs each side holds alone
(only_in_a / only_in_b, tolerance_applied: false). An identity a witness
cannot read is the empty string, never an omitted pair.

All three witnesses emit it with their own parser and no shared code:

witness reader
rvt-rs (source) splits its own emitted STEP; IfcElement.Tag is attribute 7
ifcopenshell (bridge) by_type(include_subtypes=False) + attribute access
ifc-lite (bridge) EntityScanner + parse_entity + decode_ifc_string

The three relations payloads are byte-identical on the full-project
artifact. entity_counts semantics are untouched; relations is its own
top-level payload key with its own verdict field class.

Verdicts

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

magnetar-2024-core-interior-slim: PASS — witnesses ifc-lite, ifcopenshell, rvt-rs
  surface: 11 fields, excluded: 4, diffs: 0

The slim claimed surface goes 10 → 11 fields:

entity_counts.IFCWALL, entity_counts.IFCSLAB, entity_counts.IFCROOF,
entity_counts.IFCDOOR, entity_counts.IFCWINDOW, entity_counts.IFCCOLUMN,
entity_counts.IFCBEAM, entity_counts.IFCFLOWTERMINAL,
entity_counts.IFCUNITASSIGNMENT, entity_counts.IFCSHADINGDEVICE,
relations.IFCRELFILLSELEMENT

On magnetar-2024-core-interior the same relation is decoder_baseline and
excluded first-class with tracking_issue: 222 — its paired export is a 20 KB
element fixture carrying no IfcRelFillsElement at all, so the two sides
of that edge are not comparable on this field. Recorded rather than rounded off.

Spec and schema changes

  • docs/octetproof-spec.md → 1.1.0. §7.2 gains a relation pair sets
    row plus the normative paragraph; §9.4 gains the relations vocabulary
    term; §6.1 gains the manifest relations block reading; §6.2 gains the
    payload key; §16.3 notes all three emitters carry it; §20 is the
    additive-release changelog, structured as subsections (§20.1 is this field
    class) so a further additive field class appends rather than renumbers.
  • docs/schemas/witness-observation.schema.json: schema_version becomes
    enum ["1.0.0", "1.1.0"] (1.0.0 observations stay valid, §16.2),
    semantic_surface_covered gains relations, and observation.relations is
    specified as an object of 2-element string-pair arrays.
  • docs/schemas/witness-verdict.schema.json: semantic_surface documents the
    relations.<TYPE> form and diffs[] gains only_in_a / only_in_b.
  • Both committed artifacts' observations and verdicts validate against the
    published schemas.

Gates

  • tests/iter_elements_typed.rs::core_interior_2024_door_window_host_wall_binding
    — re-reads the reference export, follows its own void/fill chain, and
    requires exact pair-set equality. No embedded expectations to drift.
  • relations.IFCRELFILLSELEMENT inside the slim OctetProof surface.
  • tests/project_count_fixtures.rs — manifest relations shape plus source
    and decoder pair counts.
  • cargo test --profile ci --test witness_verdict --test witness_registry --test project_count_fixtures --test support_matrix green with
    RVT_PROJECT_CORPUS_DIR set; the seven fix(elem-table): recover the last declared record on the 40-byte project variant, and gate the test that missed it #209 tier-2 targets green;
    cargo +1.85.0 check --all-targets clean (workspace MSRV);
    cargo clippy --all-targets -- -D warnings clean for the workspace and for
    the out-of-workspace ifc-lite witness; tools/check-local.sh --ifcopenshell
    passes.

Support matrix

New verified row element-record-door-window-host-binding, scoped to two
BuiltInCategory ids, one release band and one recorded edge, on the gated
exact match. typed-door-window stays unsupported and is narrowed to what
RE-19 actually leaves open — the ArcWallRectOpening index still carries no
Door/Window discriminator and no host claim — exactly as RE-21 handled the
instance half.

Evidence: reports/element-framing/RE-23-door-window-host-binding.md

Closes #222

https://claude.ai/code/session_01BaHKf1Rw5aJBGK5y3xmx7C


Note

Medium Risk
Changes real-file IFC topology (openings/voids) and bumps the verification protocol; risk is mitigated by exact pair-set gates and three-way witness replay, but regressions would affect export semantics and CI verdicts.

Overview
Recovered Revit 2024 doors and windows now bind to host walls by reading the partition element record’s counted reference list at +0x88 (host = slot before the record’s own ElementId), accepted only when that id is in the recovered wall instance set. IFC export emits Revit’s IfcOpeningElement / IfcRelVoidsElement / IfcRelFillsElement chain for all 138 openings, with opening Tag matching the fill element.

Two export bugs are fixed: host recovery no longer sits behind the element-record geometry branch, and void/fill relationships are written after the element loop so host index resolution is complete.

OctetProof 1.1.0 adds cross-witness relations — exact multiset equality on [host Tag, filling Tag] pairs for IFCRELFILLSELEMENT — with schema/manifest/verdict updates, all three witnesses emitting it, and the slim artifact claimed surface growing to 11 fields. Docs, support matrix, RE-23 report, corpus gates, and committed witness JSON are refreshed; door_window_host_wall_binding is removed from unsupported features.

Reviewed by Cursor Bugbot for commit cb49924. Configure here.

… and emit the IFC4 opening chain (#222)

The host is in the element record. Past the 88-byte prologue and the
48-byte bounding box, at +0x88, every Revit 2024 partition element
record carries a counted reference list: a u32 length then that many
u64 slots. The slot immediately before the record's own ElementId is
the host wall.

The value is accepted only when it is one of the 360 ElementIds the
RE-21 instance rule already selects as exported walls, so a wrong read
fails closed rather than inventing a host. Measured on
2024_Core_Interior.rvt: 273 of 273 door and window records give the
correct host, and the emitted (host wall, filling element) pair set
equals Revit's own IfcRelVoidsElement o IfcRelFillsElement chain
exactly -- 138 pairs, no wrong host, no missing pair, no extra pair.

Three fixed-shape readings were measured and rejected: u64 @ +0xac
(186/273), u64 @ +0xa4 (81/273), and "the last two slots are (host,
self)" (192/273). The list length is not fixed -- 6 on every door
record, 18 on every window record, up to 101 elsewhere -- and 81 door
records continue past their own id with a trailing type-symbol slot.

Each bound opening is emitted the way Revit's exporter does:
IfcOpeningElement (bodied with the element's own record bounding box,
Tag repeating the filling element's) plus IfcRelVoidsElement and
IfcRelFillsElement. tools/ci/ifc_schema_arity.py passes on the fresh
export: 18192 instances across 40 entity types.

Two writer bugs the binding exposed, neither reachable before because
no real-file door had ever carried a host: the door/window host lookup
sat in the else arm of the element-record geometry check, so every
record-backed door skipped it; and the void/fill chain resolved its
host inside the element loop, silently dropping the pair whenever a
host was emitted after its own opening.

OctetProof gains a second cross-witness field class, `relations`
(spec 1.1.0, SS7.2 / SS9.4 / SS20.1): the sorted multiset of
[host Tag, filling Tag] pairs, compared as an exact set with no
tolerance concept. All three witnesses emit it with their own parsers
and the payloads are byte-identical on the full-project artifact. The
magnetar-2024-core-interior-slim claimed surface goes 10 -> 11 fields;
both verdicts stay PASS.

Evidence: reports/element-framing/RE-23-door-window-host-binding.md

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_ece34648-e306-40fe-bf05-573f56e77e63)

@DrunkOnJava
DrunkOnJava merged commit 08f7858 into main Aug 30, 2026
25 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/door-window-host-binding branch August 30, 2026 17:37
DrunkOnJava added a commit that referenced this pull request Aug 30, 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
cf608bb. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
DrunkOnJava added a commit that referenced this pull request Aug 31, 2026
… and emit the IFC4 opening chain (#222) (#226)

## The rule

Past the 88-byte prologue and the 48-byte bounding box, at `+0x88`,
every
Revit 2024 partition element record carries a **counted reference
list**: a
`u32` length then that many `u64` slots. **The host wall is the slot
immediately before the record's own ElementId.**

Door ElementId 25947, `Partitions/46`:

```text
+0x88  06 00 00 00                    n = 6
+0x8c  03 00 00 00 00 00 00 00        3
+0x94  32 4f 00 00 00 00 00 00        20274
+0x9c  cc 5c 00 00 00 00 00 00        23756   door type symbol (RE-21 §5)
+0xa4  ed 5e 00 00 00 00 00 00        24301   door type symbol (RE-21 §5)
+0xac  90 63 00 00 00 00 00 00        25488   ← host wall
+0xb4  5b 65 00 00 00 00 00 00        25947   ← the record's own id
```

Window ElementId 20898 has the same framing with `n = 18`, its host at
`+0x10c` and its own id at `+0x114`.

The value is accepted only when it is one of the **360 ElementIds the
RE-21
instance rule selects as exported walls**, so a wrong read fails closed
instead of inventing a host. Both halves are required: the slot is where
the
byte says the host is, the wall-set membership is what makes the join
self-checking.

## Evidence

138 door/window instances are framed by **273 records**. Scoring every
record,
not just the one the per-id selection keeps:

| rule | correct | wrong | no value |
|---|---:|---:|---:|
| **slot before the record's own id** | **273** | **0** | 0 |
| `u64 @ +0xac` (list index 4) | 186 | 87 | 0 |
| `u64 @ +0xa4` (list index 3) | 81 | 192 | 0 |
| last two slots are `(host, self)` | 192 | 81 | 0 |

All three rejected candidates assume a shape the list does not have. The
length varies — 6 on every door record, 18 on every window record, up to
101
elsewhere — and 81 door records continue past their own id with a
trailing
type-symbol slot (only `132750`, `132824`, `132825`, `132875` ever
appear
there, all `+0x42 == 0xffff8000` symbols RE-21 already excludes).

The predecessor read applied to every category (instances only) shows
what
the rule is *not*:

| category | records | predecessor is an exported wall | something else
|
|---|---:|---:|---:|
| `OST_Doors` | 267 | **267** | 0 |
| `OST_Windows` | 6 | **6** | 0 |
| `OST_Walls` | 638 | 528 | 110 |
| `OST_Columns` | 344 | 0 | 344 |
| `OST_Floors` | 121 | 0 | 121 |

528 wall records also have a wall predecessor, so "the predecessor is a
wall"
is not a category discriminator — it is a fail-closed check on a value
only
the two categories RE-21 already identifies by `BuiltInCategory` are
asked for.

## Pair-set agreement

`rvt-ifc` emits the chain Revit itself emits — `IfcOpeningElement`
(bodied
with the door/window's own record bounding box, `Tag` repeating the
filling
element's, as the reference does on all 138) + `IfcRelVoidsElement`
(wall →
opening) + `IfcRelFillsElement` (opening → door/window). The
`(host Tag, filling Tag)` pairs read back out with IfcOpenShell 0.8.5:

| | rvt-rs | Revit export |
|---|---:|---:|
| `IFCRELFILLSELEMENT` pairs | 138 | 138 |
| distinct pairs | 138 | 138 |
| in the export, missing from rvt-rs | **0** | — |
| in rvt-rs, absent from the export | **0** | — |

**Exact set equality, no tolerance.** 132 doors + 6 windows across 92
distinct
host walls (65 hold one opening, 8 hold two, 19 hold three). The
export's
other 63 `IfcOpeningElement` — 42 slab penetrations, 20 shading-device
penetrations, 1 unfilled wall opening — are not recovered: rvt-rs emits
no
opening that is not filled by a recovered element.

Entity counts are unchanged: `IFCWALL` 360, `IFCDOOR` 132, `IFCWINDOW`
6,
`IFCCOLUMN` 256, `IFCSLAB` 80, `IFCSHADINGDEVICE` 20.
`tools/ci/ifc_schema_arity.py` passes on the fresh export — **18 192
instances
across 40 entity types**, `IfcOpeningElement` at its declared arity of 9
ending in `PredefinedType`, `IfcRelVoidsElement` and
`IfcRelFillsElement` at 6.

## Two writer bugs the binding exposed

Neither was reachable before, because no real-file door had ever carried
a host.

1. **The host lookup sat in a dead branch.** `ifc::export_content`
consulted
`recover_door_host` / `recover_window_host` only in the `else` arm of
the
element-record geometry check, so every door with a record bounding box
—
   which is every door recovered since #211 — skipped it.
2. **Void/fill resolution depended on emission order.**
`ifc::step_writer`
resolved `host_element_index` against `entity_index_to_el_id` *inside*
the
element loop, so a host emitted after its own opening silently dropped
the
   whole chain. Both relationships are now emitted after the loop.

## OctetProof: a second field class

Entity counts are a weak agreement — two witnesses can report the same
138
fill relationships while disagreeing about every wall those openings
belong
to. `relations` (spec **1.1.0**, §7.2 / §9.4 / §20.1) is the sorted
multiset
of `[host Tag, filling Tag]` pairs, compared as an **exact set with no
tolerance concept**; a diff names the pairs each side holds alone
(`only_in_a` / `only_in_b`, `tolerance_applied: false`). An identity a
witness
cannot read is the empty string, never an omitted pair.

All three witnesses emit it with their own parser and no shared code:

| witness | reader |
|---|---|
| `rvt-rs` (source) | splits its own emitted STEP; `IfcElement.Tag` is
attribute 7 |
| `ifcopenshell` (bridge) | `by_type(include_subtypes=False)` +
attribute access |
| `ifc-lite` (bridge) | `EntityScanner` + `parse_entity` +
`decode_ifc_string` |

The three `relations` payloads are **byte-identical** on the
full-project
artifact. `entity_counts` semantics are untouched; `relations` is its
own
top-level payload key with its own verdict field class.

### Verdicts

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

magnetar-2024-core-interior-slim: PASS — witnesses ifc-lite, ifcopenshell, rvt-rs
  surface: 11 fields, excluded: 4, diffs: 0
```

The slim claimed surface goes **10 → 11 fields**:

```
entity_counts.IFCWALL, entity_counts.IFCSLAB, entity_counts.IFCROOF,
entity_counts.IFCDOOR, entity_counts.IFCWINDOW, entity_counts.IFCCOLUMN,
entity_counts.IFCBEAM, entity_counts.IFCFLOWTERMINAL,
entity_counts.IFCUNITASSIGNMENT, entity_counts.IFCSHADINGDEVICE,
relations.IFCRELFILLSELEMENT
```

On `magnetar-2024-core-interior` the same relation is `decoder_baseline`
and
excluded first-class with `tracking_issue: 222` — its paired export is a
20 KB
element fixture carrying **no** `IfcRelFillsElement` at all, so the two
sides
of that edge are not comparable on this field. Recorded rather than
rounded off.

## Spec and schema changes

- `docs/octetproof-spec.md` → **1.1.0**. §7.2 gains a *relation pair
sets*
row plus the normative paragraph; §9.4 gains the `relations` vocabulary
term; §6.1 gains the manifest `relations` block reading; §6.2 gains the
  payload key; §16.3 notes all three emitters carry it; **§20** is the
additive-release changelog, structured as subsections (§20.1 is this
field
class) so a further additive field class appends rather than renumbers.
- `docs/schemas/witness-observation.schema.json`: `schema_version`
becomes
  `enum ["1.0.0", "1.1.0"]` (1.0.0 observations stay valid, §16.2),
`semantic_surface_covered` gains `relations`, and
`observation.relations` is
  specified as an object of 2-element string-pair arrays.
- `docs/schemas/witness-verdict.schema.json`: `semantic_surface`
documents the
  `relations.<TYPE>` form and `diffs[]` gains `only_in_a` / `only_in_b`.
- Both committed artifacts' observations and verdicts validate against
the
  published schemas.

## Gates

-
`tests/iter_elements_typed.rs::core_interior_2024_door_window_host_wall_binding`
  — re-reads the reference export, follows its own void/fill chain, and
  requires exact pair-set equality. No embedded expectations to drift.
- `relations.IFCRELFILLSELEMENT` inside the slim OctetProof surface.
- `tests/project_count_fixtures.rs` — manifest `relations` shape plus
source
  and decoder pair counts.
- `cargo test --profile ci --test witness_verdict --test
witness_registry
  --test project_count_fixtures --test support_matrix` green with
  `RVT_PROJECT_CORPUS_DIR` set; the seven #209 tier-2 targets green;
  `cargo +1.85.0 check --all-targets` clean (workspace MSRV);
`cargo clippy --all-targets -- -D warnings` clean for the workspace and
for
the out-of-workspace ifc-lite witness; `tools/check-local.sh
--ifcopenshell`
  passes.

## Support matrix

New **verified** row `element-record-door-window-host-binding`, scoped
to two
`BuiltInCategory` ids, one release band and one recorded edge, on the
gated
exact match. `typed-door-window` stays **unsupported** and is narrowed
to what
RE-19 actually leaves open — the `ArcWallRectOpening` index still
carries no
Door/Window discriminator and no host claim — exactly as RE-21 handled
the
instance half.

Evidence: `reports/element-framing/RE-23-door-window-host-binding.md`

Closes #222


https://claude.ai/code/session_01BaHKf1Rw5aJBGK5y3xmx7C

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes real-file IFC topology (openings/voids) and bumps the
verification protocol; risk is mitigated by exact pair-set gates and
three-way witness replay, but regressions would affect export semantics
and CI verdicts.
> 
> **Overview**
> Recovered Revit 2024 doors and windows now bind to host walls by
reading the partition element record’s counted reference list at `+0x88`
(host = slot before the record’s own ElementId), accepted only when that
id is in the recovered wall instance set. IFC export emits Revit’s
**IfcOpeningElement** / **IfcRelVoidsElement** / **IfcRelFillsElement**
chain for all 138 openings, with opening `Tag` matching the fill
element.
> 
> Two export bugs are fixed: host recovery no longer sits behind the
element-record geometry branch, and void/fill relationships are written
after the element loop so host index resolution is complete.
> 
> **OctetProof 1.1.0** adds cross-witness **`relations`** — exact
multiset equality on `[host Tag, filling Tag]` pairs for
`IFCRELFILLSELEMENT` — with schema/manifest/verdict updates, all three
witnesses emitting it, and the slim artifact claimed surface growing to
11 fields. Docs, support matrix, RE-23 report, corpus gates, and
committed witness JSON are refreshed; `door_window_host_wall_binding` is
removed from unsupported features.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
1dc396944c1900bbdb00bd203148b0bb01d4fb6f. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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.

Door/window host-wall binding from the element record body past +0xa8

1 participant