Skip to content

Ruby: Make module graph queries avoid relying on evalaution order. #19116

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexet
Copy link
Contributor

@alexet alexet commented Mar 25, 2025

Graphs use the internal id if semmle.order is not good enough. However the internal id of a newtype depends on evaluation order (and in this case whether TResolved or TUnresolved is 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 toString as an order when the location is not defined, I have put these first in the order as that matches the existing results better (if semmle.order is 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 qll instead as this code has grown in size.

@github-actions github-actions bot added the Ruby label Mar 25, 2025
@alexet alexet force-pushed the alexet/ruby-deterministic branch from 97def4d to 0ccbe3e Compare April 1, 2025 15:18
@alexet alexet marked this pull request as ready for review April 14, 2025 11:31
@Copilot Copilot bot review requested due to automatic review settings April 14, 2025 11:31
@alexet alexet requested a review from a team as a code owner April 14, 2025 11:31
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant