-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[Feature branch] JS: Migrate to shared dataflow library #14412
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
[Feature branch] JS: Migrate to shared dataflow library #14412
Conversation
9e3285e
to
e4bc193
Compare
e4bc193
to
e29aa29
Compare
1457ea5
to
a0202fd
Compare
0e5e149
to
70d675b
Compare
In preparation for migrating to the FlowSummary module in the qlpack, rename predicates to be consistent with the qlpack.
This is identical to the code in Ruby and seems to prevent a bad join ordering in a cached version of this predicate in DataFlowCommon
Only includes the changes that purely contain the new provenance columns
New library gets FN for spread arguments in a call to splice(), which was added to the old version in this PR: github#16739
233b791
to
af7b4e3
Compare
These initially got messed up by a merge conflict where I couldn't rerun the tests due to breaking changes in the data flow library. I wanted the breaking-change updates to live in their own commits, not just eaten by a merge resolution commit, so the test output became broken for a while. The '#select' result set is unchanged in all of these, so they should be safe to accept.
@erik-krogh after keeping up the CI changes and breaking changes in the data flow library, this PR is finally green again (apart from the QLDoc check which complains about shared libraries). I'd like to merge it to the feature branch as it is now, so we can start working with smaller PRs. The first unreviewed commit so far is 102ca77. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ready for a feature branch 👍
int totalorder() { | ||
result = TotalOrdering::astNodeId(this.asSourceCallable()).bitShiftLeft(1) | ||
or | ||
result = TotalOrdering::libraryCallableId(this.asLibraryCallable()).bitShiftLeft(1) + 1 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the left-shift?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the IDs for AST nodes and library callables can't clash, because the low bit is zero for AST nodes and 1 for library callables.
@@ -1,11 +1,11 @@ | |||
legacyDataFlowDifference | |||
| arrays.js:2:16:2:23 | "source" | arrays.js:39:8:39:24 | arr4_spread.pop() | only flow with OLD data flow library | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you planning to add this step to the new library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm planning to fix this missing flow by adding general handling of the spread operator, so individual models don't have to specify how to handle spread operators. For example if a model specifies Argument[1]
somewhere, and it applies to call that has a spread argument at position 0 or 1, then it should Just Work. The model shouldn't have to specify something like Argument[spread]
which is what the legacy model currently does.
5c222f7
into
github:js/shared-dataflow-branch
Merging to the feature branch (not main) |
Targeting a feature branch
This PR is targeting a branch named
js/shared-dataflow-branch
, notmain
as we normally would.main
will happen at a later point, and will require thatjs/shared-dataflow-branch
should be that the code has been reviewed, and is considered good enough to go intomain
once the above criteria are met.main
. We don't want to have to go back a re-review the code for readability later.Review order
Commits have been organised into a reading order. The large number of commits is there to make it easier to the review.
Note that not every commit can compile in isolation. I split some commits into smaller chunks for easy of readability, but you may sometimes see odd artifacts like see a trailing
and
/or
, an empty predicate body, or the occasional mention of a class that doesn't exist yet.Otherwise the overarching order of commits are:
ConfigSig
-style and updating testsConfigSig
style, generic test output changesSteps across function boundaries
The most difficult change for JS is that steps across function boundaries are no longer permitted, except for jump steps which can result in FPs and performance issues.
This means the following type of steps need to be rewritten:
getALocalSource()
, because that can cross function boundaries.loadStoreStep
feature, which is no longer supported.The current status of this migration is:
Array
,Map
,Set
,Promise
, and generators.loadStoreStep
.String#replace
has been converted, as it is the only string-related step that needed to be ported.Related reading:
Awaited
token: https://github.com/github/codeql-javascript-team/issues/423Evaluation
The latest evaluation can be found here. As mentioned there are too many performance regressions at the moment, and alerts need to be triaged.