Conversation
src/Shared/Traits.cs
Outdated
There was a problem hiding this comment.
Who sets this and what do they expect should happen? I guess some user facing documentation would be nice at some point :)
src/Shared/ChangeWaves.cs
Outdated
There was a problem hiding this comment.
All this version parsing might get noticeable, especially if the under-the-wave features are on hotter paths. Consider storing the version constants directly as Version instead of strings.
src/Shared/ChangeWaves.cs
Outdated
There was a problem hiding this comment.
Warning as in logger BuildWarningEventArgs? Throw a custom exception type, catch it in the nearest places that can log events, and convert it to a warning event there.
There was a problem hiding this comment.
I was hoping to avoid this, but it looks like that won't be possible. What was suggested in the PR review meeting was to return some enum ChangeWavesReturnType.InvalidFormat, then at each feature site we check what the return value was and log a warning based on that.
There was a problem hiding this comment.
That wouldn't work for features implemented in places which don't have access to a LoggingService.
An alternative to bubbling up a special exception would be to push down the LoggingService everywhere (potentially guised as a more generic logging interface, maybe). Then you can change the method to public static bool IsChangeWaveEnabled(string wave, IWhateverLoggingInteface log)
There was a problem hiding this comment.
I got around this by throwing warnings in Evaluator.cs, as I'm now setting MSBUILDCHANGEWAVEVERSION as a default property. The version gets sanitized there and a warning is thrown for out-of-rotation waves and invalid formats.
|
What if a wave has multiple breaking changes and the user wants to turn a subset of them off, not the entire wave? Should developers check both the wave and a Trait.EscapeHatch? Or should we instead compose a wave out of multiple Trait.EscapeHatches? |
|
I believe this would happen on a case by case basis. Which falls in line with the intention of change waves. Ideally we get feedback from customers that state they want to have a particular feature enabled while disabling all others. Feature code would then look something like: if(ChangeWaves.IsChangeWaveEnabled(ChangeWaves.Wave16_8) || Traits.Instance.SomeFeatureEscapeHatch)
{
<feature>
}The discussion around having subsets of change-waves indicated that we don't want to do this for every feature, as it would become very cumbersome over time. |
But if you need customer feedback on which feature to disable, you need to do another release to add the escape hatch for it and the customer would have to wait for that release instead of being able to immediately opt out from a particular feature. Alternative you can hide the change waive inside Traits to make the conditions easier to write. Have a lookup table in Traits that maps each escape hatch to a change wave number. Feature writers would then just need to check for |
|
/azp run |
|
Pull request contains merge conflicts. |
686398b to
60e2328
Compare
Discussion for our PR meeting: I find that this wouldn't add much value over just adding escape hatches for features we feel would need them. I may be misunderstanding though. |
There was a problem hiding this comment.
| Sometimes we want to make a breaking change _and_ give customers a heads up as to what's breaking. So we develop the change and provide an opt-out while acknowledging that this feature will become a standard functionality down the line. | |
| Sometimes we want to make a breaking change _and_ give customers a heads up as to what's breaking. So we develop the change and provide an opt-out while acknowledging that this feature will become standard functionality down the line. |
documentation/wiki/ChangeWaves.md
Outdated
There was a problem hiding this comment.
Should this doc also say "don't use change waves if you're not part of the core MSBuild/SDK/Microsoft set of stuff?"
There was a problem hiding this comment.
I'll add a note at the top in the dev docs.
There was a problem hiding this comment.
Why is this public? Isn't this an internal implementation detail?
There was a problem hiding this comment.
I switched it over to internal, and now I think it needs to be back at public. The latest addition to TestEnvironment (Making a SetChangeWave function) means that it needs to set ChangeWaves.DisabledWave to null, which it can't do if the class is anything less than public.
There was a problem hiding this comment.
What if you did that in ResetInstance_ForUnitTestsOnly instead? I would expect that method to reset DisabledWave anyway, and they're both in Microsoft.Build.Framework.UnitTests.csproj. It would also clean up the tests somewhat.
src/Shared/ChangeWaves.cs
Outdated
There was a problem hiding this comment.
Do we need this if it's the default?
There was a problem hiding this comment.
It's just a nice-to-have for easy comparison in my out-of-rotation-check function
|
Interesting failure. It's looking like the property is being set incorrectly? This doesn't fail locally. |
Try adding |
|
@Forgind I did, and didn't notice any differences in the tests locally (examing the |
You said it didn't fail locally, and when running the tests locally, they each had their own test environment. Running them all together in CI requires the test environment to be reset. |
Maybe I should bring this into another PR?
|
Any chance you could get it to only print once? Evaluate runs even when not doing a full build, so this could turn into a lot of messages. |
|
Ideally yes. Some ideas:
Though both of these solutions only work for the first build. Beyond that it wouldn't throw a warning on the same node.
I could theoretically call |
|
Documenting that I got sign off on the environment variable |
| case ChangeWaveConversionState.OutOfRotation: | ||
| log.LogWarning(BuildEventContext.Invalid, "", new BuildEventFileInfo(""), "ChangeWave_OutOfRotation", ChangeWaves.AllWaves[0], Traits.Instance.MSBuildDisableFeaturesFromVersion); | ||
| break; | ||
| case ChangeWaveConversionState.InvalidVersion: |
There was a problem hiding this comment.
Did we agree to a warning here? It feels far too strong to me, since people might do this intentionally
There was a problem hiding this comment.
I realize now that we did lean toward not having a warning here. Thanks for the catch
|
Would you mind making a checklist of what you've done and what you still have to do? |
|
Current status:
Command line experience is fine, minus the build logs not containing the warning. It seems like I just need to find the correct way to log warnings in within the BuildManager |
| TransientTestFile file = env.CreateFile("proj.csproj", projectFile); | ||
|
|
||
| ProjectCollection collection = new ProjectCollection(); | ||
| MockLogger log = new MockLogger(); |
There was a problem hiding this comment.
Also check whether it's correctly set for calling your API from C# (for this and the next test)
There was a problem hiding this comment.
I'm not sure what there is to check? Something like ChangeWaves.DisabledVersion.ShouldBe(blah)?
src/Shared/ChangeWaves.cs
Outdated
| Version changeWave; | ||
|
|
||
| // If unset, enable all features. | ||
| if (DisabledWave.Length == 0) |
There was a problem hiding this comment.
nit:
convert to switch statement and reorder according to which you think will be used most often. (So EnableAllFeaturesAsVersion at top, for instance.
There was a problem hiding this comment.
A switch statement based on what? I do agree this can be implemented better.
| // Ensure it's set to an existing version within the current rotation | ||
| if (!AllWavesAsVersion.Contains(changeWave)) | ||
| { | ||
| foreach (Version wave in AllWavesAsVersion) |
There was a problem hiding this comment.
This can be part of the if/else chain or switch statement, right? Also, why do you have to loop through them? Can't you just set it to whatever it is, since < (AreFeaturesEnabled) works the same either way?
There was a problem hiding this comment.
This loop is to find the next available version, because we only get here if:
- It is a valid version between the bounds
- it isn't already in the array
So we need to find the next highest one to clamp it to.
Enable change waves. Added static ChangeWaves class that contains AreFeaturesEnabled and ApplyChangeWave. Documentation is in the wiki.
Makes three PRs (#5669, #5625, and #5653) use Change Waves (#5710) to opt out as a unit. Also added a test to ensure that change waves worked properly for one of the three PRs and corrected a minor issue with tests for changes under a change wave that assume it is enabled when there exist tests that disable the relevant change wave without resetting it to empty at the end.
Enable Change Waves
Provide customers with the ability to opt out of potentially breaking changes. This effectively warns them that there is a breaking change coming and gives them time to prepare for it.
To Do:
MSBuildDisableFeaturesFromVersionAreFeaturesEnabledMSBuildDisableFeaturesFromVersionis set to a value higher than the current highest change wave, clamp it to the current highest change wave.MSBuildDisableFeaturesFromVersionis set to a value within the bounds of versions, but not set to a specific wave, setMSBuildDisableFeaturesFromVersionto the next highest wave.BeginBuild[Warnings are logged but not visible in logs or output window?]