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

Do not validate input-only settings in transitions #14972

Closed
wants to merge 1 commit into from

Conversation

fmeum
Copy link
Collaborator

@fmeum fmeum commented Mar 6, 2022

Starlark transition logic temporarily explicitly sets all input build
settings of a transition to their defaults. Since #13971, these values
are cleared after the transition. However, since then they have also
been subject to type validation, which is not only unnecessary, but
also breaks in the special case of a string build setting with
allow_multiple.

With this commit, input-only build settings are unconditionally
stripped from the post-transition BuildOptions and do not undergo
validation. This is made possible by a refactoring of
StarlarkTransition#validate that extracts the validation logic into a
separate function and also improves some variable names.

Fixes #14894

@fmeum fmeum marked this pull request as ready for review March 6, 2022 08:39
@gregestren gregestren self-assigned this Mar 7, 2022
@gregestren gregestren added the team-Configurability platforms, toolchains, cquery, select(), config transitions label Mar 7, 2022
Copy link
Contributor

@gregestren gregestren left a comment

Choose a reason for hiding this comment

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

Lots of nitpicky and sanity checking comments on my side, but overall I love the direction of this!

Starlark transition logic temporarily explicitly sets all input build
settings of a transition to their defaults. Since bazelbuild#13971, these values
are cleared after the transition. However, since then they have also
been subject to type validation, which is not only unnecessary, but
also breaks in the special case of a string build setting with
allow_multiple.

With this commit, input-only build settings at their literal default
values are removed from the post-transition BuildOptions without going
through validation. This is made possible by a refactoring of
`StarlarkTransition#validate` that extracts the validation logic into a
separate function and also improves some variable names.
Copy link
Contributor

@gregestren gregestren left a comment

Choose a reason for hiding this comment

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

Looks solid!

@bazel-io bazel-io closed this in f789c0d Mar 14, 2022
fmeum added a commit to fmeum/bazel that referenced this pull request Mar 15, 2022
Starlark transition logic temporarily explicitly sets all input build
settings of a transition to their defaults. Since bazelbuild#13971, these values
are cleared after the transition. However, since then they have also
been subject to type validation, which is not only unnecessary, but
also breaks in the special case of a string build setting with
allow_multiple.

With this commit, input-only build settings are unconditionally
stripped from the post-transition BuildOptions and do not undergo
validation. This is made possible by a refactoring of
`StarlarkTransition#validate` that extracts the validation logic into a
separate function and also improves some variable names.

Fixes bazelbuild#14894

Closes bazelbuild#14972.

PiperOrigin-RevId: 434589143
@fmeum fmeum deleted the 14894-refactor-validate branch March 15, 2022 12:29
Wyverald pushed a commit that referenced this pull request Mar 15, 2022
Starlark transition logic temporarily explicitly sets all input build
settings of a transition to their defaults. Since #13971, these values
are cleared after the transition. However, since then they have also
been subject to type validation, which is not only unnecessary, but
also breaks in the special case of a string build setting with
allow_multiple.

With this commit, input-only build settings are unconditionally
stripped from the post-transition BuildOptions and do not undergo
validation. This is made possible by a refactoring of
`StarlarkTransition#validate` that extracts the validation logic into a
separate function and also improves some variable names.

Fixes #14894

Closes #14972.

PiperOrigin-RevId: 434589143
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Configurability platforms, toolchains, cquery, select(), config transitions
Projects
None yet
2 participants