Skip to content

Commit

Permalink
OM unification Bugfix - Fix result validity check (#10362)
Browse files Browse the repository at this point in the history
* Fix result validity check

* Remove redundant check
  • Loading branch information
JanKrivanek authored Jul 12, 2024
1 parent 4cafb45 commit 0be32ba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/Build/BackEnd/BuildManager/BuildSubmission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ private protected void ExecuteAsync(
internal void CompleteResults(TResultData result)
{
ErrorUtilities.VerifyThrowArgumentNull(result, nameof(result));
ErrorUtilities.VerifyThrow(result.SubmissionId == SubmissionId,
"GraphBuildResult's submission id doesn't match GraphBuildSubmission's");
CheckResultValidForCompletion(result);

BuildResult ??= result;

CheckForCompletion();
}

protected internal abstract void CheckResultValidForCompletion(TResultData result);

protected internal abstract TResultData CreateFailedResult(Exception exception);

internal override BuildResultBase CompleteResultsWithException(Exception exception)
Expand Down Expand Up @@ -207,7 +208,19 @@ protected internal override BuildResult CreateFailedResult(Exception exception)
"BuildRequest is not populated while reporting failed result.");
return new(BuildRequest!, exception);
}


protected internal override void CheckResultValidForCompletion(BuildResult result)
{
// We verify that we got results from the same configuration, but not necessarily the same request, because we are
// rather flexible in how users are allowed to submit multiple requests for the same configuration. In this case, the
// request id of the result will match the first request, even though it will contain results for all requests (including
// this one.)
if (result.ConfigurationId != BuildRequest?.ConfigurationId)
{
ErrorUtilities.ThrowInternalError("BuildResult configuration ({0}) doesn't match BuildRequest configuration ({1})",
result.ConfigurationId, BuildRequest?.ConfigurationId);
}
}

protected internal override void OnCompletition()
{
Expand Down
6 changes: 6 additions & 0 deletions src/Build/Graph/GraphBuildSubmission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ public override GraphBuildResult Execute()
return BuildResult!;
}

protected internal override void CheckResultValidForCompletion(GraphBuildResult result)
{
ErrorUtilities.VerifyThrow(result.SubmissionId == SubmissionId,
"GraphBuildResult's submission id doesn't match GraphBuildSubmission's");
}

protected internal override GraphBuildResult CreateFailedResult(Exception exception)
=> new(SubmissionId, exception);
}
Expand Down

0 comments on commit 0be32ba

Please sign in to comment.