Skip to content

red: B43 duct Shape (scratch, do not merge) - #685

Closed
DrunkOnJava wants to merge 1 commit into
mainfrom
red/b43-duct-shape
Closed

DrunkOnJava wants to merge 1 commit into
mainfrom
red/b43-duct-shape

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Red run for B43's test; the implementation lands in a rebuilt PR after B59 (#684).


Note

Low Risk
Test-only and CI manifest change; no production export logic is modified in this diff.

Overview
Adds a red integration test for B43 (#35): rvt-rs IFC export must match Revit’s Pset_DuctSegmentTypeCommon.Shape on each of the 25 rectangular ducts in RE1 Mechanical (IfcPropertyEnumeratedValue / RECTANGULAR), keyed by element Tag.

The test parses Revit’s reference STEP and the exporter output via small STEP helpers, filters ducts by IFCFLOWSEGMENT / Rectangular Duct ObjectType, and fails with a per-tag diff when Shape differs. It skips when RVT_PROJECT_CORPUS_DIR or the RVT/IFC pair is missing.

Registers duct_segment_shape under the real CI target list in tools/ci/test-targets.txt so the new tests/*.rs target cannot run or skip silently. Exporter behavior is not changed here—the PR description positions this as a failing run until implementation lands after B59 (#684).

Reviewed by Cursor Bugbot for commit cd19466. Configure here.

@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: Shape test can pass empty
    • The test now builds the reference shapes map first and requires all 25 rectangular ducts to have Shape in Revit's export before comparing, so an empty parse fails instead of passing on None versus None.

Create PR

Or push these changes by commenting:

@cursor push 43af14e8a9
Preview (43af14e8a9)
diff --git a/tests/duct_segment_shape.rs b/tests/duct_segment_shape.rs
--- a/tests/duct_segment_shape.rs
+++ b/tests/duct_segment_shape.rs
@@ -105,15 +105,20 @@
         return;
     }
     let step = std::fs::read_to_string(&reference).expect("reference IFC");
+    let theirs = shapes(&step);
     // Revit also writes the set on Mechanical's pipes; the ducts are the
     // elements whose ObjectType is a Rectangular Duct type.
     let ducts: Vec<String> = entities(&step)
         .values()
         .filter(|(e, a)| e == "IFCFLOWSEGMENT" && a.contains("'Rectangular Duct:"))
         .filter_map(|(_, a)| a.rsplit('\'').nth(1).map(str::to_string))
+        .filter(|tag| theirs.contains_key(tag))
         .collect();
-    assert_eq!(ducts.len(), 25, "Revit's ducts");
-    let theirs = shapes(&step);
+    assert_eq!(
+        ducts.len(),
+        25,
+        "Revit's ducts with Pset_DuctSegmentTypeCommon.Shape"
+    );
     let mut rf = RevitFile::open(&rvt).expect("open");
     let result = RvtDocExporter
         .export_with_diagnostics(&mut rf)

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 cd19466. Configure here.

"{} of 25 ducts' Shape is not Revit's (Tag, Revit's, rvt-rs's), first 3: {:?}",
wrong.len(),
&wrong[..wrong.len().min(3)]
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shape test can pass empty

Medium Severity

The check only compares theirs and ours per duct Tag, so None versus None counts as a match. It never requires that Revit's Pset_DuctSegmentTypeCommon.Shape was actually read. If shapes() misses those properties, all 25 ducts look equal and this red test goes green without any Shape on the rvt-rs side.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cd19466. Configure here.

@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Red draft for B43; its run (37235152063) is recorded in the rebuilt PR's test commit.

@DrunkOnJava DrunkOnJava closed this Oct 4, 2026
DrunkOnJava added a commit that referenced this pull request Oct 4, 2026
…e (B43) (#686)

B59 reads a duct type's shape from its native record's sweep profile.
Each duct now also carries it in Pset_DuctSegmentTypeCommon.Shape,
written the way Revit's export writes it: an IfcPropertyEnumeratedValue
of IfcLabel('RECTANGULAR') on RE1's ducts. The value is IFC's
PEnum_DuctSegmentShape: RECTANGULAR, ROUND or FLATOVAL. A new
PropertyValue::Enumerated carries it, and the viewer's property panel
shows it as text. RE1 Mechanical's 25 ducts are all rectangular, so
ROUND and FLATOVAL rest on IFC's enumeration alone.

Red on draft #685 (run 37235152063, 25 of 25 missing); the output is in
the test commit.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches IFC property serialization and duct export paths; incorrect
enumerated encoding could break downstream BIM tools that read standard
MEP property sets.
> 
> **Overview**
> Adds **`PropertyValue::Enumerated`** so the STEP writer can emit
**`IfcPropertyEnumeratedValue`** (labels as `IFCLABEL`), and the viewer
formats those values as text rather than numeric columns.
> 
> Duct IFC export now writes **`Pset_DuctSegmentTypeCommon.Shape`** from
the partition field **`m_duct_shape`**, populated when building ducts
via **`NativeDuctShape::ifc_shape()`** (`RECTANGULAR`, `ROUND`,
`FLATOVAL`). A corpus test compares all 25 RE1 Mechanical ducts against
Revit’s reference IFC; CI registers **`duct_segment_shape`**.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
12fc679. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@DrunkOnJava
DrunkOnJava deleted the red/b43-duct-shape branch October 18, 2026 09:36
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