-
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
add rpc interface for dependency resolution #288
Conversation
55ba075
to
e07e4c0
Compare
Backwards compatibility summary:
|
@@ -1797,12 +1799,44 @@ type output_format = [ | |||
| Emacs | |||
] | |||
|
|||
type manifest = { |
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.
Did you look at the types in OSS/interfaces/Input_to_core.atd?
They look very similar.
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.
There was also the prelimiary work by @mmcqd in OSS/target/Lockfile_xxx.ml
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.
We probably want to factorize some of those types at some points.
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 updated this type so that it is now essentially identical to both manifest_target
in that file and to manifest
in Target.ml
. The type is still duplicated here because I wasn't aware of a better way to structure it, though. But hopefully this interface type will only be around for a few months until we get SSC into ocaml entirely
Anyway, curious to hear what you think of this new type and if it resolves your prior concerns
semgrep_output_v1.atd
Outdated
?git_ref: string option | ||
?git_ref: string option; | ||
(* ID is used to associate dependencies with each other via depends_on relationships *) | ||
?id: string option; |
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.
Is there any way we can use a more precise type for those id? Like we did for rule_id in this file so that we have stronger typechecking and don't messup a rule ID with another kind of ID.
This is the identifier for what here?
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've updated the types to no longer use these IDs. Instead, the new version uses the existing but unised children
field (of type dependency_child list
) to encode relationships between dependencies. Ultimately the ID system felt like it required too much out-of-band knowledge about the other FoundDependency
items, but I was going back and forth between these options for a while so would be curious to hear your thoughts on this new approach.
semgrep_output_v1.atd
Outdated
|
||
type dependency_relationships | ||
<python decorator="dataclass(frozen=True)"> = { | ||
dep_id: string; |
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.
maybe define a dep_id = string wrap (like for rule_id) and explain clearly what is a dependency ID, maybe with an example.
62a4c11
to
524a6ac
Compare
90bd998
to
55095c4
Compare
semgrep_output_v1.atd
Outdated
@@ -1817,6 +1862,7 @@ type function_call | |||
the RPC pipe. | |||
*) | |||
| CallValidate of fpath | |||
| CallResolveDependencies of resolve_dependencies_params |
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 introduce an intermediate type with a record with just one field?
Why not simpler | CallResolveDependencies of manifest list ?
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.
updated!
semgrep_output_v1.atd
Outdated
@@ -1827,4 +1873,5 @@ type function_return | |||
| RetContributions of contributions | |||
| RetFormatter of string | |||
| RetValidate of bool | |||
| RetResolveDependencies of resolve_dependencies_return |
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.
Same, I don't think you need the extra intermediate record with just one field ...
Adds the RPC types that will be necessary to perform dependency resolution in OCaml. These changes comprise new types to represent a resolution request, response, and resolved relationships, and an additional optional
id
field onfound_dependency
that is used to associate a dependency with its dependency relationships.make setup && make
to update the generated code after editing a.atd
file (TODO: have a CI check)Closes SC-1732.