Skip to content

ifctester: fix prohibited spec requirement status - #9189

Open
BIMvoice wants to merge 2 commits into
IfcOpenShell:v0.8.0from
BIMvoice:fix/ifctester-prohibited-requirement-status
Open

ifctester: fix prohibited spec requirement status#9189
BIMvoice wants to merge 2 commits into
IfcOpenShell:v0.8.0from
BIMvoice:fix/ifctester-prohibited-requirement-status

Conversation

@BIMvoice

Copy link
Copy Markdown
Contributor

For a prohibited specification (maxOccurs=0), requirement facets are deliberately never run against matched elements. So facet.failures stays empty, and Specification.validate()'s unconditional

facet.status = not bool(facet.failures)

marks every requirement as passed, even when the specification itself fails because a prohibited element was found.

The Json, Html and Ods reporters then render green "pass" requirement rows directly underneath a red failing specification.

This is not a new design. The sibling branch, "required, but no applicable entities", already propagates facet.status = False correctly. The prohibited branch was simply missing the same two lines, and the fix adds them.

Regression test added, verified red before the fix and green after.

Generated with the assistance of an AI coding tool.

Requirements are deliberately skipped for a prohibited
specification (maxOccurs=0), so a matched element never populates
facet.failures. Specification.validate() then computed
facet.status = not bool(facet.failures) unconditionally, so every
requirement facet reported status True (passed) even when the
specification itself failed because a prohibited element existed.

Reporters that render per-requirement status (Json, Html, Ods) would
show a green "pass" row for a requirement that was never actually
checked, next to a failing specification. The sibling branch for a
required specification with no applicable entities already sets
facet.status = False for this exact reason; the prohibited branch
was missing the same line.

Generated with the assistance of an AI coding tool.
@BIMvoice BIMvoice added the PR Proposed A PR has been proposed for this bug/feature. label Jul 31, 2026
@BIMvoice BIMvoice removed the PR Proposed A PR has been proposed for this bug/feature. label Jul 31, 2026
BIMvoice added a commit to BIMvoice/IfcOpenShell that referenced this pull request Aug 1, 2026
Four minimal .ids/.ifc pairs, one per defect fixed by this branch.
property_optional_mask, console_prohibited and txt_dropped_text
are each verified red before the fix and green after through a
plain ids.open/ifcopenshell.open/validate call, without touching
a facet's __call__ or forcing any internal state.

json_prohibited needs one caveat: Json.report_specification's
buggy line only executes when requirement.status is False with
empty failures, and on this branch alone nothing forces
requirement.status False for a violated prohibition. That force
is PR IfcOpenShell#9189's ids.py change, not this one's, so a natural
validate() call on this branch cannot reach the buggy line by
itself. The test reproduces the exact precondition IfcOpenShell#9189
produces (documented in the test) before calling the Json
reporter, mirroring this branch's own reporter test. This is
disclosed rather than presented as a clean natural trigger.

Requested by aothms on PR IfcOpenShell#9190.

Generated with the assistance of an AI coding tool.
Minimal .ids/.ifc pair: a prohibited specification (no walls
allowed) violated by one wall. Requirement checks are skipped
for prohibited specifications, so requirement.failures stays
empty; the requirement's status must still be False. Verified
red (requirement.status True) against the pre-fix code and
green (False) against this branch's fix, through ids.open and
ifcopenshell.open, not by calling the facet directly. Requested
by aothms on PR IfcOpenShell#9203/IfcOpenShell#9205 (applies repo-wide to all ids PRs).

Generated with the assistance of an AI coding tool.
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