Skip to content

Conversation

@jaapschoutenalliander
Copy link
Member

This pull request improves the handling of ID assignment and validation in the model container logic to prevent accidental ID overlaps when appending arrays. It also adds new unit tests to ensure correct behavior for overlapping and non-overlapping IDs.

ID assignment and validation improvements:

  • Changed the initial value of _id_counter from 0 to -1 in the base container to better represent an uninitialized state and prevent collisions with valid IDs.
  • Updated the _update_id_counter method to raise a ValueError if any incoming array's minimum ID is less than or equal to the current _id_counter, preventing ID overlaps when appending arrays with prescribed IDs. The old check for only the maximum ID being less than the counter was removed.

Signed-off-by: jaapschoutenalliander <[email protected]>
@jaapschoutenalliander jaapschoutenalliander linked an issue Sep 25, 2025 that may be closed by this pull request
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 8, 2025

@jaapschoutenalliander jaapschoutenalliander merged commit 06618b7 into main Oct 8, 2025
15 checks passed
@jaapschoutenalliander jaapschoutenalliander deleted the chore/issue-91-check-ids branch October 8, 2025 09:06
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.

[BUG] *Missing checks on duplicate ID's in append method*

3 participants