Skip to content

[SDTEST-4054][SDTEST-4055][SDTEST-4056] Add test automation exclusion attributes - #9578

Merged
calvinbayer merged 22 commits into
masterfrom
codex/critical-test-annotations-dotnet
Nov 9, 2026
Merged

calvinbayer merged 22 commits into
masterfrom
codex/critical-test-annotations-dotnet

Conversation

@calvinbayer

@calvinbayer calvinbayer commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary of changes

Add method-level PreventFailureSuppression and NoAutoRetry attributes 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

  • Build all four source target frameworks.
  • 338 focused managed regression and API tests passed on both .NET 8 and .NET 11, including policy combinations, parameterized framework handling, native and Datadog MSTest retries, successful native recovery, inherited declarations, and declaration/tag isolation.
  • Exact nullability generator used by CI passed without changing its tracked file list.
  • The new MSTest callback regressions reproduced both protected-outcome defects before the fix.
  • The NUnit execution regression retains the actual execution through forced garbage collection while checking all policy, tag, and final-status assertions.
  • New AutomationExclusions integration 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 in Datadog.Trace.Manual. They passed locally on .NET 11 on Linux. The eight exclusion scenarios failed with attribute detection deliberately broken, and the four ProtectedAttemptToFixFailure scenarios failed with that fix removed.
  • The existing retry, native retry and discovery integration tests passed in the same local setup.

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.

@calvinbayer
calvinbayer requested review from a team as code owners November 2, 2026 11:40
@calvinbayer
calvinbayer requested review from BridgeAR and removed request for a team November 2, 2026 11:40
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T11:46:37.665897Z 785db15 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@calvinbayer

Copy link
Copy Markdown
Contributor Author

@autotest Review

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: FAIL

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.

Open Bits AI session

🤖 Bits Code Review · Commit 785db15

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: FAIL

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.

Open Bits AI session

🤖 Bits Code Review · Commit 785db15

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

@calvinbayer calvinbayer added area:ci-visibility type:new-feature type:public-api-change AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos labels Nov 2, 2026
@calvinbayer

Copy link
Copy Markdown
Contributor Author

@autotest Review

@dd-trace-dotnet-ci-bot

dd-trace-dotnet-ci-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (9578) and master.

✅ No regressions detected

📄 View the full report (charts + all metrics) →

@calvinbayer
calvinbayer requested a review from a team November 2, 2026 12:24

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: FAIL

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.

Open Bits AI session

🤖 Bits Code Review · Commit 785db15

@calvinbayer

Copy link
Copy Markdown
Contributor Author

@autotest Review

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: PASS

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.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 5aa6ed4

@pr-commenter

pr-commenter Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-11-06 22:51:49

Comparing candidate commit 60c32ad in PR branch codex/critical-test-annotations-dotnet with baseline commit 3c64810 in branch master.

📊 Benchmarking dashboard

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.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TracerBenchmark.StartActiveSpan net472

  • 🟥 execution_time [+271.310ns; +307.866ns] or [+5.131%; +5.822%]

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net472

  • 🟩 throughput [+9415.619op/s; +10098.090op/s] or [+5.013%; +5.377%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1

  • 🟥 execution_time [+272.984ns; +313.805ns] or [+5.233%; +6.015%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • unstable execution_time [-0.002ns; +0.004ns] or [-12.710%; +28.220%]
  • unstable throughput [-310073268279.155op/s; +104848814677.519op/s] or [-151.820%; +51.337%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟩 throughput [+17740.880op/s; +20888.973op/s] or [+5.212%; +6.137%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • 🟥 execution_time [+4.583µs; +8.836µs] or [+9.015%; +17.382%]
  • 🟥 throughput [-2652.530op/s; -1515.556op/s] or [-13.468%; -7.695%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • unstable execution_time [-0.007ns; +0.002ns] or [-38.672%; +9.560%]
  • unstable throughput [-1415236497319.329op/s; +4658516312681.934op/s] or [-686.346%; +2259.235%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1
  • scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472
  • scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0
  • scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472
  • scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net472
  • scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1
  • scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0
  • scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1
  • scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472
  • scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0
  • scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472
  • scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0
  • scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch netcoreapp3.1
  • scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472
  • scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0
  • scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync netcoreapp3.1
  • scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0
  • scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net472
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net6.0
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472
  • scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1
  • scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net6.0
  • scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0
  • scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net6.0
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net6.0
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

@calvinbayer

Copy link
Copy Markdown
Contributor Author

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.

@calvinbayer

Copy link
Copy Markdown
Contributor Author

@autotest Review

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: PASS

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.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 508ae98

@calvinbayer

Copy link
Copy Markdown
Contributor Author

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 andrewlock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

@datadog-datadog-staging-us1-all datadog-datadog-staging-us1-all Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bits Code Review: FAIL

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.

Open Bits AI session

🤖 Bits Code Review · Commit afbe77e

@datadog-datadog-staging-us1-all datadog-datadog-staging-us1-all Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bits Code Review: PASS

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.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 60c32ad

@calvinbayer
calvinbayer merged commit 8ca251f into master Nov 9, 2026
149 checks passed
@calvinbayer
calvinbayer deleted the codex/critical-test-annotations-dotnet branch November 9, 2026 12:35
@github-actions github-actions Bot added this to the vNext-v3 milestone Nov 9, 2026
tonyredondo added a commit that referenced this pull request Nov 10, 2026
## 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos area:ci-visibility type:new-feature type:public-api-change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants