Ruby: Diff-informed queries: phase 3 (non-trivial locations)#20080
Merged
cklin merged 1 commit intogithub:mainfrom Aug 7, 2025
Merged
Ruby: Diff-informed queries: phase 3 (non-trivial locations)#20080cklin merged 1 commit intogithub:mainfrom
cklin merged 1 commit intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for diff-informed queries in Ruby by implementing location overrides for queries that select non-trivial locations (not just dataflow sources or sinks). It's part of phase 3 of enabling diff-informed mode across all languages, completing the mass-enablement process.
Key changes:
- Adds
observeDiffInformedIncrementalMode()predicate to disable diff-informed mode for specific queries where it's not suitable - Implements workaround for Ruby RegExp parsing issues when constants are folded
| predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer } | ||
|
|
||
| predicate observeDiffInformedIncrementalMode() { | ||
| none() // can't be made diff-informed because the locations of Ruby RegExpTerms aren't correct when the regexp is parsed from a string arising from constant folding |
There was a problem hiding this comment.
The comment should be more specific about what 'aren't correct' means. Consider clarifying whether the locations are missing, inaccurate, or point to the wrong source positions.
Suggested change
| none() // can't be made diff-informed because the locations of Ruby RegExpTerms aren't correct when the regexp is parsed from a string arising from constant folding | |
| none() // can't be made diff-informed because the locations of Ruby RegExpTerms are inaccurate or point to incorrect source positions when the regexp is parsed from a string arising from constant folding |
hvitved
approved these changes
Aug 7, 2025
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.
This PR enables diff-informed mode on queries that select a location other than dataflow source or sink. This entails adding a non-trivial location override that returns the locations that are actually selected.
Prior work includes PRs like #19663, #19759, and #19817. This PR uses the same patch script as those PRs to find candidate queries to convert to diff-enabled. This is the final step in mass-enabling diff-informed queries on all the languages.
Commit-by-commit reviewing is recommended.