Ruby: Make module graph queries avoid relying on evalaution order.#19116
Merged
Ruby: Make module graph queries avoid relying on evalaution order.#19116
Conversation
97def4d to
0ccbe3e
Compare
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
Files not reviewed (4)
- ruby/ql/test/library-tests/modules/ancestors.expected: Language not supported
- ruby/ql/test/library-tests/modules/ancestors.ql: Language not supported
- ruby/ql/test/library-tests/modules/superclasses.expected: Language not supported
- ruby/ql/test/library-tests/modules/superclasses.ql: Language not supported
adityasharad
approved these changes
Apr 17, 2025
Collaborator
adityasharad
left a comment
There was a problem hiding this comment.
I defer to others on how to organise the code, but changes look reasonable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Graphs use the internal id if
semmle.orderis not good enough. However the internal id of anewtypedepends on evaluation order (and in this case whetherTResolvedorTUnresolvedis evaluated first). It seems the current evaluator is very consistent but RTJO changes it. In theory though the current evaluator could get the wrong result as multiple threads can change scheduling order.I am looking into making the graph code use the label as an intermediate order. However we end up still needing us to make this test deterministic as the change would break this test.
This just adds the
toStringas an order when the location is not defined, I have put these first in the order as that matches the existing results better (ifsemmle.orderis not defined then it is treated 0).I have duplicated this code as it is already duplicated but I am happy to put this in a
qllinstead as this code has grown in size.