Skip to content

A library that redeclares a partner unit class with a description gets two entries and no error #1434

Description

@VisLab

An unmerged library partnered with a standard schema may add units to one of the partner's unit classes by redeclaring the class bare, * timeUnits, and listing the new units under it (_merge_unit_classes in hed/schema/schema_io/schema_merge.py calls that redeclaration the placeholder that only adds units). If the redeclaration instead carries attributes or a description, * timeUnits [Units of time.], the merge takes it for a new class and inserts it beside the partner's, so the merged schema ends up with two timeUnits entries:

  • the partner's, no inLibrary, holding the partner's units plus the library's new unit;
  • the library's, inLibrary=, holding no units.

check_compliance() reports nothing, HedSchemaSection.duplicate_names is empty, and get_tag_entry("timeUnits", key_class=HedSectionKey.UnitClasses) returns the partner's entry while all_entries yields both. Anything that iterates the section (the schema comparer, for one) compares or reports the wrong entry. Reproduced with hedtools at 32c7bc2 against a 8.4.0 partner.

Expected: either a load or compliance error for redeclaring a partner element with content (SCHEMA_LIBRARY_INVALID or SCHEMA_DUPLICATE_NODE, whichever the specification's element compatibility rule in 3.1.2.4 says applies to a library colliding with its own standard partner), or the redeclaration accepted as the bare form is, adding the units to the existing class and ignoring or merging the description. Not both entries.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions