Repository navigation
fix(tests): Hot Reload runtime test correctness - #24129
Conversation
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
On a CI retry the filter is rebuilt from the published failed-tests list, which carries fully qualified names. The outer test stripped itself from the forwarded filter by comparing against the bare identifiers only, so "…Given_HotReloadWorkspace.When_HotReloadScenario" was passed through to the HRApp. The HRApp has no such test, ran nothing, produced an empty result set, and the outer test reported success because there were no failures to collect. Match the fully qualified forms too, and fail explicitly when the HRApp returns no results at all — mirroring the fail-empty guard the CI scripts already apply to the outer run. Verified by inspection against the real filter round-trip (SampleChooserViewModel base64-decodes the pipe-separated list, UnitTestsControl rejoins it with ';'), plus a table check that the predicate strips all four spellings of the outer test while leaving inner HRApp test names untouched. Compile-validated; the end-to-end path needs the Windows/macOS Skia CI leg. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Tj7eBARpKztfeLfaLTWde7
The hot reload file replacement is applied server-side, so a search string that matches nothing is a silent no-op: no file change, no reload, and a test that proceeds to assert against content it never updated. That is how the stale "Hello"/"tb1" expectations in Given_HotReloadResilience survived undetected. Verify the text is present before asking the server to replace it, and name 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. Undo the edit only when one was actually made: 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. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Xn8SQpybcpmMCwFmbCzSWt
`When_VisualTree_Paused_Then_ReloadCompleted_StillFires` replaced "Hello" with "PausedTest", and `HR_Frame_Pages_Page1.xaml` contains neither. The edit matched nothing, so no reload was requested and the drain had nothing to apply. This becomes a hard failure once the no-op edit guard is in place, so the two must land together. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012yChS9evZTBdTJ77wWw2mY
|
Claude finished @MartinZikmund's task in 3m 37s —— View job Review — 2 findings (1 medium, 1 low)
Overall verdict: fix-first on the medium finding; the low finding is discretionary. Cross-cutting notesThe four fixes are well-reasoned and correctly targeted:
FindingsMedium — exception shadowing in The manual try/finally in this test does not apply the Low —
|
There was a problem hiding this comment.
Pull request overview
This PR improves the correctness and failure signaling of the Hot Reload runtime test harness, preventing false-green outcomes and making no-op edits fail deterministically so real regressions surface reliably.
Changes:
- Fixes HRApp filter forwarding so the outer workspace test can’t pass without the inner HRApp running any tests.
- Makes RID/platform cross-checking conditional on having a meaningful RID “oracle”, avoiding deterministic failures on hosts that report
unknown. - Adds a guard that fails fast when a requested server-side file edit would be a silent no-op, and updates the pause test to edit text that actually exists.
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 handling and fails when the inner HRApp reports zero test results. |
| src/Uno.UI.RuntimeTests/Tests/HotReload/Given_ClientHotReloadProcessor.cs | Tightens RID→platform mapping and avoids asserting against non-oracle RIDs. |
| src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/HotReloadHelper.cs | Adds no-op edit detection and avoids undoing edits that didn’t occur. |
| src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/Given_HotReloadResilience.cs | Updates pause-test edit strings to match actual page content and revert reliably. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24129/wasm-skia-net9/index.html |
Two review points on the guard added in this PR. `EnsureOriginalTextIsPresent` documented that it steps aside when the source is not readable, but only checked `File.Exists` — a locked or inaccessible file still reached `File.ReadAllText` and surfaced as an `IOException` from a helper that is supposed to be invisible unless the search text is genuinely absent. The read now falls back for exactly that case, which also subsumes the existence check. The pause test reverted its edit unconditionally. The revert is skipped when no edit landed, so it can no longer trip the guard it is meant to complement, and it now also covers the assertion inside the pause block — previously a failure there left the file on "Paused page" for every later test. Runtime-validated on Skia Desktop Win32: 35 passed / 11 skipped / 0 failed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012yChS9evZTBdTJ77wWw2mY
|
Claude finished @MartinZikmund's task in 1m 53s —— View job Review — re-check after d3a587e
Both prior findings are resolved. No new findings. Prior findings — resolvedMedium (exception shadowing in Low ( Cross-cutting checkThe four original fixes (RID mapping, filter forwarding, no-op edit guard, text correction) are unchanged and were already confirmed sound in the first review pass. d3a587e adds no new logic beyond hardening the two flagged spots. Overall verdict: ship. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/HotReloadHelper.cs:205
- Same issue in
UpdateServerFileAndRevert<T>:editedis only set afterUpdateServerFile<T>completes, so exceptions thrown after the update request is sent (e.g., waiting for the visual-tree update) will skip the undo and may leave the edited file in place for later tests. Making the undo a best-effort, non-throwing cleanup avoids both state leakage and failure-masking.
var edited = false;
try
{
await UpdateServerFile<T>(originalText, replacementText, ct, caller, line);
edited = true;
src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Tests/HotReloadHelper.cs:167
UpdateProjectFileAndRevertsetsedited = trueonly afterUpdateServerFilecompletes successfully. IfUpdateServerFilethrows after sending the update request (e.g., during the visual-tree update wait/timeout), thefinallyblock will skip the undo and can leave the workspace modified for subsequent tests. Consider making the undo best-effort and non-throwing so it runs even when the initial update path fails, without masking the original failure.
This issue also appears on line 200 of the same file.
var edited = false;
try
{
await UpdateServerFile(filePathInProject, originalText, replacementText, ct, caller, line);
edited = true;
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24129/wasm-skia-net9/index.html |
GitHub Issue: closes #24124
PR Type:
🏗️ Build or CI related changes
What changed? 🚀
Four Hot Reload runtime-test defects, one commit each. Originally raised against
feature/breakingchangesin #24125; retargeted here because three of the four are missing frommasterentirely, and the fourth is a latent break thatmasterstill carries.feature/breakingchangespicks these up through the normal master sync.test(hotreload): only cross-check the platform when a RID was stampedThe RID mapping fell through to
"skia"for any unrecognised runtime identifier. The CoreCLR-on-Android host never setsRUNTIME_IDENTIFIER, so the test expectedskiawhile the product correctly reportedandroid— failing 100% ofandroid-skia-coreclrruns 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 —SkiaAndroidcovers the Mono head too, where the test passes.test(hotreload): stop the workspace scenario passing without runningOn 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_HotReloadScenariowas 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 thefail-emptyguard the CI scripts already apply to the outer run.test(hotreload): fail fast when a file edit matches nothingThe 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.
HotReloadHelpernow 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
*AndReverthelpers also undo only when an edit actually happened — reverting a file that was never modified trips the same guard from afinallyblock, which would replace the original failure with a confusing one.test(hotreload): drive the pause test with text the page containsWhen_VisualTree_Paused_Then_ReloadCompleted_StillFiresreplaced"Hello"with"PausedTest", andHR_Frame_Pages_Page1.xamlcontains neither — its TextBlocks areFirstPageTextBlock(Text="First page") and a{Binding TitleText}one. The edit matched nothing, so no reload was requested and the drain had nothing to apply.This one has to land with the guard above. Once a no-op edit is a hard error, the stale
"Hello"search stops being invisible and starts failing the stage. Verified by reverting just this commit and re-running:When_HotReload_Succeeds_Then_ReloadCompleted_ReportsSuccessneeds no change here — it was already corrected onmaster(Frame host, element re-resolved from the live tree, because a reloadable-type update replaces the page instance rather than mutating it).Validation
Runtime-validated on Skia Desktop Win32, running the real harness — DevServer host plus the spawned HRApp child process — via
Given_HotReloadWorkspace:Both
Given_HotReloadResiliencetests are among the 35 that ran and passed — confirmed against the HRApp's own NUnit result file, so the outer pass is not the vacuous one described above.PR Checklist ✅
Screenshots Compare Test Runresults.