Skip to content
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

Mask the environment name in graph and specs_rules #17179

Merged

Conversation

stuhood
Copy link
Member

@stuhood stuhood commented Oct 10, 2022

As a first step toward #17129, this change "masks" the EnvironmentName for relevant APIs in graph.py and specs_rules.py, and pins them to the __local__ environment.

The @rule(.., _mask_types=[..]) argument triggers an assertion if the given type(s) are used in the identity of the @rule (i.e.: if the @rule "consumes" them from its scope). The impact of masking a type at an API boundary is an assertion that that type is not consumed by that API.

As described in #17129: we're pinning graph computations to the __local__ environment for now, although we may eventually allow graph computations to execute in a configurable environment.

[ci skip-build-wheels]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
… a `@rule`'s identity.

[ci skip-rust]
[ci skip-build-wheels]
# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
[ci skip-rust]
[ci skip-build-wheels]
[ci skip-build-wheels]
[ci skip-rust]
…ly adding an `EnvironmentName` to all product requests and test `QueryRule`s.

[ci skip-rust]
[ci skip-build-wheels]
@stuhood stuhood added the category:internal CI, fixes for not-yet-released features, etc. label Oct 10, 2022
@stuhood stuhood marked this pull request as ready for review October 10, 2022 20:00
@stuhood
Copy link
Member Author

stuhood commented Oct 10, 2022

Commits are useful to review independently!

Copy link
Contributor

@chrisjrn chrisjrn left a comment

Choose a reason for hiding this comment

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

At first glance, this doesn't look like anything is missing. 👍

Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Thanks. I think that you want to apply this to more places, like build_files.py. A lot of engine/ should be using this, and probably some of core/ too

Comment on lines +89 to +90
#[test]
fn masked_params() {
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be good to test when masking works

@@ -304,6 +304,31 @@ fn in_scope_computed() {
graph.find_root_edges(vec![], "a").unwrap();
}

#[test]
fn in_scope_provided() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be cherry-picked?

Copy link
Member Author

Choose a reason for hiding this comment

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

in_scope_types is only on main so far.

@stuhood
Copy link
Member Author

stuhood commented Oct 10, 2022

Thanks. I think that you want to apply this to more places, like build_files.py. A lot of engine/ should be using this, and probably some of core/ too

Some of it, yea. We'll almost certainly expose other things that we want masked as part of #17155.

@stuhood stuhood enabled auto-merge (squash) October 10, 2022 22:15
@stuhood stuhood merged commit 371dd51 into pantsbuild:main Oct 11, 2022
@stuhood stuhood deleted the stuhood/mask-the-environment-name-in-graph branch October 11, 2022 01:40
stuhood added a commit that referenced this pull request Oct 11, 2022
As described in #17129: we would like `@goal_rule`s to eventually make their own decisions about which environments to use, generally by consuming targets to do so, but possibly also by pinning themselves to other environments via configuration.

This change builds on #17179, and introduces a migration from `Goal.environment_migrated = {False => True}`. All graph-introspection goals consume only the APIs which are pinned to the local environment by #17179, and so are trivially migrated here. Other goals trigger a deprecation warning like the following:
```
DEPRECATED: Not setting `Goal.environment_migrated=True` for `Goal` `generate-lockfiles` is scheduled to be removed in version 2.17.0.dev0.

See https://www.pantsbuild.org/v2.15/docs/plugin-upgrade-guide
```

Before calling #17129 done, we will migrate all internal goals to `Goal.environment_migrated=True`.

[ci skip-rust]
[ci skip-build-wheels]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants