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

Fix defaulting of parameters in explicitly specified deps on parametrized targets for AsyncFieldMixin #16176

Merged

Conversation

stuhood
Copy link
Sponsor Member

@stuhood stuhood commented Jul 14, 2022

Although the tests for #14519 were reasonably good, they tested with StringField, rather than additionally with AsyncFieldMixin. The latter changes the definition of equality for the Field to include its address, meaning that comparing the Field instance itself will never match for Fields from different targets. That made #14519... not particularly useful in production.

This change fixes Field value comparisons to use field.value, references the newly opened #16175 (which is out of scope for now, given that it will likely be impacted by __defaults__ and would be much harder to cherry-pick), and adds an additional test.

Fixes #14519.

[ci skip-rust]
[ci skip-build-wheels]

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
[ci skip-rust]

[ci skip-build-wheels]
@stuhood stuhood added needs-cherrypick category:bugfix Bug fixes for released features labels Jul 14, 2022
@stuhood stuhood added this to the 2.11.x milestone Jul 14, 2022
unspecified_param_field_names = {
key for key in candidate.address.parameters.keys() if key not in address.parameters
}

return all(
consumer.has_field(field_type) and consumer[field_type] == field_value
for field_type, field_value in candidate.field_values.items()
consumer.has_field(field_type) and consumer[field_type].value == field.value
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

This is the actual fix, and the addition of AsyncFieldMixin to the mock ResolveField in the test is the validation.

@stuhood stuhood enabled auto-merge (squash) July 14, 2022 03:43
@stuhood stuhood requested review from tdyas and removed request for kaos July 14, 2022 03:44
@stuhood stuhood merged commit 32111b2 into pantsbuild:main Jul 14, 2022
@benjyw
Copy link
Sponsor Contributor

benjyw commented Jul 14, 2022

Thanks for the quick fix!

@stuhood stuhood deleted the stuhood/parametrization-in-explicit-deps-fix branch July 14, 2022 05:52
stuhood added a commit to stuhood/pants that referenced this pull request Jul 14, 2022
…rize`d targets for AsyncFieldMixin (pantsbuild#16176)

Although the tests for pantsbuild#14519 were reasonably good, they tested with `StringField`, rather than additionally with `AsyncFieldMixin`. The latter changes the definition of equality for the `Field` to include its address, meaning that comparing the `Field` instance itself will never match for `Field`s from different targets. That made pantsbuild#14519... not particularly useful in production.

This change fixes `Field` value comparisons to use `field.value`, references the newly opened pantsbuild#16175 (which is out of scope for now, given that it will likely be impacted by `__defaults__` and would be much harder to cherry-pick), and adds an additional test.

Fixes pantsbuild#14519.

[ci skip-rust]
[ci skip-build-wheels]
stuhood added a commit to stuhood/pants that referenced this pull request Jul 14, 2022
…rize`d targets for AsyncFieldMixin (pantsbuild#16176)

Although the tests for pantsbuild#14519 were reasonably good, they tested with `StringField`, rather than additionally with `AsyncFieldMixin`. The latter changes the definition of equality for the `Field` to include its address, meaning that comparing the `Field` instance itself will never match for `Field`s from different targets. That made pantsbuild#14519... not particularly useful in production.

This change fixes `Field` value comparisons to use `field.value`, references the newly opened pantsbuild#16175 (which is out of scope for now, given that it will likely be impacted by `__defaults__` and would be much harder to cherry-pick), and adds an additional test.

Fixes pantsbuild#14519.

[ci skip-rust]
[ci skip-build-wheels]
stuhood added a commit that referenced this pull request Jul 14, 2022
…rize`d targets for AsyncFieldMixin (Cherry-pick of #16176) (#16180)

Although the tests for #14519 were reasonably good, they tested with `StringField`, rather than additionally with `AsyncFieldMixin`. The latter changes the definition of equality for the `Field` to include its address, meaning that comparing the `Field` instance itself will never match for `Field`s from different targets. That made #14519... not particularly useful in production.

This change fixes `Field` value comparisons to use `field.value`, references the newly opened #16175 (which is out of scope for now, given that it will likely be impacted by `__defaults__` and would be much harder to cherry-pick), and adds an additional test.

Fixes #14519.

[ci skip-rust]
[ci skip-build-wheels]
stuhood added a commit that referenced this pull request Jul 14, 2022
…rize`d targets for AsyncFieldMixin (Cherry-pick of #16176) (#16179)

Although the tests for #14519 were reasonably good, they tested with `StringField`, rather than additionally with `AsyncFieldMixin`. The latter changes the definition of equality for the `Field` to include its address, meaning that comparing the `Field` instance itself will never match for `Field`s from different targets. That made #14519... not particularly useful in production.

This change fixes `Field` value comparisons to use `field.value`, references the newly opened #16175 (which is out of scope for now, given that it will likely be impacted by `__defaults__` and would be much harder to cherry-pick), and adds an additional test.

Fixes #14519.

[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:bugfix Bug fixes for released features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Target parametrization should default the values of parameters during address expansion
3 participants