Skip to content

Test case: write the slash in the FireRating pattern without a backslash - #467

Open
madsik wants to merge 1 commit into
buildingSMART:developmentfrom
madsik:testcase/plain-slash-in-pattern
Open

madsik wants to merge 1 commit into
buildingSMART:developmentfrom
madsik:testcase/plain-slash-in-pattern

Conversation

@madsik

@madsik madsik commented Nov 16, 2026

Copy link
Copy Markdown

The requirement of property/fail-properties_can_be_associated_to_relevant_object_types uses this pattern:

(-|[0-9]{2,3})\/(-|[0-9]{2,3})\/(-|[0-9]{2,3})

In XML Schema regular expressions \/ is not an escape: SingleCharEsc allows only \n \r \t \\ \| \. \? \* \+ \( \) \{ \} \- \[ \] \^, and / needs no escape. Many engines read \/ as / anyway: libxml2 2.11.9 (it accepts it since 2.10, as a non-standard escape), the Xerces built into Java 8, xmlschema 4.2.0, and .NET's Regex, which the IDS-Audit-tool uses. libxml2 before 2.10 refuses the pattern ("Wrong escape sequence"), and so does any checker that follows the grammar. For those, this IDS is invalid and the case comes out as invalid instead of fail, for a reason that has nothing to do with what it tests.

This pull request writes the slash plainly, in the entry in scripts.md and in the .ids, so the two stay the same. For engines that accepted \/ nothing changes: of the file's three FireRating values, -/-/- and 120/120/120 match and FOOBAR does not, so the expected result stays fail. IfcOpenShell made the same change in its ids_doc_generator.py in March 2026 (IfcOpenShell/IfcOpenShell@77f0c43).

I could not run the .NET build here, so I edited the .ids line by hand. Reading the generator, it copies the pattern text as written, so regenerating should give the same file.

Prepared with the help of Claude. I have read every line and will answer the review myself.

The pattern of property/fail-properties_can_be_associated_to_relevant_object_types
was (-|[0-9]{2,3})\/(-|[0-9]{2,3})\/(-|[0-9]{2,3}). In XML Schema regular
expressions (SingleCharEsc) "\/" is not an escape, and "/" needs none.
libxml2 since 2.10, Java 8's Xerces, xmlschema and .NET read "\/" as "/",
but libxml2 before 2.10 and any checker that follows the grammar refuse
the pattern, and the case then reads as invalid instead of fail. Where
"\/" was accepted it meant "/", so for those engines nothing changes.
The entry in scripts.md and the .ids change together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@andyward

Copy link
Copy Markdown
Contributor

This simple PR is flagging up a couple of things for me:

  1. The IFC File for this test case is ambiguous and likely to cause false positives since it should fail without the property value's pattern restriction because one of the four applicable WallTypes in the IFC has no FireRating property.
    The corresponding IFC test file is nothing like other succinct generated IFCs in the Test Cases
  2. There's no corresponding passing test case - Are we actually exercising the testing of properties via IfcTypeObject.HasProperties - beyond the 'properties_can_be_inherited_via_the_type' tests?
  3. While the test case is notionally testing if properties on IfcObjectTypes can be tested, we're actually employing regex edge cases in what should presumably be a simple IDS property test on a WallType. If anything this kind of pattern test should be in the restriction tests with other regex boundary tests
  4. We also need to think about future Regex flavours in v2: e.g. Flavour of RegEx allowing negation #349

I'd recommend we simplify the IFC test file (a variation on fail-properties_can_be_overriden_by_an_occurrence_2_2.ifc is probably enough), and we should add a test case that passes when checking properties on IfcObjectType.

@madsik

madsik commented Nov 23, 2026

Copy link
Copy Markdown
Author

Thanks, Andy, good points. I checked the IFC: wall type DEMO1 has no property set at all, so the file fails on the missing FireRating before the pattern is ever tested, while scripts.md says it fails only because of FOOBAR. A tool that ignores the pattern still gets the expected result.

This PR only makes the existing .ids valid against the XML Schema regex grammar, where \/ is not a defined escape. A plain / is an ordinary character in all the common regex flavours, so the change should hold whatever #349 decides for v2. No result changes.

For the rest I'd suggest a follow-up PR:

  1. Replace the IFC with a small one like fail-properties_can_be_overriden_by_an_occurrence_2_2.ifc: three wall types with Pset_WallCommon.FireRating set to -/-/-, 120/120/120 and FOOBAR, so only FOOBAR fails.
  2. Add pass-properties_can_be_associated_to_relevant_object_types with the same IDS and only valid values.
  3. Keep the value check in these two simple, and leave regex edge cases to the restriction tests.

If you'd rather have it all in this PR, I can add it here instead. Which do you prefer?

Prepared with the help of Claude. I have read every line and will answer the review myself.

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

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants