Add partOf depth-2 recursion test cases (#155) - #457
Open
BIMvoice wants to merge 2 commits into
Open
Conversation
Of the 33 official partOf conformance cases, only 3 exercise same-relation recursion beyond depth 1, and none covers IFCRELASSIGNSTOGROUP or IFCRELCONTAINEDINSPATIALSTRUCTURE beyond a direct relation. One of the three, pass-the_containment_can_be_indirect_1_2, is in fact a pure IFCRELAGGREGATES chain, so containment recursion was not exercised anywhere in the suite. This gap is exactly where the IfcOpenShell IfcTester implementation had a bug: its group and containment branches only inspected the element's single direct relation, so an element two hops away silently passed a PROHIBITED requirement. Fixed in IfcOpenShell PR #9272. Adds two pass/fail pairs, one per uncovered relation, each pairing a required and a prohibited specification over the same two-hop chain with distinct intermediate and target classes at every hop, per Documentation/UserManual/partof-facet.md (development branch): "When the relation parameter is not specified, then all 6 are to be considered (recursively) ... otherwise only the specified relation type should be considered (also recursively)." This file was generated with the assistance of an AI coding tool.
This was referenced Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds conformance coverage for a gap that let a real implementation bug survive.
The gap
Of the 33 official
partOfconformance cases, only 3 exercise same-relation recursion beyond depth 1, and none coversIFCRELASSIGNSTOGROUPorIFCRELCONTAINEDINSPATIALSTRUCTUREbeyond a direct relation. One of those 3,pass-the_containment_can_be_indirect_1_2, is in fact a pureIFCRELAGGREGATESchain despite its name, so containment recursion was not exercised anywhere in the suite.Why it matters
That is exactly where IfcOpenShell's IfcTester had a bug. Its group and containment branches inspected only the element's single direct relation, so an element two hops away silently passed a PROHIBITED requirement, reporting compliance while the relationship existed. Fixed in IfcOpenShell#9272.
Documentation/UserManual/partof-facet.mdondevelopmentstates the rule these cases pin:Note that file differs between
developmentandver/1.1.x; the sentence above is fromdevelopment.What is added
Two pass and fail pairs, each pair sharing a two-hop chain with distinct intermediate and target classes at every hop so an entity type collision cannot mask the result:
IFCRELASSIGNSTOGROUP:pass-a_group_relationship_may_be_indirectandfail-a_prohibited_group_relationship_detects_an_indirect_groupIFCRELCONTAINEDINSPATIALSTRUCTURE:pass-a_containment_relationship_may_be_indirectandfail-a_prohibited_containment_relationship_detects_an_indirect_containerVerification
Run against IfcTester both before and after the fix above:
So the cases demonstrably catch the defect, and demonstrably do not disturb the existing suite.
All 4
.idsfiles validate againstSchema/ids.xsd, checked withxmlschema. A control file usingrelation="NOTAVALIDRELATION"is correctly rejected, confirming the validator discriminates rather than passing anything.Correction: I originally wrote that
CreateTestCasescould not be run. That was wrong. The build needs the .NET 8 runtime specifically, because Nuke usesBinaryFormatter, which .NET 9 removed. With that installed it runs in about a second. These.idsfiles are still hand-authored; I am happy to regenerate them through the official build on request.Scope
This does not address the separate "require a direct relationship" question also raised on #155, which is still open. #155 is assigned to @CBenghi, so this is offered as a starting point to take, change or discard.
This PR was created with the assistance of an AI coding tool.