Skip to content

fix: offer the whole inheritance chain of a copied class (GH-259) - #261

Draft
spah-soptim wants to merge 1 commit into
mainfrom
fix/GH-259-transitive-super-classes
Draft

spah-soptim wants to merge 1 commit into
mainfrom
fix/GH-259-transitive-super-classes

Conversation

@spah-soptim

Copy link
Copy Markdown
Member

Summary

CopyClassReferenceResolver walked each copied class exactly once, so it only ever saw the direct super class. Copying GeneratingUnit out of an SSH schema therefore listed Equipment alone, while PowerSystemResource and IdentifiedObject above it were never discovered - not even the client could ask for them, because CopyClassService filters the resolver's output by URI, so a class the resolver never returned cannot be selected. Only data types were resolved transitively, because they are copied with their attributes.

The pasted Equipment stub then lost its own super class as well: resolvableSuperClass dropped the link whenever the grandparent was neither copied nor already in the target, which severed the hierarchy instead of truncating it - and contradicted the top-level class, which keeps a left-behind super class as a reference.

  • resolve() now follows inheritance up to the root, naming every ancestor after the sub class that inherits from it, so the dialog reads "Equipment -> PowerSystemResource"
  • the walk stops above a class the target graph already defines: that class is not copied, so its super class would land in the target with nothing inheriting from it
  • a round that discovers nothing new ends the walk, which also terminates a cyclic hierarchy
  • a copied stub keeps its super class like the pasted class does, dangling as a reference when the ancestor stays behind, and drops it when the paste asks for no inheritance
  • the target graph is read only when there is a chain to walk at all

Related Issues

Closes #259

Checklist

  • Tests added or updated (or not applicable)
  • Documentation updated (or not applicable)
  • No breaking changes introduced (or described in the summary above)
  • Commits are signed off (git commit -s) for DCO

Testing Notes

CopyClassReferenceResolver walked each copied class exactly once, so it only ever
saw the direct super class. Copying GeneratingUnit out of an SSH schema therefore
listed Equipment alone, while PowerSystemResource and IdentifiedObject above it
were never discovered - not even the client could ask for them, because
CopyClassService filters the resolver's output by URI, so a class the resolver
never returned cannot be selected. Only data types were resolved transitively,
because they are copied with their attributes.

The pasted Equipment stub then lost its own super class as well:
resolvableSuperClass dropped the link whenever the grandparent was neither copied
nor already in the target, which severed the hierarchy instead of truncating it -
and contradicted the top-level class, which keeps a left-behind super class as a
reference.

- resolve() now follows inheritance up to the root, naming every ancestor after
  the sub class that inherits from it, so the dialog reads
  "Equipment -> PowerSystemResource"
- the walk stops above a class the target graph already defines: that class is
  not copied, so its super class would land in the target with nothing
  inheriting from it
- a round that discovers nothing new ends the walk, which also terminates a
  cyclic hierarchy
- a copied stub keeps its super class like the pasted class does, dangling as a
  reference when the ancestor stays behind, and drops it when the paste asks for
  no inheritance
- the target graph is read only when there is a chain to walk at all

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Jan-Hendrik Spahn <jan-hendrik.spahn@soptim.de>
@spah-soptim spah-soptim self-assigned this Sep 4, 2026
@spah-soptim spah-soptim added the bug Something isn't working label Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Copy and paste of a class does only include the first parent class

1 participant