Skip to content

Mark WorkItemExecution as passed when real test results exist#16577

Closed
lewing wants to merge 1 commit intomainfrom
fix/workitem-execution-redundant-failure
Closed

Mark WorkItemExecution as passed when real test results exist#16577
lewing wants to merge 1 commit intomainfrom
fix/workitem-execution-redundant-failure

Conversation

@lewing
Copy link
Member

@lewing lewing commented Mar 10, 2026

Summary

When a Helix work item fails and the test reporter has already posted real test results to the AzDO test run, the synthetic WorkItemExecution result is redundant. Marking it as failed prevents Build Analysis from going green even when all real test failures are matched to known issues.

Problem

CreateTestsForWorkItems creates a synthetic .WorkItemExecution test result for every work item. If the work item failed, this result is marked as Failed with a generic error message: "The Helix Work Item failed. Often this is due to a test crash."

Build Analysis matches known-issue patterns against test ErrorMessage and StackTrace fields. The real test failures (e.g. NoOpRebuild timing out) get matched to known issues, but the synthetic WorkItemExecution entry has a generic message that doesn't match — so BA stays red.

Example: dotnet/runtime#125373 — BA correctly matched 3 test failures to known issues (#116697, #124438), but the RebuildTests.WorkItemExecution entry kept BA red.

Fix

Before creating the synthetic result, query the test run for existing results from this work item (using automatedTestStorage). If results exist, mark WorkItemExecution as passed — the real results already capture the failure details.

Work items that crash without producing any test results still get a failed WorkItemExecution entry — that's the case it was designed for.

Trade-offs

  • Adds one API call per failed work item ($top=1 keeps it lightweight)
  • If the API call fails, falls back to current behavior (marks as failed)
  • Preserves the WorkItemExecution entry for genuine crashes with no test output

When a Helix work item fails and the test reporter has already posted
real test results to the AzDO test run, the synthetic WorkItemExecution
result is redundant. Marking it as failed prevents Build Analysis from
going green even when all real test failures are matched to known issues.

Before creating the synthetic result, query the test run for existing
results from this work item (using automatedTestStorage). If results
exist, mark WorkItemExecution as passed instead of failed.

Work items that crash without producing any test results still get a
failed WorkItemExecution entry — that's the case it was designed for.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lewing
Copy link
Member Author

lewing commented Mar 10, 2026

I'm not 100% sure this is the correct resolution to the problem but think it is worth brining up.

@steveisok
Copy link
Member

I'm not 100% sure this is the correct resolution to the problem but think it is worth brining up.

Isn't it either fix here or fix in BA?

@lewing
Copy link
Member Author

lewing commented Mar 10, 2026

I'm not 100% sure this is the correct resolution to the problem but think it is worth brining up.

Isn't it either fix here or fix in BA?

yeah, the alternative is working around it in BA

@lewing lewing requested a review from ViktorHofer March 10, 2026 21:14
@lewing lewing closed this Mar 11, 2026
@lewing lewing deleted the fix/workitem-execution-redundant-failure branch March 11, 2026 04:49
@lewing
Copy link
Member Author

lewing commented Mar 11, 2026

I'm going to think on this a bit more

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.

2 participants