test(mocha): stabilize atf final status assertion#9253
Conversation
Overall package sizeSelf size: 6.65 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.1 | 122.62 kB | 437.94 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
BenchmarksBenchmark execution time: 2026-07-08 09:17:45 Comparing candidate commit 94cc66c in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 2310 metrics, 48 unstable metrics.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 94cc66cad4
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 94cc66c | Docs | Datadog PR Page | Give us feedback! |
There was a problem hiding this comment.
More details
The new tag-based filtering in assertAttemptToFixFailThenPass correctly fixes the parallel-mode flake: all three adversarial timestamp-ordering scenarios (normal, reversed, identical) pass cleanly. The assertion is now semantically stable — retriedTests.length === 2 is now explicitly checked (stronger than before), and the final-status span is located by tag rather than last-by-timestamp, which was the root cause of the nondeterminism.
📊 Validated against 5 scenarios · Open Bits AI session
🤖 Datadog Autotest · Commit 94cc66c · What is Autotest? · Any feedback? Reach out in #autotest
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9253 +/- ##
==========================================
- Coverage 96.54% 96.54% -0.01%
==========================================
Files 915 915
Lines 121018 121018
Branches 20693 20851 +158
==========================================
- Hits 116837 116836 -1
- Misses 4181 4182 +1 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What does this PR do?
Stabilizes the Mocha Test Optimization attempt-to-fix integration assertion by identifying original attempts, retry attempts, and the final-status attempt from their tags instead of relying on retry span timestamp ordering.
Motivation
The
integration-mocha (latest, latest)GitHub Actions job flaked because the parallel-mode test sorted retry spans bystartand expected the final attempt to be last. In parallel mode, equivalent or close timestamps can make that ordering unstable, so the assertion could inspect a span withouttest.final_statuseven though the final-status span was present.