Skip to content

Fix NamespaceSet handling in Descriptor initialization and update_from() #661

Open

Description

@s-heppner

Currently, the descriptor classes in server/app/model/descriptor.py handle their extension NamespaceSet incorrectly in two places:

  • AssetAdministrationShellDescriptor.__init__() calls super().__init__(), which already creates self.extension as a NamespaceSet. Then it creates a second NamespaceSet and assigns it to self.extension. Both sets register themselves in namespace_element_sets, so the descriptor has an orphaned, empty NamespaceSet that is still part of its namespace.
  • Descriptor.update_from() copies every instance attribute of other with setattr(self, attr, getattr(other, attr)). This replaces self.extension with the NamespaceSet of other. The items in that set still have other as their parent. The loop also replaces self.namespace_element_sets with the list of other.

Today both bugs have no visible effect, because the attribute is silently rebound. But they leave the descriptor's namespace in an inconsistent state. They also stop working as soon as assignments to NamespaceSet attributes are protected, as proposed in #619 for #65:

  • AssetAdministrationShellDescriptor("urn:a", extension=[Extension("E1", ...)]) raises AASConstraintViolation (AASd-077).
  • Descriptor.update_from() raises ValueError: Object has already a parent when other has extensions. This breaks the registry endpoints that update descriptors.

The descriptors should handle NamespaceSets the same way the SDK model classes do:

  • Descriptor.__init__() should accept description, display_name and extension. AssetAdministrationShellDescriptor should pass them through to it instead of setting them a second time.
  • Descriptor.update_from() should skip namespace_element_sets and update NamespaceSet attributes with update_nss_from() instead of rebinding them, as Referable.update_from() does.

Activity

  1. added
    bugSomething isn't working
    serverSomething to do with the `server` package
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingserverSomething to do with the `server` package

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions