Repository navigation
[SDTEST-4054][SDTEST-4055][SDTEST-4056] Add test automation exclusion attributes - #9578
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@autotest Review |
There was a problem hiding this comment.
MSTest can turn a protected terminal failure into an ignored result when Attempt to Fix is assigned, allowing CI to pass despite the span reporting failure. Outcome masking must honor PreventFailureSuppression independently of retry eligibility.
🤖 Bits Code Review · Commit 785db15
There was a problem hiding this comment.
MSTest native-retry finalization can still suppress a failure protected by [PreventFailureSuppression] when Attempt to Fix is assigned, allowing a failing critical test to become nonblocking.
🤖 Bits Code Review · Commit 785db15
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 785db154a7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@autotest Review |
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (9578) and master. ✅ No regressions detected |
There was a problem hiding this comment.
MSTest Attempt to Fix can still turn a terminal protected failure into an ignored result. The masking paths must honor PreventFailureSuppression independently of retry eligibility.
🤖 Bits Code Review · Commit 785db15
|
@autotest Review |
There was a problem hiding this comment.
More details
The previously reported MSTest outcome-masking paths now honor PreventFailureSuppression independently of retry eligibility. Static review produced no reportable findings; runtime behavior was not revalidated.
🤖 Bits Code Review · Commit 5aa6ed4
BenchmarksBenchmark execution time: 2026-11-06 22:51:49 Comparing candidate commit 60c32ad in PR branch Found 0 performance improvements and 1 performance regressions! Performance is the same for 71 metrics, 0 unstable metrics, 6 known flaky benchmarks, 119 flaky benchmarks without significant changes.
|
|
Fixed the managed .NET 8 CI failure in 508ae98. The NUnit test fixture looked up a completed test through a weak cache, allowing garbage collection to replace it with a newly created test before the final-status assertion. It now captures the actual execution inside the command and retains it through every unchanged policy/tag/final-status assertion. Forced garbage collection reproduces the previous failure; all 338 focused regression/API tests pass on both .NET 8 and .NET 11 after the fix. No production code changed. The signed current head matches the independently reviewed tree, and CI is rerunning. |
|
@autotest Review |
There was a problem hiding this comment.
More details
Static review found no actionable defect in the attribute handling, policy overrides, or framework result paths, including protected terminal failures and native retries. Runtime behavior was not revalidated because the required .NET 11 SDK was unavailable.
🤖 Bits Code Review · Commit 508ae98
|
Addressed the final SDK design finding in 10ab725: annotation metadata errors now use a type-owned logger, avoiding initialization of Test Optimization just to log an error. Independent Design and Conventions reviews cleared the correction. All four source targets build with zero warnings/errors, and all 338 focused regression/API tests pass on both .NET 8 and .NET 11. The previous macOS task hit its 30-minute time limit after successfully compiling all four tracer targets; the new head starts a normal CI run with the existing workflow and time budget. |
Keep failure protection when attribute metadata can't be read, stop NUnit reporting a slow EFD abort for NoAutoRetry tests, and assert the result MSTest actually receives.
Run annotated tests through each framework with the existing retry samples, using the attributes from Datadog.Trace.Manual.
The multi-package sample builds don't build Datadog.Trace.Manual, so a project reference fails with CS0006.
Any failed attempt now fails a test with PreventFailureSuppression, matching the other tracers, and the framework no longer keeps a later pass. Document and test that annotations restore ordinary TIA selection.
andrewlock
left a comment
There was a problem hiding this comment.
LGTM from the lang-plat PoV, but I have a bunch of minor suggestions - the biggest ones are around naming; properties generally shouldn't be 'negatively' named - I think it would be much easier to read if the bool properties were inverted
There was a problem hiding this comment.
In NUnit, a protected Attempt to Fix test can still return Passed when EFD or automatic retries take precedence and a later attempt succeeds, violating the annotation's blocking-failure contract.
🤖 Bits Code Review · Commit afbe77e
There was a problem hiding this comment.
More details
Adds method-level PreventFailureSuppression and NoAutoRetry attributes across supported xUnit, NUnit, and MSTest variants.
Declaration policy is applied independently of mutable span tags while preserving backend properties, skips, TIA selection, and permitted retries.
Protected Attempt to Fix failures remain blocking, and NoAutoRetry suppresses Datadog retries.
The follow-up prioritizes NUnit Attempt to Fix over EFD/ATR, fixing the previously reported fail-then-pass masking defect.
No review findings remain open.
🤖 Bits Code Review · Commit 60c32ad
## Summary of changes Make Attempt to Fix behave as it does in the Java, Python and Ruby tracers. This is a behavior change for every .NET user of Attempt to Fix: builds that are green today can turn red. | Attempt to Fix test | Before | After | |---|---|---| | Every attempt passes | Green | Green | | Fails, and another attempt passes | Usually green | Red | | Always fails and is quarantined or disabled | Green, `final_status: skip` | Red, `final_status: fail` | | Always fails, not quarantined | Depends on the framework | Red | ## Reason for change .NET recorded a failed Attempt to Fix in Datadog but often left CI green, and kept retrying after a failure. The other tracers treat one failure as proof that the fix didn't work: - Java `AttemptToFix`: "Failures are never suppressed, even when the test is also quarantined or disabled". It stops at the first failure. - Python `AttemptToFixHandler`: the final status is `fail` unless every attempt passed, and it stops at the first failure. - Ruby `should_ignore_failures?` returns `false` for Attempt to Fix, and `RetryFlakyFixed` stops at the first failure. Java, Python, Ruby and JavaScript all report `test_management.attempt_to_fix` capability version 5, while .NET reported 4. ## Implementation details - `Common`: Attempt to Fix takes priority over quarantine and disabling in `final_status` and is never treated as suppressed. - xUnit, NUnit and MSTest: stop at the first failure, keep the failure as the framework result, and stop masking the outcome. - MSTest: Attempt to Fix now takes priority over EFD, as it already does on xUnit and, since #9578, on NUnit. - MSTest: if a native `[Retry]` recovers from a failed attempt, the test still fails and no Datadog retries run. Rows of a parameterized test share one retry loop, so a failure in one row stops it for all of them. - `attempt_to_fix_passed: false` is now sent when the first attempt fails. `has_failed_all_retries` is no longer set for Attempt to Fix retries. - The capability version goes from 4 to 5. ## Test coverage - Unit tests cover the new `final_status` priority, stopping on failure, and the MSTest paths: first attempt fails, pass then fail, and native recovery, all with the test also quarantined. - Integration tests passed locally on Linux with .NET 11: 166 of 167, with 1 existing skip, across retries, native retries (VSTest and MTP), discovery, quarantined, disabled and Attempt to Fix for xUnit v2, xUnit v3, NUnit and MSTest. After merging master, which now includes #9578, the same battery passed again, 166 of 167 with the same skip. - Each `AttemptToFixTests` snapshot changed as expected: 18 fewer retries, and the two failing tests moved from `final_status: skip` to `fail`. Tests without Attempt to Fix did not change. All 46 CI snapshots also move to capability version 5. - `MsTestV2EvpTests.AttemptToFixTests` for `pre_2_2_4` was derived from `post_2_2_4` because it can't be generated locally. The same transform reproduces the previous `pre_2_2_4` snapshot exactly from the previous `post_2_2_4`. ## Other details .NET 8, Windows and the package version matrix were not run locally, so that coverage depends on CI. I could not access the test automation exclusions spec. This aligns with the other tracers' code and shepherd's `docs/features/flaky_test_management.md`, which says Attempt to Fix fails "if any retry fails". Jest, unlike the others, appears to run all attempts rather than stopping at the first failure. This needs a release note, because customers can see new CI failures. --------- Co-authored-by: Calvin Bayer <50014594+calvinbayer@users.noreply.github.com> Co-authored-by: Calvin Bayer <calvin.bayer@datadoghq.com>
Summary of changes
Add method-level
PreventFailureSuppressionandNoAutoRetryattributes for xUnit, NUnit, and MSTest, including their supported framework variants.Reason for change
Critical tests need an explicit way to retain blocking failures and opt out of Datadog retries. Implements SDTEST-4054, SDTEST-4055, and SDTEST-4056 using the reviewed test automation exclusions contract.
Implementation details
Expose the attributes through the manual API and apply declaration metadata independently of mutable span tags. Preserve backend-assigned properties, native retries, explicit skips, and TIA selection. Emit true-only annotation tags on known executions. Failure protection keeps retries available, and during Attempt to Fix any failed attempt keeps a protected test failing on xUnit, NUnit and MSTest, even if another attempt passes. This matches the Java, Python and Ruby tracers. Annotation metadata errors use a type-owned logger without initializing Test Optimization.
Test coverage
AutomationExclusionsintegration scenarios run annotated tests from the existing retry samples through xUnit v2, xUnit v3, NUnit and MSTest with the profiler attached, compiling the same attribute sources that ship inDatadog.Trace.Manual. They passed locally on .NET 11 on Linux. The eight exclusion scenarios failed with attribute detection deliberately broken, and the fourProtectedAttemptToFixFailurescenarios failed with that fix removed.Other details
Unannotated Attempt to Fix tests keep their existing .NET behavior, which differs from the other tracers: retries continue after a failure and a later pass can win. #9619 aligns them as a separate change. A protected test with an MSTest native
[Retry]that recovers before Datadog retries also stays green. No generated source was edited manually.