Skip to content
New issue

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

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

Already on GitHub? # to your account

Ordering of replicated relationships in deployment environment is non-deterministic #362

Closed
goto1134 opened this issue Dec 8, 2024 · 4 comments

Comments

@goto1134
Copy link
Contributor

goto1134 commented Dec 8, 2024

Description

Running tests in https://github.com/goto1134/structurizr-d2-exporter, I face multiple false-negative results.

The tests are end-to-end: given a structurizr workspace.dsl the code produces a d2 output and check if it is the same as expected.

The diffs for failed tests usually contain the same data but a different order of relationships added:
image
See an example here: https://github.com/goto1134/structurizr-d2-exporter/pull/143/checks?check_run_id=33778947846

Please provide a deterministic order of relationships in the workspace to be exported.

Priority

I have no budget and there's no rush, please add this feature for free

More information

No response

@goto1134 goto1134 changed the title Determenistic order of connections to be exported Determenistic order of relationships to be exported Dec 8, 2024
@goto1134 goto1134 changed the title Determenistic order of relationships to be exported Undetermined order of relationships to be exported Dec 8, 2024
@simonbrowndotje
Copy link
Contributor

RelationshipView instances are stored in a TreeSet, so I'm not sure how you're seeing non-deterministic ordering. If this was the case, my own exporter tests should exhibit the same failing behaviour, but they don't.

Perhaps it's related to view.relationships.associateBy { it.id }, which seems to use a LinkedHashMap?

@goto1134
Copy link
Contributor Author

goto1134 commented Dec 9, 2024

@simonbrowndotje, thank you; I will check that!

@goto1134
Copy link
Contributor Author

goto1134 commented Dec 9, 2024

@simonbrowndotje, the code you referenced is only used for animations, and the workspace in the provided test does not use any animation in it. So it can't be the LinkedHashMap.

Do you think I could gather some example data for you?

@simonbrowndotje simonbrowndotje changed the title Undetermined order of relationships to be exported Ordering of replicated relationships in deployment environment is non-deterministic Dec 10, 2024
@simonbrowndotje
Copy link
Contributor

I've just released v3.2.1 that should resolve this for you ... it turns out that it was the process of replicating relationships when software system/container instances were added to deployment nodes that was non-deterministic, rather than calling ModelView.getRelationships().

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants