Skip to content

Level ElementId storey bind + honest AProperty parameters (#33/#35) - #144

Merged
DrunkOnJava merged 3 commits into
mainfrom
cursor/level-bind-parameters-71b3
Aug 29, 2026
Merged

DrunkOnJava merged 3 commits into
mainfrom
cursor/level-bind-parameters-71b3

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Aug 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • M4-05: Recover levels and storey assignment #33 leftover — Level ElementId bind (fail-closed): LevelStoreyBind maps Level ElementId → storey index and assigns Floor/Room storey_index only when both sides carry matching ids. Partition MVP Levels remain id-less on Einhoven / 2024 Core Interior, so Floors/Rooms stay honest Unassigned. Unit tests cover bind success + fail-closed; examples/probe_level_elementid_bind.rs documents insufficient LevelAssociationCell corpus evidence.
  • M4-07: Recover common parameters #35 — AProperty parameter values: APropertyString, ParameterEntry JSON helpers, and a parameters[] array on CLI (rvt-elements) + Python decoded_elements(). Host elements return [] until host↔AProperty joins recover. Diagnostics gain parameter_value_count; rvt-inspect + viewer File Status Parameters row report honest empty on corpora. Decoder registry 81.

Out of scope

Test plan

  • Unit: level_bind::* (5)
  • Unit: parameters::tests::parameter_entries_* + aproperty_string_*
  • Unit: all_decoders_len_is_eighty_one
  • Corpus smoke: Einhoven rvt-elements → all parameters: []; rvt-inspect Parameters row honest empty
  • cargo test --release --lib (839 pass)

Note

Medium Risk
The decoded-elements JSON schema now requires parameters, which may break strict validators; IFC storey assignment logic changed for Floor/Room when Level ElementIds appear on both sides.

Overview
Adds fail-closed Level ElementId → IFC storey binding (#33): new LevelStoreyBind records Level ids when present and sets Floor/Room storey_index in production IFC export only when typed m_level_id matches a recorded Level. Partition MVP Levels without ElementIds stay unassigned; diagnostics track level_elementid_binds. Research probe probe_level_elementid_bind documents insufficient corpus evidence.

Ships honest AProperty parameter surfacing (#35): registers APropertyString (decoder count 81), extends ParameterValue / ParameterEntry with JSON helpers, and adds a required parameters array on rvt-elements, Python decoded_elements(), and decoded-elements.schema.json—non-empty only for AProperty* carrier rows; host elements stay [] until host↔parameter joins exist.

Diagnostics and UX gain parameter_value_count on IFC export diagnostics; rvt-inspect and the viewer File Status Parameters row report recovered values or an explicit pending-join message. Docs (README, status, compatibility, roadmap) align on 81 decoders and the new honesty boundaries.

Reviewed by Cursor Bugbot for commit 0ae3cb5. Configure here.

cursoragent and others added 2 commits August 29, 2026 13:46
Wire LevelStoreyBind into the production IFC export path so Floors and
Rooms resolve storey_index only when both sides carry matching ElementIds.
Partition MVP Levels remain id-less on available corpora, so Floors/Rooms
stay honestly Unassigned. Unit tests cover bind success and fail-closed
cases; a corpus probe documents insufficient LevelAssociationCell evidence.

Co-authored-by: DrunkOnJava <[email protected]>
Add APropertyString, ParameterEntry JSON helpers, and a parameters[]
array on CLI/Python decoded elements. Host elements return [] until
host↔AProperty joins recover. Diagnostics gain parameter_value_count;
rvt-inspect and the viewer File Status Parameters row report honest
empty on corpora. Decoder registry is now 81.

Co-authored-by: DrunkOnJava <[email protected]>

@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 using default effort and found 1 potential issue.

Fix All in Cursor

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

  • ✅ Fixed: Level bind depends on iteration order
    • Deferred Floor/Room storey_index resolution to a second pass after all Levels are recorded, matching the existing pending_hosts pattern.

Create PR

Or push these changes by commenting:

@cursor push 776e00dbd2
Preview (776e00dbd2)
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
@@ -113,6 +113,7 @@
 ) -> TypedProductionAppend {
     let mut out = TypedProductionAppend::default();
     let mut pending_hosts: Vec<(usize, u32)> = Vec::new();
+    let mut pending_storeys: Vec<(usize, u32)> = Vec::new();
     let mut level_bind = crate::level_bind::LevelStoreyBind::new();
 
     for decoded in decoded_iter {
@@ -223,18 +224,17 @@
         }
 
         // Floor/Room → storey via Level ElementId only when both sides
-        // carry ids that match. Partition MVP Levels are id-less today,
-        // so this stays None (honest Unassigned) on available corpora.
-        let storey_index = level_bind.storey_index_for(&decoded);
-        if storey_index.is_some() {
-            out.level_elementid_binds += 1;
+        // carry ids that match. Defer until after the loop so Floors
+        // that precede their Level in iter_elements still bind.
+        if let Some(level_id) = crate::level_bind::level_id_from_decoded(&decoded) {
+            pending_storeys.push((entity_index, level_id));
         }
 
         entities.push(entities::IfcEntity::BuildingElement {
             ifc_type,
             name,
             type_guid,
-            storey_index,
+            storey_index: None,
             material_index: None,
             property_set,
             location_feet,
@@ -261,6 +261,18 @@
         }
     }
 
+    for (entity_index, level_id) in pending_storeys {
+        if let Some(storey_index) = level_bind.storey_index_for_level_id(level_id) {
+            if let Some(entities::IfcEntity::BuildingElement {
+                storey_index: si, ..
+            }) = entities.get_mut(entity_index)
+            {
+                *si = Some(storey_index);
+                out.level_elementid_binds += 1;
+            }
+        }
+    }
+
     out
 }

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 0ae3cb5. Configure here.

Comment thread src/ifc/export_content.rs
let storey_index = level_bind.storey_index_for(&decoded);
if storey_index.is_some() {
out.level_elementid_binds += 1;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Level bind depends on iteration order

Medium Severity

append_typed_production_elements records Level ids and resolves Floor/Room storey_index in one pass. A Floor or Room that appears before its Level never binds, even when both sides already carry matching ElementIds. Host linking in the same function already defers resolution until after the loop; this bind does not, so the advertised success path is order-dependent and stays Unassigned whenever iter_elements yields hosts first (Global/Latest is score-desc, not class-ordered).

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0ae3cb5. Configure here.

@DrunkOnJava
DrunkOnJava merged commit 866721f into main Aug 29, 2026
24 checks passed
@DrunkOnJava
DrunkOnJava deleted the cursor/level-bind-parameters-71b3 branch August 29, 2026 14:10
DrunkOnJava added a commit that referenced this pull request Aug 31, 2026
Fail-closed Level ElementId → BuildingStorey bind for Floors/Rooms (#33 path).
Surface AProperty parameter values on CLI/Python/viewer with honest empty when absent (#35).
Skip compound material layers (#34/#88) pending evidence.
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.

2 participants