Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MultiRootInheritanceGraph not detecting circular inheritance #5672

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

beck-thompson
Copy link

MultiRootInheritanceGraph failed to properly detect the case of you being your own parent! This caused an infinite loop on start up of SS14 if you had a prototype whose parent was itself.

Example:

- type: entity
  parent: CoolEntity
  id: CoolEntity

I think the fix is just to add yourself to the data structure before checking for circular inheritance but I could be wrong! You could also just manually check that you don't have yourself as a parent but that seemed hacky. This makes sense and does appear to work.

@beck-thompson
Copy link
Author

I uhh think the tests might be borked... The run fine normally on my computer 😢

@deltanedas
Copy link
Contributor

6 hour test real

@beck-thompson
Copy link
Author

Figured out the issue with the test. The issue is that the TestCircleException runs and properly detects and throws exceptions. However, because the PrototypeManager is reused over mutliple tests, the graph is all messed up (There are now like partially inserted things that have circular inheritance).

I'm unsure how I should fix this! Here is what I think I could do:
1.) Rewrite the PrototypeManager_Test to not reuse the manager throughout multiple tests.
2.) Change my logic so nothing gets inserted into the graph. I can only think of kind of hard coded checks beforehand so it wont be as pretty!
3.) I had a third I idea... I forget now 😆

For the person reviewing this, or anyone who has an idea 😆, let me know what I should do 🫡

Copy link
Member

@Tayrtahn Tayrtahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an engine maint, but this looks good to me! Just a few suggested tweaks.

Robust.Shared/Prototypes/MultiRootInheritanceGraph.cs Outdated Show resolved Hide resolved
Robust.Shared/Prototypes/MultiRootInheritanceGraph.cs Outdated Show resolved Hide resolved
Robust.UnitTesting/Shared/Prototypes/MultiRootGraphTest.cs Outdated Show resolved Hide resolved
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.

3 participants