Skip to content

feat(ifc): a door's or window's type takes Revit's hashed GlobalId, with the door's flip from its host wall (B72) - #666

Merged
DrunkOnJava merged 17 commits into
mainfrom
feat/b72-door-type-gids
Oct 4, 2026
Merged

DrunkOnJava merged 17 commits into
mainfrom
feat/b72-door-type-gids

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Revit hashes a door's or window's type GlobalId from its original symbol's GlobalId and the door's flip: MD5 of <symbol gid>Sub-element:Flipped: <True|False>, with InAssembly: False from revit-ifc 25.4 on (a Revit 2025 or later file; Core Interior's 2024 export has no suffix). The flip comes from the door's box centre and facing against its host wall's axis (revit-ifc DoorWindowInfo); a door with no host is not flipped.

Red test on draft #665; the output is in the test commit. Green: Corpus health run 37225506986, door_and_window_types_take_revits_global_ids ok on RE1 x4 and Core Interior, type_objects_take_revits_global_ids ok. Core Interior's witness observation is refreshed from CI's own artifact (IFCDOORTYPE 3 -> 10: a door type is written once per flip).

Bugbot's typed-no-geometry thread: that mode writes no type objects at all (measured, run 37224651451), so no flip-dependent GlobalId is written there; logged as B74 for when that mode gains types.

… (B60)

tests/type_global_ids.rs compares, for every element both exports relate
to a type, the type's GlobalId with Revit's, on the four RE1 models and Core
Interior. Door and window types are left out (B72).

Red on main (draft #662, run 37219969064, "Corpus health (tier 2)"):

  RE1-Architecture.rvt: 67 elements typed in both, 31 types' GlobalIds not Revit's; 5 doors and windows left out
  RE1-Mechanical.rvt: 49 elements typed in both, 37 types' GlobalIds not Revit's
  RE1-Plumbing.rvt: 123 elements typed in both, 54 types' GlobalIds not Revit's
  RE1-Electrical.rvt: 49 elements typed in both, 2 types' GlobalIds not Revit's
  2024_Core_Interior.rvt: 716 elements typed in both, 278 types' GlobalIds not Revit's; 138 doors and windows left out
  panicked at tests/type_global_ids.rs:166:5:
  RE1-Architecture.rvt: 31 of 67 typed elements' types have another GlobalId than Revit's; first: ["351456 (IFCFURNITURETYPE): Revit 3144CP5Ub2qhBtGD1R3koT, rvt-rs 3144CP5Ub2qhBtGD1R3koW", ...]
…s GlobalId, one type object per original symbol (B60)

RE-167 (Measure runs 37218947202 and 37219379143): Revit's exporter writes a
family instance's type with the GlobalId of the instance's original symbol
(ExporterIFCUtils.GetOriginalSymbol) and the Tag of its symbol. The instance's
GElement data object holds that FamilySymbol's ElementId 20 bytes before its
end. On the RE1 models that gives Revit's type GlobalId for every family
instance outside doors and windows: 162 of them, the symbol itself for most
and another FamilySymbol (often the instance's id plus one) for furniture,
fittings, mullions and panels. Doors and windows take a hash of it with the
door's flip (B72), not read yet, and keep their symbol's.

The schema pass records each family instance's original symbol (one value
across its GElement objects, naming a FamilySymbol); RevitGlobalIds gains
element_types, an element's type GlobalId where it is not its symbol's; and
the writer writes one type object per symbol, entity and GlobalId, as Revit
does: RE1's 10 mullions share Tag 446539 across 9 type objects.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Flip lost without entity geometry
    • Partition-record placement and host links are kept through append for flip hashing, host wiring runs without geometry export, and revit_model_global_ids now runs before strip_building_element_geometry.

Create PR

Or push these changes by commenting:

@cursor push 3801a46bb3
Preview (3801a46bb3)
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -542,6 +542,16 @@
 ]
 
 [[package]]
+name = "md-5"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69b6441f590336821bb897fb28fc622898ccceb1d6cea3fde5ea86b090c4de98"
+dependencies = [
+ "cfg-if",
+ "digest",
+]
+
+[[package]]
 name = "memchr"
 version = "2.8.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -948,6 +958,7 @@
  "encoding_rs",
  "flate2",
  "hex",
+ "md-5",
  "memchr",
  "proptest",
  "quick-xml",

diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -100,6 +100,7 @@
 # Optional WASM bindings (VW1-01). See the `wasm` feature above.
 wasm-bindgen = { version = "0.2", optional = true }
 serde-wasm-bindgen = { version = "0.6", optional = true }
+md-5 = "0.11"
 
 [dev-dependencies]
 # Discussion #112 / #151 stream-evidence harness. Only

diff --git a/src/ifc/export_content.rs b/src/ifc/export_content.rs
--- a/src/ifc/export_content.rs
+++ b/src/ifc/export_content.rs
@@ -55,6 +55,8 @@
     pub element_type_ids: BTreeMap<u32, u32>,
     /// Each family instance's original symbol, by ElementId (RE-167).
     pub element_original_symbols: BTreeMap<u32, u32>,
+    /// Each door's and window's plan facing, by ElementId (B72).
+    pub element_facings: BTreeMap<u32, [f64; 2]>,
 }
 
 /// What a quality mode allows the document exporter to emit.
@@ -297,6 +299,12 @@
             }) {
                 out.element_original_symbols.insert(id, original);
             }
+            // B72: a door's or window's facing, for its type's flip.
+            if let Some(facing) =
+                crate::partition_schema_mvp::opening_facing_from_fields(&decoded.fields)
+            {
+                out.element_facings.insert(id, facing);
+            }
         }
 
         // Materials are IfcMaterial rows, never building-element proxies.
@@ -417,17 +425,17 @@
         let mut held_body = None;
         let mut solid_shape = None;
 
+        // Partition element records carry their own model bbox for every
+        // category (#204 columns, #211 walls / doors / windows). Checked
+        // before the class arms so a schema-field decoder is never asked
+        // to read element-record fields.
+        let element_record_geometry = if is_partition_element_record(&decoded) {
+            element_record_geometry_from_decoded(&decoded)
+        } else {
+            None
+        };
+
         if policy.include_geometry {
-            // Partition element records carry their own model bbox for
-            // every category, so one envelope path serves all of them
-            // (#204 columns, #211 walls / doors / windows). Checked
-            // before the class arms so a schema-field decoder is never
-            // asked to read element-record fields.
-            let element_record_geometry = if is_partition_element_record(&decoded) {
-                element_record_geometry_from_decoded(&decoded)
-            } else {
-                None
-            };
             if let Some(RecordGeometry {
                 location,
                 rotation,
@@ -474,26 +482,38 @@
                     _ => {}
                 }
             }
-            // Host-wall binding is independent of which geometry
-            // carrier produced the body. Before #222 this lived in the
-            // `else` arm above, so a door recovered from a partition
-            // element record — which always has a record bbox body —
-            // never reached it and could not be voided into its wall.
-            match decoded.class.as_str() {
-                "Door" => {
-                    let door = Door::from_decoded(&decoded);
-                    if let Some(host) = recover_door_host(&door).ok() {
-                        pending_host_id = Some(host.host_element_id);
-                    }
+        } else if let Some(RecordGeometry {
+            location,
+            rotation,
+            body,
+            ..
+        }) = element_record_geometry
+        {
+            // B72: typed-no-geometry still hashes door and window type
+            // GlobalIds from the opening's flip; placement is stripped later.
+            location_feet = Some(location);
+            rotation_radians = rotation;
+            extrusion = Some(body);
+        }
+
+        // Host-wall binding is independent of which geometry carrier produced
+        // the body. Before #222 this lived in the `else` arm above, so a door
+        // recovered from a partition element record — which always has a record
+        // bbox body — never reached it and could not be voided into its wall.
+        match decoded.class.as_str() {
+            "Door" => {
+                let door = Door::from_decoded(&decoded);
+                if let Some(host) = recover_door_host(&door).ok() {
+                    pending_host_id = Some(host.host_element_id);
                 }
-                "Window" => {
-                    let window = Window::from_decoded(&decoded);
-                    if let Some(host) = recover_window_host(&window).ok() {
-                        pending_host_id = Some(host.host_element_id);
-                    }
+            }
+            "Window" => {
+                let window = Window::from_decoded(&decoded);
+                if let Some(host) = recover_window_host(&window).ok() {
+                    pending_host_id = Some(host.host_element_id);
                 }
-                _ => {}
             }
+            _ => {}
         }
 
         let entity_index = entities.len();
@@ -806,24 +826,22 @@
         entities.push(entities::IfcEntity::System { id, name, members });
     }
 
-    if policy.include_geometry {
-        for (entity_index, host_id) in pending_hosts {
-            if let Some(&host_index) = out.id_to_entity.get(&host_id) {
-                if let Some(entities::IfcEntity::BuildingElement {
-                    ifc_type,
-                    predefined_type,
-                    host_element_index,
-                    ..
-                }) = entities.get_mut(entity_index)
-                {
-                    *host_element_index = Some(host_index);
-                    // RE-84: a door or window whose type draws no geometry
-                    // is only the hole it cuts, and Revit's export writes
-                    // that opening alone, with no door or window.
-                    if without_geometry.contains(&entity_index) {
-                        *ifc_type = "IFCOPENINGELEMENT".into();
-                        *predefined_type = Some("OPENING".into());
-                    }
+    for (entity_index, host_id) in pending_hosts {
+        if let Some(&host_index) = out.id_to_entity.get(&host_id) {
+            if let Some(entities::IfcEntity::BuildingElement {
+                ifc_type,
+                predefined_type,
+                host_element_index,
+                ..
+            }) = entities.get_mut(entity_index)
+            {
+                *host_element_index = Some(host_index);
+                // RE-84: a door or window whose type draws no geometry is
+                // only the hole it cuts, and Revit's export writes that
+                // opening alone, with no door or window.
+                if policy.include_geometry && without_geometry.contains(&entity_index) {
+                    *ifc_type = "IFCOPENINGELEMENT".into();
+                    *predefined_type = Some("OPENING".into());
                 }
             }
         }

diff --git a/src/ifc/mod.rs b/src/ifc/mod.rs
--- a/src/ifc/mod.rs
+++ b/src/ifc/mod.rs
@@ -1021,6 +1021,7 @@
         unplaced_wall_layers,
         element_type_ids,
         element_original_symbols,
+        element_facings,
     ) = append_production_walker_elements(
         rf,
         &mut entities,
@@ -1143,18 +1144,21 @@
     // space, which needs both on their storeys.
     export_content::contain_in_spaces(&mut entities);
 
-    if !policy.include_geometry {
-        export_content::strip_building_element_geometry(&mut entities);
-    }
-
     let recovered_units = recover_project_units(rf);
+    // B72: door and window type GlobalIds hash the opening's flip against
+    // its host wall, which needs placement and host links on entities.
     let global_ids = revit_model_global_ids(
         rf,
         &entities,
         &building_storeys,
         &element_type_ids,
         &element_original_symbols,
+        &element_facings,
     );
+
+    if !policy.include_geometry {
+        export_content::strip_building_element_geometry(&mut entities);
+    }
     let (material_layer_sets, material_layer_usages) =
         material_layer_sets_from_layers(&mut entities, &element_layers, &mut materials);
     let mut material_constituent_sets =
@@ -1949,6 +1953,7 @@
     storeys: &[Storey],
     element_type_ids: &std::collections::BTreeMap<u32, u32>,
     element_original_symbols: &std::collections::BTreeMap<u32, u32>,
+    element_facings: &std::collections::BTreeMap<u32, [f64; 2]>,
 ) -> RevitGlobalIds {
     let mut out = RevitGlobalIds {
         document: rf
@@ -2000,30 +2005,103 @@
         }
     }
     // RE-167: Revit gives a family instance's type its original symbol's
-    // GlobalId. A door's or window's is a hash of it with the door's flip
-    // (B72), not read yet, so those keep their symbol's.
-    let doors_and_windows: std::collections::BTreeSet<u32> = entities
-        .iter()
-        .filter_map(|entity| match entity {
-            entities::IfcEntity::BuildingElement {
-                ifc_type,
-                type_guid: Some(tag),
-                ..
-            } if ifc_type == "IFCDOOR" || ifc_type == "IFCWINDOW" => tag.parse().ok(),
-            _ => None,
-        })
-        .collect();
+    // GlobalId, and a door's or window's a hash of it with the door's flip
+    // (B72).
+    let mut doors_and_windows: std::collections::BTreeMap<u32, usize> = Default::default();
+    for (index, entity) in entities.iter().enumerate() {
+        let entities::IfcEntity::BuildingElement {
+            ifc_type,
+            type_guid: Some(tag),
+            ..
+        } = entity
+        else {
+            continue;
+        };
+        if ifc_type != "IFCDOOR" && ifc_type != "IFCWINDOW" {
+            continue;
+        }
+        if let Ok(id) = tag.parse::<u32>() {
+            doors_and_windows.entry(id).or_insert(index);
+        }
+    }
     for (element, original) in element_original_symbols {
-        if element_type_ids.get(element) == Some(original) || doors_and_windows.contains(element) {
+        let Some(global_id) = ids.get(original) else {
             continue;
-        }
-        if let Some(global_id) = ids.get(original) {
+        };
+        if let Some(&index) = doors_and_windows.get(element) {
+            let flipped = door_symbol_flipped(entities, index, element_facings.get(element));
+            out.element_types
+                .insert(*element, door_type_global_id(global_id, flipped));
+        } else if element_type_ids.get(element) != Some(original) {
             out.element_types.insert(*element, global_id.clone());
         }
     }
     out
 }
 
+/// Whether Revit's exporter takes a door's or window's symbol as flipped
+/// (B72, revit-ifc `DoorWindowInfo.CalculateDoorWindowInformation`): whether
+/// the side of its host wall's axis its box centre lies on differs from the
+/// side its own Y axis (`facing`) points to, a side being +Y of the wall's
+/// direction. The direction's sign cancels out; the axis runs along the
+/// longer side of the wall's plan box, turned by its rotation. A door with no
+/// host wall, or no facing read, is not flipped, as Revit's exporter has it
+/// for a door without a wall.
+fn door_symbol_flipped(
+    entities: &[entities::IfcEntity],
+    index: usize,
+    facing: Option<&[f64; 2]>,
+) -> bool {
+    const EPS: f64 = 1e-9;
+    let (
+        Some(facing),
+        Some(entities::IfcEntity::BuildingElement {
+            location_feet: Some(location),
+            host_element_index: Some(host),
+            ..
+        }),
+    ) = (facing, entities.get(index))
+    else {
+        return false;
+    };
+    let Some(entities::IfcEntity::BuildingElement {
+        location_feet: Some(wall),
+        rotation_radians,
+        extrusion: Some(body),
+        ..
+    }) = entities.get(*host)
+    else {
+        return false;
+    };
+    let turn = rotation_radians.unwrap_or(0.0)
+        + if body.width_feet >= body.depth_feet {
+            0.0
+        } else {
+            std::f64::consts::FRAC_PI_2
+        };
+    let wall_y = [-turn.sin(), turn.cos()];
+    let offset = (location[0] - wall[0]) * wall_y[0] + (location[1] - wall[1]) * wall_y[1];
+    let positive_hinge_side = offset > -EPS;
+    let facing_positive = wall_y[0] * facing[0] + wall_y[1] * facing[1] > -EPS;
+    positive_hinge_side != facing_positive
+}
+
+/// A door's or window's type GlobalId as Revit's exporter makes it (B72,
+/// revit-ifc `GUIDUtil`): MD5 of `<original symbol's GlobalId>Sub-element:
+/// Flipped: <True|False> InAssembly: False`, read as a .NET GUID.
+fn door_type_global_id(symbol_global_id: &str, flipped: bool) -> String {
+    use md5::{Digest, Md5};
+    let key = format!(
+        "{symbol_global_id}Sub-element:Flipped: {} InAssembly: False",
+        if flipped { "True" } else { "False" }
+    );
+    let digest: [u8; 16] = Md5::digest(key.as_bytes())
+        .as_slice()
+        .try_into()
+        .expect("an MD5 digest is 16 bytes");
+    crate::revit_global_ids::compress_ifc_guid(crate::revit_global_ids::canonical_guid(digest))
+}
+
 /// True when an emitted `IFCSLAB` carries no resolved thickness.
 ///
 /// The property is written positively by the record-backed slab path
@@ -2658,6 +2736,7 @@
     std::collections::BTreeMap<u32, Vec<LayerBand>>,
     std::collections::BTreeMap<u32, u32>,
     std::collections::BTreeMap<u32, u32>,
+    std::collections::BTreeMap<u32, [f64; 2]>,
 );
 
 fn append_production_walker_elements(
@@ -2689,6 +2768,7 @@
             append.unplaced_wall_layers,
             append.element_type_ids,
             append.element_original_symbols,
+            append.element_facings,
         );
     }
     Default::default()

diff --git a/src/partition_schema_mvp.rs b/src/partition_schema_mvp.rs
--- a/src/partition_schema_mvp.rs
+++ b/src/partition_schema_mvp.rs
@@ -350,6 +350,8 @@
     // --- Curtain mullions and panels turned or tilted off the model's axes,
     // with their three axes (RE-106) ---
     attach_curtain_axes(rf, revit_version, &mut out.products);
+    // --- Each door's and window's facing, for its type's flip (B72) ---
+    attach_opening_facings(rf, revit_version, [&mut out.doors, &mut out.windows]);
     // --- Each family instance's original symbol, whose GlobalId Revit's
     // export gives its type (RE-167, B60) ---
     attach_original_symbols(
@@ -1247,6 +1249,56 @@
     }
 }
 
+/// Fields holding a door's or window's facing (B72): the plan direction of
+/// its transform's Y axis (RE-87), which Revit's exporter sets against its
+/// host wall to decide whether the door's symbol is flipped.
+pub const OPENING_FACING_FIELDS: [&str; 2] = ["m_opening_facing_x", "m_opening_facing_y"];
+
+/// Give each door and window whose transform (RE-87) is found its facing
+/// ([`OPENING_FACING_FIELDS`], B72).
+fn attach_opening_facings(
+    rf: &mut RevitFile,
+    revit_version: u32,
+    groups: [&mut Vec<DecodedElement>; 2],
+) {
+    let ids: BTreeSet<u32> = groups
+        .iter()
+        .flat_map(|elements| elements.iter())
+        .filter_map(|element| element.id)
+        .collect();
+    if ids.is_empty() {
+        return;
+    }
+    let Ok(transforms) =
+        crate::partition_instance_transforms::scan_instance_transforms(rf, revit_version, &ids)
+    else {
+        return;
+    };
+    for element in groups.into_iter().flat_map(|elements| elements.iter_mut()) {
+        let Some(transform) = element.id.and_then(|id| transforms.get(&id)) else {
+            continue;
+        };
+        let [x, y, _] = transform.axes[1];
+        for (name, value) in OPENING_FACING_FIELDS.iter().zip([x, y]) {
+            element
+                .fields
+                .push(((*name).into(), InstanceField::Float { value, size: 8 }));
+        }
+    }
+}
+
+/// The plan facing [`OPENING_FACING_FIELDS`] record.
+pub fn opening_facing_from_fields(fields: &[(String, InstanceField)]) -> Option<[f64; 2]> {
+    let float = |wanted: &str| {
+        fields.iter().find_map(|(name, value)| match value {
+            InstanceField::Float { value, .. } if name == wanted => Some(*value),
+            _ => None,
+        })
+    };
+    let [x, y] = OPENING_FACING_FIELDS.map(float);
+    Some([x?, y?])
+}
+
 /// Field carrying a family instance's original symbol (RE-167): the
 /// FamilySymbol `ExporterIFCUtils.GetOriginalSymbol` returns, whose GlobalId
 /// Revit's export gives the instance's type object while its `Tag` stays the

You can send follow-ups to the cloud agent here.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a621ff70a00068b10adf165dec2f912d07eee74e. Configure here.

Comment thread src/ifc/mod.rs Resolved
…ype GlobalId, as Revit writes it (B60)

Corpus health on #663 left 186 of Core Interior's 716 typed elements with
another type GlobalId than Revit's, 164 of them columns. RE-167 (Measure runs
37221105534, 37221466107): those columns' GElement objects hold 0xffffffff
where an original symbol would be (Revit's invalid id: the instance uses its
own geometry), and each one's type GlobalId is the column's own with bytes
10 and 11 of the GUID XORed with 2048, revit-ifc's legacy instance-as-type
GUID (GUIDUtil.CreateInternal, ExporterIFCUtils.CreateSubElementGUID with
IFCFamilyInstanceSubElements.InstanceAsType = 2048). The schema pass keeps
that marker (INSTANCE_GEOMETRY), revit_global_ids gains expand_ifc_guid and
sub_element_global_id, and such an instance's type takes it.
…rst by entity, as Revit's exporter does (B60, B73)

Corpus health on #663 left 22 of Core Interior's typed elements: floor types
4166 and 71848, each written by Revit as an IfcSlabType, a second
IfcSlabType of predefined type ROOF and an IfcShadingDeviceType. RE-167
(Measure run 37223026163): the type object holding the type's lowest
ElementId has the type's own GlobalId; the others have revit-ifc's
conflict key (GUIDUtil.CreateInternal with useEntityType), MD5 of
"<type GlobalId>Sub-element: Entity: IfcSlabType:ROOF" and
"...: Entity: IfcShadingDeviceType:NOTDEFINED", with " InAssembly: False"
appended from revit-ifc 25.4 on (a 2025 or later file).

The writer now writes a type object per type, entity, predefined type and
GlobalId; the one with the lowest ElementId takes the type's GlobalId and
the others the entity key. revit_global_ids gains hashed_global_id
(md-5 joins the dependencies beside sha2), and RevitGlobalIds carries the
file's release.
…umbered partition's copy names its original symbol (B60)

RE-167's door probe (Measure run 37223323115): 105 of Core Interior's doors hold two GElement copies with different values, in Partitions/46 (or 51) and Partitions/59; Revit's export goes by the Partitions/59 copy on every one.
…s exporter gives it (B72)

tests/door_type_global_ids.rs compares, for every door and window both
exports relate to a type, the type's GlobalId with Revit's, on the four RE1
models and Core Interior.

Red with B60 (draft #665, run 37221217853, "Corpus health (tier 2)"):

  RE1-Architecture.rvt: 5 doors and windows typed in both, 5 types' GlobalIds not Revit's
  2024_Core_Interior.rvt: 138 doors and windows typed in both, 138 types' GlobalIds not Revit's
  panicked at tests/door_type_global_ids.rs:164:5:
  RE1-Architecture.rvt: 5 of 5 doors' and windows' types have another GlobalId than Revit's; first: ["416336 (IFCDOORSTYLE): Revit 1PKhJ34R4m_wvuiYRV$TaB, rvt-rs 0ptz7pvLP4Fx0ykvinP_cA", ...]
…ith the door's flip from its host wall (B72)

RE-167 and the B72 probe (Measure runs 37220217888, 37220592852): Revit's
exporter gives a door's or window's type the GlobalId MD5 makes of
"<original symbol's GlobalId>Sub-element:Flipped: <bool> InAssembly: False"
(revit-ifc GUIDUtil.CreateInternal), read as a .NET GUID. The flip is revit-ifc
DoorWindowInfo's: whether the side of the host wall's axis the door's box
centre lies on differs from the side its own Y axis points to. Computed from
rvt-rs's model, the rule gives Revit's flip for all four of RE1
Architecture's hosted doors (one flipped); the curtain wall door has no wall
host and is not flipped, as in Revit's export.

The schema pass records each door's and window's facing (its transform's Y
axis, RE-87), the export collects it, and revit_model_global_ids computes the
flip from the door's box centre and its host wall entity (the axis along the
longer side of the wall's plan box, turned by its rotation) and hashes the
original symbol's GlobalId with it. md-5 (RustCrypto, MSRV 1.85) joins the
dependencies beside sha2.
@DrunkOnJava
DrunkOnJava force-pushed the feat/b72-door-type-gids branch from 22d9bf3 to fba498f Compare October 4, 2026 18:16
…and roof slab types B60 and B73 write

IFCCOLUMNTYPE 1 -> 175 (columns with their own geometry take a type each,
revit-ifc InstanceAsType), IFCSLABTYPE 5 -> 7 (B73's roof slab types),
IFCRELDEFINESBYTYPE 16 -> 192. Taken from CI run 37223765193's
octetproof-core-interior artifact, where IfcOpenShell validated the export
with no issues and both bridge witnesses replayed as committed.
…pes B72 splits by flip

IFCDOORTYPE 3 -> 10, IFCRELDEFINESBYTYPE 192 -> 199: a door type is
written once per flip, as Revit's exporter keys it. Taken from CI run
37223818086's octetproof-core-interior artifact; both bridge witnesses
replayed as committed.
…geometry (B72)

Red output follows once CI has run.
…without geometry (B72)"

The test failed for another reason than the one it was written for: an
export in typed-no-geometry mode writes no type objects at all (the Family
and Type property set a type object needs is read with the record geometry,
behind include_geometry), so no door's type GlobalId is written in that mode
to be wrong. Corpus health run 37224651451:

  RE1-Architecture.rvt (typed-no-geometry): 0 doors and windows typed in both
  ...
  2024_Core_Interior.rvt (typed-no-geometry): 0 doors and windows typed in both
  panicked at tests/door_type_global_ids.rs:177:5: no door or window was compared

Logged as B74: when that mode gains type objects, the door's flip must come
from record geometry read in every mode.
# Conflicts:
#	research/witness/magnetar-2024-core-interior-slim/observations/rvt-rs.json
#	research/witness/magnetar-2024-core-interior/observations/rvt-rs.json
#	src/ifc/export_content.rs
#	src/ifc/mod.rs
#	src/partition_schema_mvp.rs
@DrunkOnJava
DrunkOnJava merged commit 452e205 into main Oct 4, 2026
23 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/b72-door-type-gids branch October 4, 2026 18:49
DrunkOnJava added a commit that referenced this pull request Oct 4, 2026
…ames (B74) (#694)

B74, found by Bugbot on #666. `typed-no-geometry` read an element
record's property set only with its geometry
(`src/ifc/export_content.rs:431` on main), and that set is where an
element's identity lives: its family and type names (the `ObjectType`
and the type object), a room's number and name, the Level its record
names, its Revit class and its type's text parameters. In that mode no
element was typed. The record is now read in every mode. An export
without geometry keeps only those identity properties
(`IDENTITY_PROPERTIES` plus the type's text parameters) and drops the
body, placement, host and the geometry's provenance (`BodySource`, box
sizes, profile counts and so on), as before.

A door's or window's type GlobalId hashes its flip against its host wall
(B72). The flip was computed from the written placements after the
geometry strip, so it could not survive this mode. It is now computed in
content assembly, in every mode, from the plan frames the records give,
with the same rule. That includes a curtain wall host whose body is held
until its parts are known.

Red on draft #692 (Corpus health run 37243903781). Every element the
default export types was typed otherwise without geometry: RE1
Architecture 84 of 84, Mechanical 74 of 74, Plumbing 124 of 124,
Electrical 49 of 49, Core Interior 970 of 970. The output is in the test
commit. A Measure run against `main` checks that the default export is
byte-identical.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes export content policy and GlobalId/type hashing for all
quality modes; default geometry export is intended to stay
byte-identical, but door flip and identity-property paths are sensitive.
> 
> **Overview**
> Fixes **`typed-no-geometry`** so elements keep the same
**`ObjectType`**, type entity, and type **GlobalId** as the default
export (B74).
> 
> Partition element records are now read in **every** export quality
mode, not only when geometry is included. In modes without geometry,
bodies, placements, and host links are still dropped, but the
element-record property set is trimmed to **identity** fields
(`FamilyName`, `TypeName`, room/level metadata, `RevitClass`, type text
parameters, etc.) instead of being skipped entirely.
> 
> Door/window **flip** (B72), which hashes into the type GlobalId, is
computed during content assembly from plan frames and facing data,
stored as **`element_flips`** (booleans) rather than exported
**`element_facings`**. Flip logic moves from `mod.rs` into
`export_content.rs`, including hosts whose body is held until aggregate
parts resolve.
> 
> Adds corpus integration test **`typed_no_geometry_types`** (Scaffold
vs `TypedNoGeometry` typing parity) and wires it into CI.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
0f98e99. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
DrunkOnJava added a commit that referenced this pull request Oct 23, 2026
…om their pull requests' measurements (#895)

## Summary

Four findings shipped and are cited in the code (RE-149 in
`partition_type_materials`, RE-165 in `partition_fitting_sizes`, RE-166
in `partition_curtain_materials`, RE-167 in `partition_schema_mvp`) but
never got their report under `reports/element-framing/`, so a reader
following a citation found nothing. This adds the four reports, written
from the pull requests that shipped each finding.

## Motivation

The 2026-10-23 style audit found these four as the only RE ids cited in
rustdoc with no report (145 of 149 resolve). The docs pass that follows
adds a CI check that every cited RE id has a report; this lets it pass
without exemptions.

## Changes

- `RE-149-unset-material-maps.md` (from #580),
`RE-165-fitting-nominal-diameter.md` (#651),
`RE-166-curtain-type-materials.md` (#657), `RE-167-type-global-ids.md`
(#663, #666). Each says it was written after the fact, cites the
Measure, red and green runs and the real-file targets those PRs
recorded, and gives the files by their `research/witness-registry.json`
ids and hashes.

## Testing

Docs only. Every number in the reports is copied from the PR it cites;
nothing was re-measured, and each report says so.

## Audit-honesty checklist

- [x] No new claim: each report restates its PR's recorded evidence
- [x] No emojis, private paths or internal jargon beyond the backlog ids
the PRs used

## Legal and contribution hygiene

- [x] Apache-2.0; clean-room sources only (byte observations,
`RevitAPI.dll` names, revit-ifc as CLEANROOM.md allows)

## Breaking changes

None.

## Screenshots or output samples

N/A.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant