Skip to content

Structure_Engine: Extend IsValid for ICase - #3643

Merged
IsakNaslundBh merged 8 commits into
developfrom
Structure_Engine-#3642-Extend-IsValid-for-ICase
Nov 24, 2026
Merged

IsakNaslundBh merged 8 commits into
developfrom
Structure_Engine-#3642-Extend-IsValid-for-ICase

Conversation

@Chrisshort92

@Chrisshort92 Chrisshort92 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Issues addressed by this PR

Closes #3642

IsValid on a LoadCombination now also checks what it contains, following on from #3635:

  • it must contain at least one case
  • every nested case must be valid (checked with IsValid)
  • every factor must be a finite number
  • no case may appear twice
  • it must not contain itself, directly or through nested combinations

A new public ContainsItself method does the self-containment check, so it can also be used on its own.

Test files

image

https://burohappold.sharepoint.com/:f:/r/sites/BHoM/02_Current/12_Scripts/02_Pull%20Request/BHoM/BHoM_Engine/Structure_Engine/%233643-Extend-IsValid-for-ICase?d=w01eeab4bbeca476581852e306991e835&csf=1&web=1&e=N2vvcG

Unit tests for ContainsItself are added in Structure_Engine_Tests.

Changelog

Added

  • Query.ContainsItself(this LoadCombination) in Structure_Engine

Changed

  • Query.IsValid(this ICase) in Structure_Engine: also checks a LoadCombination's cases and factors
  • Query.IsValid(this ICase) in Structure_Engine: new optional hidden message input, added to the end of every error

Additional comments

Chrisshort92 and others added 2 commits November 16, 2026 19:29
IsValid(ICase) now also checks a LoadCombination: at least one case, no null
cases, finite factors, no case or number repeated, and that it does not
contain itself directly or through nested combinations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Chrisshort92 Chrisshort92 linked an issue Nov 16, 2026 that may be closed by this pull request
Copies of a combination share its number, and packages identify cases by
number, so a combination factoring a copy of itself is now caught.

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

Copy link
Copy Markdown
Contributor Author

@BHoMBot check required

@bhombot-ci

bhombot-ci Bot commented Nov 16, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check code-compliance
  • check documentation-compliance
  • check project-compliance
  • check core
  • check null-handling
  • check serialisation
  • check versioning
  • check installer

@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check copyright-compliance

@bhombot-ci

bhombot-ci Bot commented Nov 16, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check copyright-compliance

@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check dataset-compliance

@bhombot-ci

bhombot-ci Bot commented Nov 16, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check dataset-compliance

@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check unit-tests

@bhombot-ci

bhombot-ci Bot commented Nov 16, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check unit-tests

@Chrisshort92 Chrisshort92 changed the title Extend IsValid for ICase Structure_Engine: Extend IsValid for ICase Nov 16, 2026

@IsakNaslundBh IsakNaslundBh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Generally looks good!

Have added a few comments however. Please see below.

Comment thread Structure_Engine/Query/IsValid.cs Resolved
Comment thread Structure_Engine/Query/IsValid.cs Resolved
Comment thread Structure_Engine/Query/IsValid.cs Resolved
Chrisshort92 and others added 2 commits November 17, 2026 09:57
The factor check no longer sits in an else after the null check, so every
problem with a factored case is recorded. A null case is named as such in
the factor message instead of reading its number.

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

Copy link
Copy Markdown
Contributor Author

@BHoMBot check code compliance

@bhombot-ci

bhombot-ci Bot commented Nov 17, 2026

Copy link
Copy Markdown

@Chrisshort92 sorry, I didn't understand.
Was that comment an instruction for me? If so, could you state again what check you would like me to do?
For a list of available instructions, please see this wiki page.

@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check code-compliance

@bhombot-ci

bhombot-ci Bot commented Nov 17, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check code-compliance

There are 22 requests in the queue ahead of you.

@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check required

@bhombot-ci

bhombot-ci Bot commented Nov 17, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check code-compliance
  • check documentation-compliance
  • check project-compliance
  • check core
  • check null-handling
  • check serialisation
  • check versioning
  • check installer

There are 16 requests in the queue ahead of you.

@bhombot-ci

bhombot-ci Bot commented Nov 17, 2026

Copy link
Copy Markdown

The check code-compliance has already been run previously and recorded as a successful check. This check has not been run again at this time.

@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check required

@bhombot-ci

bhombot-ci Bot commented Nov 17, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check code-compliance
  • check documentation-compliance
  • check project-compliance
  • check core
  • check null-handling
  • check serialisation
  • check versioning
  • check installer

There are 17 requests in the queue ahead of you.

Shorten the method and test descriptions, and move implementation detail
into short inline comments.

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

Copy link
Copy Markdown
Contributor Author

@BHoMBot check required

@bhombot-ci

bhombot-ci Bot commented Nov 23, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check code-compliance
  • check documentation-compliance
  • check project-compliance
  • check core
  • check null-handling
  • check serialisation
  • check versioning
  • check installer

There are 6 requests in the queue ahead of you.

@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check copyright-compliance

@bhombot-ci

bhombot-ci Bot commented Nov 23, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check copyright-compliance

@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check dataset-compliance

@bhombot-ci

bhombot-ci Bot commented Nov 23, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check dataset-compliance

@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check unit-tests

@bhombot-ci

bhombot-ci Bot commented Nov 23, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check unit-tests

@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check null-handling

@bhombot-ci

bhombot-ci Bot commented Nov 23, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check null-handling

@IsakNaslundBh IsakNaslundBh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Happy with this now. All looks good, and have tested it though.

Happy to approve!

@IsakNaslundBh

Copy link
Copy Markdown
Contributor

@BHoMBot check ready-to-merge

@bhombot-ci

bhombot-ci Bot commented Nov 24, 2026

Copy link
Copy Markdown

@IsakNaslundBh to confirm, the following actions are now queued:

  • check ready-to-merge

@Chrisshort92 Chrisshort92 added the type:feature New capability or enhancement label Nov 24, 2026
@Chrisshort92

Copy link
Copy Markdown
Contributor Author

@BHoMBot check ready-to-merge

@bhombot-ci

bhombot-ci Bot commented Nov 24, 2026

Copy link
Copy Markdown

@Chrisshort92 to confirm, the following actions are now queued:

  • check ready-to-merge

@IsakNaslundBh
IsakNaslundBh merged commit 5bdfd7a into develop Nov 24, 2026
21 checks passed
@IsakNaslundBh
IsakNaslundBh deleted the Structure_Engine-#3642-Extend-IsValid-for-ICase branch November 24, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature New capability or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Structure_Engine: Extend IsValid for ICase

2 participants