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

Infer target skip reason from older binlogs #6577

Merged
merged 2 commits into from
Jun 17, 2021
Merged

Conversation

KirillOsenkov
Copy link
Member

Remove an assert that is too aggressive. When reading old binlogs the TargetSkipReason is not known, so TargetSkipReason.None is a valid state.

We can do a best effort and infer the skip reason for format version 13.

Fixes #6563

Remove an assert that is too aggressive. When reading old binlogs the TargetSkipReason is not known, so TargetSkipReason.None is a valid state.

We can do a best effort and infer the skip reason for format version 13.

Fixes #6563
@@ -304,6 +304,13 @@ private BuildEventArgs ReadTargetSkippedEventArgs()
condition = ReadOptionalString();
evaluatedCondition = ReadOptionalString();
originallySucceeded = ReadBoolean();

// Attempt to infer skip reason from the data we have
skipReason = condition != null ?
Copy link
Member

Choose a reason for hiding this comment

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

This is saying that if the condition was not null, the condition was false, which doesn't sound right.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, if the target was skipped because of the false condition, we store the condition which was false. If it was skipped for other reasons, the condition will be null.

Copy link
Member

Choose a reason for hiding this comment

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

And if the condition was true, but we skipped it for another reason, condition would still be null instead of true? That's confusing, but ok.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, we only store the Condition if the target was skipped because of false condition ;)

@@ -304,6 +304,13 @@ private BuildEventArgs ReadTargetSkippedEventArgs()
condition = ReadOptionalString();
evaluatedCondition = ReadOptionalString();
originallySucceeded = ReadBoolean();

// Attempt to infer skip reason from the data we have
skipReason = condition != null ?
Copy link
Member

Choose a reason for hiding this comment

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

And if the condition was true, but we skipped it for another reason, condition would still be null instead of true? That's confusing, but ok.

Copy link
Member

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

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

Is there any way we can add a regression test here? Seems like we should really have tests that validate playing back binlogs of formats in the range [1,N) but I don't know how we could collect sufficient examples of them.

src/Build/Logging/BinaryLogger/BuildEventArgsReader.cs Outdated Show resolved Hide resolved
@KirillOsenkov
Copy link
Member Author

I've filed #6587 to track the work of adding tests for playing back binlogs of each version.

I've had the same thoughts.

@rainersigwald rainersigwald added this to the 17.0 milestone Jun 17, 2021
@rainersigwald rainersigwald merged commit 4945f05 into main Jun 17, 2021
@rainersigwald rainersigwald deleted the dev/kirillo/skipReason branch June 17, 2021 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TargetSkippedEventArgs.TargetSkipReason can be None when reading old binlogs
3 participants