Skip to content

fix(tests): Hot Reload runtime test correctness - #24125

Merged
MartinZikmund merged 1 commit into
feature/breakingchangesfrom
dev/mazi/hotreload-test-fixes
Aug 22, 2026
Merged

MartinZikmund merged 1 commit into
feature/breakingchangesfrom
dev/mazi/hotreload-test-fixes

Conversation

@MartinZikmund

Copy link
Copy Markdown
Member

GitHub Issue: closes #24124

PR Type:

🏗️ Build or CI related changes

What changed? 🚀

Four Hot Reload runtime-test defects, one commit each. Split out of #24112 so the Hot Reload work can be reviewed on its own; #24112 keeps the macOS native-handle crash and the default test-body timeout.

test(hotreload): only cross-check the platform when a RID was stamped

The RID mapping fell through to "skia" for any unrecognised runtime identifier. The CoreCLR-on-Android host never sets RUNTIME_IDENTIFIER, so the test expected skia while the product correctly reported android — failing 100% of android-skia-coreclr runs since 2026-07-21. Only recognised RID families are mapped now; anything else means no independent oracle is available, and the desktop family is matched explicitly instead of by fallthrough. This also drops the [PlatformCondition(Exclude, SkiaAndroid)] workaround, which was over-broad — SkiaAndroid covers the Mono head too, where the test passes.

test(hotreload): stop the workspace scenario passing without running

On a CI retry the filter is rebuilt from the published failed-tests list, which carries fully qualified names, but the outer test stripped itself by comparing bare identifiers only. …Given_HotReloadWorkspace.When_HotReloadScenario was therefore forwarded to an HRApp that has no such test: it ran nothing, returned an empty result set, and the outer test reported success because there were no failures to collect. Now matches the fully qualified forms and fails explicitly when the HRApp returns no results, mirroring the fail-empty guard the CI scripts already apply to the outer run.

test(hotreload): assert on page content that exists

Given_HotReloadResilience drove HR_Frame_Pages_Page1 by replacing "Hello" and then asserted on a TextBlock named tb1. The page contains neither — its TextBlocks are FirstPageTextBlock (Text="First page") and a {Binding TitleText} one, and grep -rn "tb1" over the HotReload tree returns only the two lines of the assertion itself. The edit matched nothing and the assert then failed on an element that was never there.

This is the failure behind the red Tests - Desktop Skia Windows stage. Build 228363, test run 3886445:

Test When_HotReload_Succeeds_Then_ReloadCompleted_ReportsSuccess() failed with
Assert.IsNotNull failed. 'value' expression: 'tb'. TextBlock 'tb1' should exist in the page

Both tests now target the TextBlock the page actually declares.

test(hotreload): fail fast when a file edit matches nothing

The replacement is performed server-side, so a search string matching nothing is a silent no-op: no file change, no reload, and a test that asserts against content it never updated. That is how the stale "Hello"/tb1 expectations survived for four months. HotReloadHelper now verifies the text is present before asking the server to replace it, naming the file and the caller when it is not. The check is skipped when the source is not readable from the test process, so the server stays the authority rather than a new failure mode appearing.

The *AndRevert helpers also undo only when an edit actually happened — reverting a file that was never modified trips the same guard from a finally block, which would replace the original failure with a confusing one.

Validation

Change Evidence
RID oracle Runtime-validated on Skia Desktop Win32 (RID win-x64), exercising the new explicit desktop branch: passes.
Workspace filter Compile-validated, plus a table check that the predicate strips all four spellings of the outer test while leaving inner HRApp names untouched.
Resilience page content Verified against the page: HR_Frame_Pages_Page1.xaml declares exactly one "First page" and x:Name="FirstPageTextBlock"; no tb1, no "Hello".
No-op edit guard Compile-validated.

Uno.UI.RuntimeTests.Skia.csproj builds clean on net10.0 — 0 errors, 0 warnings. The end-to-end hot-reload path needs a DevServer plus the HRApp child process, so the Tests - Desktop Skia Windows leg on this PR is the real validation.

⚠️ Expect that stage to stay red until all four land together: fixing the vacuous retry makes the HRApp actually run, which surfaces the tb1 failure. That is correct behaviour, not a regression.

PR Checklist ✅

Copilot AI lite review requested due to automatic review settings August 19, 2026 09:04
@github-actions

github-actions Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 5m 4s —— View job


Review: fix(tests): Hot Reload runtime test correctness

  • Load tools
  • Read changed files
  • Review Given_ClientHotReloadProcessor.cs (RID oracle fix)
  • Review Given_HotReloadWorkspace.cs (workspace filter fix)
  • Review Given_HotReloadResilience.cs (page content fix)
  • Review HotReloadHelper.cs (no-op edit guard)
  • Post inline comments
  • Post summary

Overall verdict: ship with minor fixes

The four changes are all correct and address real test defects with clear reasoning. The XAML content fix is verified against HR_Frame_Pages_Page1.xaml (which declares Text="First page" and x:Name="FirstPageTextBlock" — no "Hello" or tb1). The RID-oracle fix is logically sound and the null path correctly degrades to a weaker "non-empty platform" assertion rather than a wrong equality. The workspace filter now handles all four fully-qualified spellings a CI retry can produce, and the empty-result guard closes the vacuous-pass hole cleanly.

Two findings in HotReloadHelper.cs worth addressing before merge:

1 medium · HotReloadHelper.cs line 203 — edited flag set too late
edited = true is placed after the full UpdateServerFile<T> returns, but UpdateServerFile can throw a TimeoutException from WaitForVisualTreeUpdate — which fires after the server has already written the file (the edit commits at SendMessage). When that happens, edited stays false, the finally skips the revert, and the file is left with replacementText, breaking isolation for subsequent tests. The old unconditional revert handled this correctly by accident. Same issue in UpdateProjectFileAndRevert.

1 low · HotReloadHelper.cs line 236 — File.ReadAllText not guarded against IOException
The remarks say the check is skipped "when the source is not readable", but only File.Exists is checked. An UnauthorizedAccessException or IOException (file locked while the DevServer is writing) propagates through the test and masks the actual failure — exactly the failure mode the guard is meant to avoid. A try-catch around the read would stay true to the stated intent (see inline suggestion).

No findings in the other three files. Conventional Commits titles, no event Action, no #if leaking across platforms, async discipline and CancellationToken propagation look correct throughout.

Copilot AI 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.

Pull request overview

This PR fixes correctness gaps in the Hot Reload runtime test suite so failures are surfaced reliably (no vacuous “pass” when nothing ran), and assertions/edit operations match real page content and platform reporting behavior.

Changes:

  • Fixes forwarded-filter handling so the outer workspace test is removed even when filters use fully qualified names, and fails if the HRApp returns no results.
  • Updates RID→platform cross-checking to avoid asserting against an invalid “oracle” when the host doesn’t stamp a RID.
  • Aligns resilience tests with actual XAML content and adds a guard to fail fast when a requested file edit would be a no-op (with safer undo behavior).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Uno.UI.RuntimeTests/Tests/HotReload/Given_HotReloadWorkspace.cs Improves filter stripping and adds an explicit failure when the HRApp reports zero tests.
src/Uno.UI.RuntimeTests/Tests/HotReload/Given_ClientHotReloadProcessor.cs Makes RID-based platform expectations explicit and avoids incorrect “skia” fallback when RID is unknown.
src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/HotReloadHelper.cs Adds a preflight guard for no-op edits and adjusts revert logic to avoid undoing when no edit occurred.
src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Given_HotReloadResilience.cs Fixes test expectations to target real page content and element names.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund
MartinZikmund requested a review from Xiaoy312 August 19, 2026 09:26
@nventive-devops

Copy link
Copy Markdown
Contributor

The build 228604 found UI Test snapshots differences: skia-linux-screenshots: 73, skia-windows-screenshots: 108

Details
  • skia-linux-screenshots: 73 changed over 2366

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png
    • ContentControl_Inheritance.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Focus_FocusVisual_Properties.png-dark
    • Image_Margin_Large.png
    • CalendarView_Theming.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • ElementLevelTheme.png-dark
    • DropDownButtonPage.png-dark
    • ElementLevelTheme.png
    • ImageBrush_Stretch.png
    • Image_AnimatedWebP.png-dark
    • Attributed_text_FontSize_Changing.png
  • skia-windows-screenshots: 108 changed over 2366

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ExpanderColorValidationPage.png-dark
    • Examples.png
    • ClipboardTests.png-dark
    • ContentPresenter_Template.png-dark
    • ContentPresenter_Template.png
    • ImagesInlineInFlipView.png-dark
    • ImagesInlineInFlipView.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • DisplayInformation.png-dark
    • Dopes.png-dark
    • ElementLevelTheme.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • ImageSourceUrlMsAppDataScheme.png-dark
    • ImageSourceUrlMsAppDataScheme.png
    • ImageBrush_Formats.png-dark

@github-actions

github-actions Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 5m 20s —— View job


Review: fix(tests): Hot Reload runtime test correctness

  • Load tools
  • Read changed files
  • Review HotReloadHelper.cs
  • Review Given_HotReloadResilience.cs
  • Review Given_ClientHotReloadProcessor.cs
  • Review Given_HotReloadWorkspace.cs
  • Post inline comments
  • Post summary

Overall verdict: ship with minor fixes

The four correctness repairs are all sound. The XAML-content fix is verified against HR_Frame_Pages_Page1.xaml (no "Hello" or tb1). The RID oracle correctly degrades to a weaker non-empty assertion for unrecognised identifiers — no false skia assertion on Android-CoreCLR. The workspace filter now catches all four fully-qualified spellings a CI retry can produce, and the empty-result guard closes the vacuous-pass hole.

2 findings in HotReloadHelper.cs, 2 in Given_HotReloadResilience.cs:

Severity File Finding
Medium HotReloadHelper.cs:203 edited flag set after UpdateServerFile<T> returns; a TimeoutException from WaitForVisualTreeUpdate (which fires after SendMessage) leaves edited=false, skips the revert, and leaks replacementText into the file — breaking isolation for subsequent tests. Same issue in UpdateProjectFileAndRevert.
Low HotReloadHelper.cs:236 File.ReadAllText is not guarded against IOException/UnauthorizedAccessException (e.g. file locked while DevServer is writing). Only File.Exists is checked; a suggestion with a try-catch is in the inline comment.
Low Given_HotReloadResilience.cs:101 The unconditional UpdateServerFile("Paused page", …) revert in the finally block can mask the original failure via the new EnsureOriginalTextIsPresent guard if the initial edit never reached SendMessage. The UpdateServerFileAndRevert<T> helpers were fixed with the edited flag, but this raw finally block was not.
Style Given_HotReloadResilience.cs:29-33 Comment narrates change history ("previously edited 'Hello'…", "no-op…", "landed after the last fully-green master run") — per code-style rules this belongs in the commit message. Only the last sentence (explaining the page-replacement invariant) should remain.

No findings in Given_ClientHotReloadProcessor.cs or Given_HotReloadWorkspace.cs. Conventional Commits titles are correct, no event Action, no async-void or .Result calls, CancellationToken propagation looks correct throughout.

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 228645 found UI Test snapshots differences: skia-linux-screenshots: 73, skia-windows-screenshots: 121

Details
  • skia-linux-screenshots: 73 changed over 2366

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Attributed_text_FontSize_Changing.png
    • DropDownButtonPage.png-dark
    • Examples.png
    • ClipboardTests.png-dark
    • ButtonClippingTestsControl.png-dark
    • ClipboardTests.png
    • ButtonClippingTestsControl.png
    • Buttons.png
    • ContentControl_Inheritance.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Focus_FocusVisual_Properties.png-dark
    • ImageBrush_Stretch.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • Image_Margin_Large.png
    • ContextRequested.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • ImageIconPage.png-dark
  • skia-windows-screenshots: 121 changed over 2366

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Battery.png
    • Contacts_Pick.png-dark
    • Contacts_Pick.png
    • DataTransferManager.png-dark
    • Examples.png
    • DataTransferManager.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • ContentPresenter_Template.png-dark
    • ContentPresenter_Template.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Battery.png-dark
    • ContentControl_SetNull.png-dark
    • EllipsemaskingEllipseGrid.png-dark
    • EmailManagerTests.png-dark
    • EmailManagerTests.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/hotreload-test-fixes branch from 5048333 to 804ef5c Compare August 20, 2026 13:37
@github-actions

github-actions Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 17s —— View job


Review: fix(tests): Hot Reload runtime test correctness (sync)

  • Load tools
  • Read changed file and diff
  • Review the change
  • Post inline comments (if any)
  • Post summary

Overall verdict: ship

This synchronize push is a single-line removal: the [PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.SkiaAndroid)] workaround on When_GetRuntimeTargetFramework_Then_PlatformMatchesRuntimeIdentifier is dropped.

The removal is correct and safe because:

  • Mono-head Skia-Android (the non-broken case): RuntimeInformation.RuntimeIdentifier starts with "android" → expectedPlatform = "android" → the equality assertion passes as before.
  • CoreCLR-on-Android (the broken case that required the exclusion): the host never stamps a RID, so RuntimeInformation.RuntimeIdentifier is "unknown". The earlier commit mapped every unrecognised RID to null, so the test now takes the weaker non-empty-platform path rather than asserting "skia". No assertion fails.

The old exclusion was over-broad — SkiaAndroid covers the Mono head, where the test already worked. Removing it lets the Mono head prove the fix on every run, which is the correct outcome.

No findings. No inline comments to post.

No issues from prior reviews remain open in this file — the two medium/low findings flagged by earlier review passes were in HotReloadHelper.cs and Given_HotReloadResilience.cs, which are not part of this sync push.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 228916 found UI Test snapshots differences: skia-linux-screenshots: 73, skia-windows-screenshots: 167

Details
  • skia-linux-screenshots: 73 changed over 2366

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • ContextRequested.png-dark
    • Buttons.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • CalendarView_Theming.png-dark
    • DropDownButtonPage.png-dark
    • ImageBrush_Stretch.png
    • ContentControl_Inheritance.png
    • Attributed_text_FontSize_Changing.png
    • Focus_FocusVisual_Properties.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
  • skia-windows-screenshots: 167 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • BitmapImage_vs_SvgImageSource.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Dopes.png-dark
    • EllipsemaskingEllipseGrid.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • ImageSourceUrlMsAppDataScheme.png-dark
    • ImageSourceUrlMsAppDataScheme.png
    • Image_Stretch_Algmnt_Inf_Horizontal.png-dark
    • Image_Stretch_Algmnt_Inf_Horizontal.png
    • ButtonClippingTestsControl.png-dark
    • DynamicFont.png-dark
    • DynamicFont.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • ExpanderColorValidationPage.png-dark
    • ImageBrush_Formats.png-dark
    • ImageBrush_Formats.png

The RID mapping fell through to "skia" for every unrecognised runtime
identifier. The CoreCLR-on-Android host never sets RUNTIME_IDENTIFIER, so
RuntimeInformation.RuntimeIdentifier reports "unknown", the test expected
"skia" and the product correctly reported "android". It failed on 100% of
android-skia-coreclr runs since 2026-07-21 — deterministic, not flaky.

Map only recognised RID families and treat anything else as "no independent
oracle available", still asserting that a platform was reported. The desktop
family is now matched explicitly (win/linux/osx/freebsd) instead of by
fallthrough, so a genuinely unexpected RID can no longer be silently accepted
as desktop.

This also drops the [PlatformCondition(Exclude, SkiaAndroid)] workaround, which
was over-broad: SkiaAndroid covers both the Mono head, where the test passes,
and the CoreCLR head, so the exclusion was removing working coverage.

Runtime-validated on Skia Desktop Win32 (RID win-x64), which now exercises the
new explicit desktop branch: passes.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Tj7eBARpKztfeLfaLTWde7
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/hotreload-test-fixes branch from 804ef5c to 3e17929 Compare August 21, 2026 15:50
@github-actions

github-actions Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 1s —— View job


Review: fix(tests): Hot Reload runtime test correctness (sync)

  • Load tools
  • Read changed file and diff
  • Review the change
  • Post inline comments (none needed)
  • Post summary

Overall verdict: ship

This synchronize push is a single-line removal: [PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.SkiaAndroid)] is dropped from When_GetRuntimeTargetFramework_Then_PlatformMatchesRuntimeIdentifier.

The removal is correct and safe for both Skia-Android variants:

  • Mono-head Skia-Android: RuntimeInformation.RuntimeIdentifier starts with "android" → expectedPlatform = "android" → the equality assertion passes as before. This case was always correct; the exclusion was unnecessarily suppressing it.
  • CoreCLR-on-Android (the broken case that originally required the exclusion): the host never stamps a RID, so RuntimeInformation.RuntimeIdentifier is "unknown". The earlier commit in this PR maps every unrecognised RID to null, so the test now takes the weaker non-empty-platform path rather than asserting the wrong "skia". No assertion fails.

SkiaAndroid covers both heads — dropping it lets the Mono head validate the fix on every run, which is the correct outcome.

No findings. No issues from prior reviews remain open in this file — the medium/low findings flagged by earlier review passes were in HotReloadHelper.cs and Given_HotReloadResilience.cs, which are not part of this sync push.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 229241 found UI Test snapshots differences: skia-linux-screenshots: 73, skia-windows-screenshots: 190

Details
  • skia-linux-screenshots: 73 changed over 2366

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Attributed_text_FontSize_Changing.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ContextRequested.png-dark
    • ContentControl_Inheritance.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Examples.png
    • DropDownButtonPage.png-dark
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Focus_FocusVisual_Properties.png-dark
    • ImageBrush_Stretch.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • Image_Margin_Large.png
  • skia-windows-screenshots: 190 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Contacts_Pick.png-dark
    • Contacts_Pick.png
    • GetFocus.png-dark
    • GetFocus.png
    • Attributed_text_FontSize_Changing.png
    • Dopes.png-dark
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Focus_FocusVisual_Properties.png-dark
    • ImageBrush_Formats.png-dark
    • ImageBrush_Formats.png
    • Image_UseTargetSizeLate.png-dark
    • BitmapImage_vs_SvgImageSource.png-dark
    • BitmapImage_vs_SvgImageSource.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DataTransferManager.png-dark
    • DataTransferManager.png
    • DynamicFont.png-dark
    • DynamicFont.png

@mergify

mergify Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@MartinZikmund
MartinZikmund merged commit cf222c5 into feature/breakingchanges Aug 22, 2026
46 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/hotreload-test-fixes branch August 22, 2026 08:41
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.

6 participants