Skip to content

Fix OrderedNamespaceSet.__setitem__ int: remove-before-add#517

Open
zrgt wants to merge 1 commit intoeclipse-basyx:developfrom
rwth-iat:fix/b5-ordered-namespaceset-setitem-int
Open

Fix OrderedNamespaceSet.__setitem__ int: remove-before-add#517
zrgt wants to merge 1 commit intoeclipse-basyx:developfrom
rwth-iat:fix/b5-ordered-namespaceset-setitem-int

Conversation

@zrgt
Copy link
Copy Markdown
Contributor

@zrgt zrgt commented May 5, 2026

Summary

OrderedNamespaceSet.__setitem__ with an integer index called super().add(new_item) before removing the old item. When the new item shares an attribute (e.g. id_short) with the item being replaced, _validate_namespace_constraints raised a false AASConstraintViolation because the old item was still in the backend.

Fix: remove the old item first, attempt the add, and restore the old item on failure.

Fixes #498

Test plan

  • test_ordered_namespaceset_int_setitem_same_id_short — replace item with new one sharing same id_short succeeds without error
  • Full test.model.test_base suite passes

…ng new

add-before-remove caused false AASConstraintViolation when new item
shares an attribute (e.g. id_short) with the item being replaced.
Fix removes old item first, rolls back if the subsequent add fails.

Fixes eclipse-basyx#498
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