-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: implement static analysis for workflows. #199
Merged
peterhuene
merged 11 commits into
stjude-rust-labs:main
from
peterhuene:workflow-type-checking
Oct 1, 2024
Merged
feat: implement static analysis for workflows. #199
peterhuene
merged 11 commits into
stjude-rust-labs:main
from
peterhuene:workflow-type-checking
Oct 1, 2024
Conversation
This file contains 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
This commit refactors out the task evaluation graph into its own public type.
This commit merges the type checking for tasks in with the creation of the task within the document scope. To do this, two passes are done over the AST's top level items: first imports and struct definitions then tasks and workflow. This allows the population of a task or a workflow in the document scope to calculate type declarations up front and do the type checking when processing the declaration, as declarations are added to the scope in topological order now.
This commit implements full static analysis for workflows, including type checking. To perform analysis on workflows, a `WorkflowEvaluationGraph` was implemented that will return a topologically-sorted set of nodes for evaluating the contents of a workflow in the correct order. This also includes several fixes required to remove incorrect diagnostics from checking the `workflows` repository: * Treat a coercion to `T?` for a function argument of type `T` as a preference over any other coercion. * Fix the signature of `select_any` such that it is monomorphic. * Only consider signatures in overload resolution that have sufficient arguments. * Allow coercion from `File` and `Directory` to `String`. * Allow non-empty array literals to coerce to either empty or non-empty. * Fix element type calculations for `Array` and `Map` so that `[a, b]` successfully calculates when `a` is coercible to `b`. * Fix `if` expression type calculation such that `if (x) then a else b` works when `a` is coercible to `b`. * Ensure that only equality/inequality expressions are supported on `File` and `Directory` now that there is a coercion to `String`. * Allow index expressions on `Map`. Included with these changes is a refactoring to place all of analysis diagnostics in `diagnostics.rs`. Fixes stjude-rust-labs#197. Fixes stjude-rust-labs#196. Fixes stjude-rust-labs#167. Fixes stjude-rust-labs/sprocket#21.
peterhuene
changed the title
feat: implement static analysis for workflows. Beta
feat: implement static analysis for workflows.
Sep 27, 2024
Add the fixes to the `wdl-analysis` CHANGELOG and correct the link to the PR.
This commits adds detection of duplicate call inputs to AST validation. Additionally, it adds a diagnostic for missing required inputs in a call statement.
peterhuene
force-pushed
the
workflow-type-checking
branch
from
September 28, 2024 04:39
549375c
to
a972279
Compare
This commit respects `allow_nested_inputs`: * With `allow_nested_inputs` or `allowNestedInputs` in a workflow `hints` section in 1.2. * With `allowNestedInputs` in a workflow `meta` section in 1.1 and 1.2. * By default in 1.0. When set, the check for required inputs will be suppressed.
peterhuene
force-pushed
the
workflow-type-checking
branch
from
September 28, 2024 07:04
a972279
to
a6e846e
Compare
a-frantz
reviewed
Sep 30, 2024
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 pretty awesome Peter! 🚀
Co-authored-by: Andrew Frantz <andrew.frantz@stjude.org>
a-frantz
approved these changes
Oct 1, 2024
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 implements full static analysis for workflows, including type
checking.
To perform analysis on workflows, a
WorkflowGraph
was implementedthat will return a topologically-sorted set of nodes for evaluating the
contents of a workflow in the correct order.
This also includes several fixes required to remove incorrect diagnostics from
checking the
workflows
repository:T?
for a function argument of typeT
as a preferenceover any other coercion.
select_first
such that it is monomorphic.arguments.
File
andDirectory
toString
.Array
andMap
so that[a, b]
and{ "a": a, "b": b }
successfully calculates when
a
is coercible tob
(the reverse already works).if
expression type calculation such thatif (x) then a else b
workswhen
a
is coercible tob
(the reverse already works).File
andDirectory
now that there is a coercion toString
.Map
.Included with these changes is a refactoring to place all of analysis
diagnostics in
diagnostics.rs
.Fixes #197.
Fixes #196.
Fixes #167.
Fixes stjude-rust-labs/sprocket#21.
Before submitting this PR, please make sure:
changes (when appropriate).
CHANGELOG.md
(see"keep a changelog" for more information).