Skip to content

fix(ids): keep IDS values as text and compare them with the model value's type - #864

Open
havs-mc wants to merge 1 commit into
ThatOpen:mainfrom
havs-mc:fix/ids-values-as-text
Open

havs-mc wants to merge 1 commit into
ThatOpen:mainfrom
havs-mc:fix/ids-values-as-text

Conversation

@havs-mc

@havs-mc havs-mc commented Nov 11, 2026

Copy link
Copy Markdown

Description

IDS values are text, but IDSSpecifications.xmlParser parses numeric-looking values (parseAttributeValue: true, numberParseOptions: { leadingZeros: true, hex: true }). <simpleValue>01</simpleValue> becomes 1, an enumeration value 007 becomes 7, and 1e3 becomes 1000. The string fallback from #731 then compares "1" with the model's "01" and fails. Numbers are also compared exactly, so 0.1 + 0.2 doesn't match 0.3. That accounts for the tolerance disagreements listed in #831.

  • The parser keeps tag and attribute values as text.
  • evalRequirement compares simple and enumeration values by the type of the model value. Strings compare as text. Numbers compare within the IDS tolerance v ± (|v|·1e-6 + 1e-6) (tolerance.md). Values exactly on those bounds pass, as the test cases expect, and a tiny relative margin absorbs double rounding. xs: range restrictions stay exact, as that document requires. Booleans compare as xs:boolean (true/1, false/0).
  • Bound and length limits are converted with Number() in importers/parameter.ts, since they are no longer parsed.
  • The IDS wrong auto conversion #731 workaround in IDSProperty.evalValue is no longer needed and is removed.

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following:

  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Follow the Conventional Commits v1.0.0 standard for PR naming.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves.
  • Ideally, include relevant tests that fail without this PR but pass with it.

🤖 Generated with Claude Code

…ue's type

The XML parser turned numeric-looking values into numbers, so "01" became 1
and could never match an IFCLABEL "01", and reals were compared exactly.
Values now stay text; evalRequirement compares a string as text, a number
within the IDS tolerance (|x - v| < |v| * 1e-6 + 1e-6) and a boolean
case-insensitively. Bound and length limits are converted with Number().

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

This branch has not been deployed

No deployments
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