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

Make --modify_execution_info additive #16262

Closed

Conversation

sitaktif
Copy link
Contributor

Calling --modify_execution_info multiple times used to result in the last version being used. With this change, options are amended additively.

Fixes #13342

@sgowroji sgowroji added team-Local-Exec Issues and PRs for the Execution (Local) team awaiting-review PR is awaiting review from an assigned reviewer labels Sep 13, 2022
@sitaktif
Copy link
Contributor Author

I was told @meisterT might be happy to take a look maybe?

@meisterT
Copy link
Member

I wonder whether this has the potential to break people?

@meisterT meisterT requested a review from coeuvre September 26, 2022 07:17
@sitaktif
Copy link
Contributor Author

In practice, I'm not sure how likely it is to break people but technically, it is a breaking change.

Do we think it's worth putting that behind an --incompatible flag (making it enabled by default on bazel 6+)?

It would be great to have feedback from users to understand if this change would be incompatible for their use case 🙂

@meisterT
Copy link
Member

It may be wise to reach out to https://groups.google.com/g/bazel-discuss (and/or bazel-dev) to find out

@brentleyjones
Copy link
Contributor

This would break a couple usages I know of, but not in a way that can't be recovered from with using the negation ability to remove stuff previously added.

@sitaktif
Copy link
Contributor Author

I started a thread in bazel-discuss to gather more feedback 👍

@coeuvre
Copy link
Member

coeuvre commented Sep 28, 2022

Just want to point it out, this flag is used internally across many projects. Just making this additive will likely break them. Adding an incompatible flag requires having a plan to migrate existing usages. I don't think we have the capacity to do that now.

@sitaktif
Copy link
Contributor Author

sitaktif commented Sep 30, 2022

@coeuvre thanks for sharing.

Could we not settle with a simple migration plan such as "activate it for the next major Bazel version"?

@sitaktif
Copy link
Contributor Author

The approach above could be taken with either:

  • an --incompatible_additive_modify_execution_info_flag flag (switching the default from false to true in Bazel 6)
  • no additional flag, keep old behavior until bazel 6.

The latter is simpler, but makes Bazel 6 migration harder, so I personally lean towards the former.

Are there additional complexities I may not be aware of?

@sitaktif sitaktif force-pushed the additive-mofify-execution-info branch from 7ef66ea to 27395e2 Compare December 16, 2022 16:00
@sitaktif
Copy link
Contributor Author

sitaktif commented Dec 16, 2022

Updated the PR to add an --incompatible_modify_execution_info_additive_flag option, preserving the current behavior by default.


Adding an incompatible flag requires having a plan to migrate existing usages. I don't think we have the capacity to do that now.

@coeuvre to be honest, it doesn't feel like this should be a valid argument when discussing features for an open-source project. Providing a feature flag for the feature make it convenient for projects to keep the existing behavior. The existence of a process to eventually migrate out of it feels like a... second order constraint? Hard to put my finger on it exactly :-)

That said, assuming there is a limited number of values used by the repo, there's a straightforward way to migrate existing usages in a way that doesn't change between non-additive (ie. current) and additive behavior: you can change any --modify-execution-info flags from:

build --modify_execution_info=Foo=+value-one,Bar=+value-two

to:

build --modify_execution_info=.*=-value-one,.*=-value-two,.*=-value-three,Foo=+value-one,Bar=+value-two

or (maybe more legible):

build --modify_execution_info=.*=-value-one,.*=-value-two,.*=-value-three
build --modify_execution_info=Foo=+value-one,Bar=+value-two

This example assumes that only three values are used across the repo. It can work for any number of values, though there is a point at which it might feel overwhelming.

@meisterT
Copy link
Member

meisterT commented Mar 9, 2023

cc @susinmotion

@meteorcloudy meteorcloudy requested a review from a team as a code owner November 13, 2023 10:19
@meteorcloudy meteorcloudy requested review from aranguyen and removed request for a team November 13, 2023 10:19
@brentleyjones
Copy link
Contributor

@bazelbuild/triage this stalled out. Can we get it looked at?

@sitaktif
Copy link
Contributor Author

sitaktif commented Mar 7, 2024

I’d be happy to rebase this change or discuss alternative if people want to move forward with it. I still think it would be a natural improvement for Bazel.

By the way, I realise the tone in my last comment wasn't the most appropriate, sorry about that 🙏

@coeuvre
Copy link
Member

coeuvre commented Mar 19, 2024

I am fine moving forward with current approach, i.e. add an incompatible flag and only make --modify_execution_info additive when the flag is set. I had some ideas for the migration but let's postpose it until we are about to flip the incompatible flag.

Please rebase the PR and I will take a proper review, thanks!

@wilwell
Copy link

wilwell commented Apr 30, 2024

Hi @sitaktif !

Could you please rebase the change for a proper view to finalize the review process?

Calling --modify_execution_info multiple times used to result in the
last version being used. With this change, options are amended
additively.

Fixes bazelbuild#13342
@sitaktif sitaktif force-pushed the additive-mofify-execution-info branch from 27395e2 to 185c4aa Compare May 7, 2024 10:00
@sitaktif
Copy link
Contributor Author

sitaktif commented May 7, 2024

@coeuvre @wilwell thanks, I just submitted the rebased patch.

(The typo in my branch name irritates me every time but it's not worth opening a new PR just for that reason...)


}

return create("", allExpressionsBuilder.build());
Copy link
Member

Choose a reason for hiding this comment

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

We want to pass the original input from the command line to the first argument because it is used for equality check. Maybe join eim.option() with ,? Please also assert the value of option() for the merged modifier in the test cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks - updated 👍

Copy link
Member

@coeuvre coeuvre 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 have imported the PR and made some changes on top of it:

  1. Renamed the incompatible flag to --incompatible_modify_execution_info_additive.
  2. Instead of merging the modifiers, it now iterates though the list to avoid creating transient collection object. It matters because the code is called for reach action.

You can check the updated code here: https://bazel-review.git.corp.google.com/c/bazel/+/249650.

@coeuvre
Copy link
Member

coeuvre commented May 8, 2024

@bazel-io fork 7.2.0

@copybara-service copybara-service bot closed this in 7350f2d May 8, 2024
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label May 8, 2024
@sitaktif
Copy link
Contributor Author

sitaktif commented May 9, 2024

Thanks for taking the time to review/improve this @coeuvre! 🙏

coeuvre pushed a commit to coeuvre/bazel that referenced this pull request May 10, 2024
Calling --modify_execution_info multiple times used to result in the last version being used. With this change, options are amended additively if --incompatible_modify_execution_info_additive is set.

Fixes bazelbuild#13342

Closes bazelbuild#16262.

PiperOrigin-RevId: 631803759
Change-Id: I5386cbb0d02ef19a6b2ddf2f818cbab660b17c31
coeuvre pushed a commit to coeuvre/bazel that referenced this pull request May 10, 2024
Calling --modify_execution_info multiple times used to result in the last version being used. With this change, options are amended additively if --incompatible_modify_execution_info_additive is set.

Fixes bazelbuild#13342

Closes bazelbuild#16262.

PiperOrigin-RevId: 631803759
Change-Id: I5386cbb0d02ef19a6b2ddf2f818cbab660b17c31
github-merge-queue bot pushed a commit that referenced this pull request May 10, 2024
Calling --modify_execution_info multiple times used to result in the
last version being used. With this change, options are amended
additively if --incompatible_modify_execution_info_additive is set.

Fixes #13342

Closes #16262.

PiperOrigin-RevId: 631803759
Change-Id: I5386cbb0d02ef19a6b2ddf2f818cbab660b17c31

Closes #22288.

Co-authored-by: Romain Chossart <rchossart@apple.com>
Kila2 pushed a commit to Kila2/bazel that referenced this pull request May 13, 2024
Calling --modify_execution_info multiple times used to result in the last version being used. With this change, options are amended additively if --incompatible_modify_execution_info_additive is set.

Fixes bazelbuild#13342

Closes bazelbuild#16262.

PiperOrigin-RevId: 631803759
Change-Id: I5386cbb0d02ef19a6b2ddf2f818cbab660b17c31
@sitaktif sitaktif deleted the additive-mofify-execution-info branch September 12, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Local-Exec Issues and PRs for the Execution (Local) team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--modify_execution_info should be additive
6 participants