Skip to content

Revert "Guard server telemetry against duplicate result updates per test UID (#8192)"#8218

Merged
Evangelink merged 1 commit into
mainfrom
dev/amauryleve/revert-server-telemetry-dedup
May 14, 2026
Merged

Revert "Guard server telemetry against duplicate result updates per test UID (#8192)"#8218
Evangelink merged 1 commit into
mainfrom
dev/amauryleve/revert-server-telemetry-dedup

Conversation

@Evangelink
Copy link
Copy Markdown
Member

Summary

Reverts #8192.

Why

After the merge, @Youssef1313 pointed out (#8192 (comment)) that the deduplication guard introduces an asymmetric retry-counting semantic. Under #8192's guard, the retry count became:

1st result 2nd result retries counted
pass pass 0
pass fail 1
fail fail 0
fail pass 1

The "retry" count then depends on outcome shape rather than on how many results were actually reported — particularly noticeable for "folded" tests where multiple sub-cases share one TestNode.Uid. The pre-#8192 behavior (every subsequent update for the same UID counts as a retry) is at least symmetric and consistent.

This revert restores that prior behavior. If retry/dedup semantics need to change, that should be a separate, design-led PR rather than the post-hoc guard from #8192.

Validation

  • ServerDataConsumerServiceTests runs green (8/8).
  • No public API changes, no localization changes.

Copilot AI review requested due to automatic review settings May 14, 2026 11:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Reverts #8192, which introduced an outcome-based deduplication guard in server-mode telemetry. That guard produced asymmetric retry counting depending on outcome shape; this revert restores the prior, symmetric behavior where every subsequent update for the same UID counts as a retry.

Changes:

  • Remove the HasPassed == hasPassed early-return guard in AddOrUpdateTestNodeStateStatistics.
  • Revert the duplicate-passed test expectation back to counting as a retry, and rename the outcome-change test back to PopulateTestNodeStatistics_WithEventsForSameUid.
  • Drop the two tests added by #8192 (duplicate-failed and duplicate-after-outcome-change).
Show a summary per file
File Description
src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/PerRequestServerDataConsumerService.cs Removes the dedup early-return so duplicate updates again increment retry counters.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/ServerDataConsumerServiceTests.cs Restores prior test expectations and removes tests added with the reverted guard.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

Copy link
Copy Markdown
Member Author

@Evangelink Evangelink left a comment

Choose a reason for hiding this comment

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

Review Summary

The revert is clean and correct. The root cause of the revert is valid: the guard if (existingStatistics.HasPassed == hasPassed) return; was asymmetric in the sense that pass+pass counted 0 retries while fail+pass+pass (after the outcome flip) would count only 1 retry — effectively swallowing the second duplicate event in the latter case but not having any equivalent deduplication for the failure case prior to the flip. Restoring symmetric behaviour (every subsequent event increments the corresponding retry counter) is the right call.

Production code — no issues. The removal of the 5-line guard is minimal and correct.

Test coverage — one minor gap: the symmetric counterpart to WithDuplicatePassedEvents (i.e., fail+fail → TotalFailedRetries=1) is now untested. The old test for that case was rightfully removed (it expected the now-wrong value of 0), but no replacement documents the new expected behaviour. See inline comment for a suggested test.

Generated by Expert Code Review (on open) for issue #8218 · ● 3.8M

@Youssef1313
Copy link
Copy Markdown
Member

I agree with the revert here 👍 (I don't think the PR description is correct though - there is no retry involved here IMO)

@Evangelink Evangelink enabled auto-merge (squash) May 14, 2026 12:29
@Evangelink Evangelink merged commit 43e02b6 into main May 14, 2026
48 checks passed
@Evangelink Evangelink deleted the dev/amauryleve/revert-server-telemetry-dedup branch May 14, 2026 12:37
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.

4 participants