Skip to content

fix(ci): Align Android Skia shard 0 test group count - #24003

Merged
MartinZikmund merged 2 commits into
feature/breakingchangesfrom
dev/mazi/android-shard-count
Aug 31, 2026
Merged

MartinZikmund merged 2 commits into
feature/breakingchangesfrom
dev/mazi/android-shard-count

Conversation

@MartinZikmund

Copy link
Copy Markdown
Member

GitHub Issue: closes #24002

PR Type:

🏗️ Build or CI related changes

What changed? 🚀

Shard 0 of the Android Skia and Android+CoreCLR Skia runtime-test matrices declared a different shard count than the other four shards:

file Runtime Tests 0 Runtime Tests 1–4
.azure-devops-tests-android-skia.yml GROUP_COUNT: 4 GROUP_COUNT: 5
.azure-devops-tests-android-coreclr-skia.yml GROUP_COUNT: 4 GROUP_COUNT: 5

Both are changed to 5. That is the whole diff — two characters.

Why it matters

Test selection is a stable hash modulo the declared count (UnitTestsControl.cs:1415):

where groupCount == -1 || (groupCount != -1 && (GetTypeTestGroup(test) % (ulong)groupCount) == (ulong)activeGroup)

So shard 0 selected hash % 4 == 0 while shards 1–4 selected hash % 5 == 1..4. The five shards therefore did not form a partition of the suite — tests with hash % 5 == 0 && hash % 4 != 0 were selected by nobody, and tests with hash % 4 == 0 && hash % 5 != 0 ran twice.

Measured by replicating the exact partition function (BitConverter.ToUInt64(SHA1(DeclaringType.FullName + "." + method.Name), 0)) over the 4 543 [TestMethod]s currently in Uno.UI.RuntimeTests:

before after
Tests executed by no shard 669 (14.73 %) 0
Tests executed by two shards 921 (20.27 %) 0
Total test executions per run 4 795 4 543
Shard 0 workload 1 152 tests 900 tests
Shard sizes (0…4) 1152 / 850 / 983 / 911 / 899 900 / 850 / 983 / 911 / 899

Examples of test methods that no Android Skia shard was running:

Microsoft.UI.Tests.Controls.DatePickerTests.DatePickerIntegrationTests.CanChooseDate
Microsoft.UI.Xaml.Tests.Controls.Grid_Tests.GridIntegrationTests.CanLayoutWithColumnSpan
Microsoft.UI.Xaml.Tests.Enterprise.CalendarDatePickerTests.CalendarDatePickerIntegrationTests.CanOpenCloseFlyoutBySettingIsCalendarOpen

The in-app consistency self-check (UnitTestsControl.cs:1374-1389) could not catch this: it iterates 0 .. _ciTestsGroupCountCache using the job's own count, so shard 0 validated a self-consistent 4-way split and never observed the other jobs' 5-way split.

⚠️ Expect the Android Skia stage to get redder before it gets greener

669 tests that have never run on these stages will start running. Any failures they surface are pre-existing and were simply invisible — they are the true baseline, not a regression from this PR. They may need triage or [PlatformCondition] exclusions in follow-up PRs.

Shard 0 should get meaningfully faster (1 152 → 900 tests, −22 %), which should also reduce its share of 45-minute job timeouts.

Scope

I audited every shard matrix in build/ci/tests/ — these two files were the only inconsistent ones:

stage shards declared count status
Android Skia 5 4 → 5 fixed here
Android+CoreCLR Skia 5 4 → 5 fixed here
Android+NativeAOT Skia 5 5 already correct
Android Native 5 5 already correct
WebAssembly Skia 4 4 already correct
WebAssembly Native 3 3 already correct
iOS Skia 4 4 (param) already correct
iOS Native 8 8 (param) already correct

The same defect is present on feature/breakingchanges (in .azure-devops-tests-android-skia.yml; the CoreCLR stage was removed there by #23964). Targeting master so it propagates through the normal master → feature/breakingchanges sync.

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample (for bug fixes / features, if applicable) — N/A, CI configuration change; validated by replicating the partition function over the real test-method set (numbers above)
  • 📚 Docs have been added/updated following the documentation template (for bug fixes / features) — N/A, no user-facing behaviour change
  • 🖼️ Validated PR Screenshots Compare Test Run results.
  • ❗ Contains NO breaking changes
  • 👀 Reviewed 2 other open pull requests (optional but appreciated!)

Copilot AI lite review requested due to automatic review settings August 7, 2026 12:41
@github-actions github-actions Bot added the area/build Categorizes an issue or PR as relevant to build infrastructure label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 58s —— View job


Review complete

  • Gather context
  • Read changed files
  • Verify fix correctness
  • Post review summary

Summary

Verdict: ✅ LGTM — ship it.

The two-character fix is correct and the PR description provides an exemplary analysis of the root cause and impact.

Verification:

  • Both changed files now have UITEST_RUNTIME_TEST_GROUP_COUNT: 5 uniformly across all five shards (lines 31/40/49/58/67 in android-skia, lines 32/41/50/59/68 in android-coreclr-skia).
  • I audited all other files under build/ci/tests/ independently and confirmed the completeness claim: every other matrix (NativeAOT, Native, WASM Skia, WASM Native, iOS Skia, iOS Native) already uses a consistent count per file, or routes through a single parameterized variable that is set once.
  • The partition-correctness argument (hash % count == group) is sound: with all five shards declaring count=5, the groups 0–4 are exactly {h % 5 == 0} through {h % 5 == 4} — a proper partition.

No findings. No inline comments needed.

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

Aligns the runtime-test sharding configuration for Android Skia CI so that shard 0 uses the same UITEST_RUNTIME_TEST_GROUP_COUNT as shards 1–4, restoring a correct partition of the runtime test suite across the 5-job matrix.

Changes:

  • Update UITEST_RUNTIME_TEST_GROUP_COUNT from 4 to 5 for Runtime Tests 0 in the Android Skia pipeline.
  • Update UITEST_RUNTIME_TEST_GROUP_COUNT from 4 to 5 for Runtime Tests 0 in the Android+CoreCLR Skia pipeline.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
build/ci/tests/.azure-devops-tests-android-skia.yml Makes shard 0’s declared test group count consistent with shards 1–4 (5-way split).
build/ci/tests/.azure-devops-tests-android-coreclr-skia.yml Same alignment for the CoreCLR Skia matrix shard 0 (5-way split).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 226383 has failed on Uno.UI - CI.

@Xiaoy312 Xiaoy312 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.

nice catch

Copilot AI review requested due to automatic review settings August 22, 2026 09:47
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/android-shard-count branch from 91becd1 to 6bf0986 Compare August 22, 2026 09:47
@github-actions

github-actions Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

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


Review complete

  • Gather context
  • Read changed files
  • Verify fix correctness
  • Post review summary

Summary

Verdict: ✅ LGTM — ship it.

The second commit ("test: Exclude the collectible-ALC prune test on Android") is a correct and well-reasoned follow-up to the shard-count fix.

Verification of the new commit:

  • Given_WindowCollectibleEventPrune.cs adds RuntimeTestPlatforms.SkiaAndroid to the [PlatformCondition(ConditionMode.Exclude, …)] attribute — the correct mechanism per project conventions (attribute-based skip, not #if wrapping the method).
  • The comment is updated accurately: Android Skia uses the same non-deterministic/conservative GC as WASM and UIKit targets, so the GC-reclaim assertion is equally unreliable there.
  • Excluding this test preemptively is the right call: the shard-count fix causes 669 previously-invisible tests to start running on Android Skia; this one test has a GC-timing dependency that would produce flaky results on that target.
  • Style, naming (When_<Scenario> method, Given_<Subject> class), and attribute usage all conform to runtime-tests.md conventions.

No findings. No inline comments needed.

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

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

@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund
MartinZikmund changed the base branch from master to feature/breakingchanges August 22, 2026 14:57
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/android-shard-count branch from 6bf0986 to 6672ba1 Compare August 22, 2026 14:57
@github-actions

github-actions Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

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


Review complete

  • Gather context
  • Read changed files
  • Verify fix correctness
  • Post inline comments (1 minor finding)
  • Post review summary

Summary

Verdict: ✅ LGTM — 1 minor comment

CI shard fix (build/ci/tests/.azure-devops-tests-android-skia.yml): Correct. Changing UITEST_RUNTIME_TEST_GROUP_COUNT from 4 to 5 for shard 0 restores a proper 5-way partition. The partition-correctness math in the PR description is sound and matches UnitTestsControl.cs:1415. The CoreCLR variant file is absent on feature/breakingchanges (removed by #23964), so only the one YAML needed updating here — scope is right.

Test exclusion (Given_WindowCollectibleEventPrune.cs): The exclusion of SkiaAndroid is correct. SkiaAndroid uses Mono's conservative GC, the same as SkiaWasm and SkiaUIKit — the GC.Collect() loop assertion is equally unreliable there. Attribute usage, method naming, and class structure all conform to runtime-tests.md conventions.

1 minor finding — inline comment posted:

  • Comment precision (low severity): The updated comment text "mobile and browser runtimes" is broader than the actual exclusion (SkiaWasm | SkiaUIKit | SkiaAndroid). It omits the Mono-GC rationale from the original ("WASM and UIKit (Mono)") and implies native mobile/browser are also excluded, when they aren't (those targets self-skip via Assert.Inconclusive for a different reason — no Reflection.Emit support). Suggested restoring platform-specific names and the Mono-GC reason.

No issues with the CI fix itself. No breaking changes, no style violations, no test coverage gaps.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 229534 found UI Test snapshots differences: skia-linux-screenshots: 73, skia-windows-screenshots: 165

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

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ContentControl_Inheritance.png
    • ContextRequested.png-dark
    • Examples.png
    • ImageBrush_Stretch.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • DropDownButtonPage.png-dark
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Focus_FocusVisual_Properties.png-dark
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • Image_Margin_Large.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
  • skia-windows-screenshots: 165 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DisplayInformation.png-dark
    • Dopes.png-dark
    • EllipsemaskingEllipseGrid.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • BitmapImage_vs_SvgImageSource.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • FixedWidthUniform.png-dark
    • ImageSourceUrlMsAppDataScheme.png-dark
    • ImageSourceUrlMsAppDataScheme.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ExpanderColorValidationPage.png-dark
    • GetFocus.png-dark
    • GetFocus.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ImageIconPage.png-dark

MartinZikmund and others added 2 commits August 29, 2026 12:11
Shard 0 of the Android Skia and Android+CoreCLR Skia runtime test
matrices declared UITEST_RUNTIME_TEST_GROUP_COUNT: 4 while shards 1-4
declared 5. Test selection is a stable hash modulo that count, so the
five shards did not form a partition: 669 of 4543 test methods (14.7%)
were selected by no shard, and 921 (20.3%) ran twice.

Shard 0 also carried 1152 tests instead of 900, making it the slowest
shard and the most likely to hit the 45-minute job timeout.

fixes #24002

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01RgHbZ4EHYrK6uTkPTtKbq8
Closing the shard-0 grouping gap makes this test run on Android Skia for
the first time, where the Mono GC does not reliably reclaim the target.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YYhzD23aqdv2NddkzkiGKN
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/android-shard-count branch from 6672ba1 to f489cf8 Compare August 29, 2026 10:11
@github-actions

github-actions Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 230995 found UI Test snapshots differences: skia-linux-screenshots: 73, skia-windows-screenshots: 231

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

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Attributed_text_FontSize_Changing.png
    • CalendarView_Theming.png-dark
    • DropDownButtonPage.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • Examples.png
    • ImageBrush_Stretch.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • Buttons.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • DynamicFont.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • Gamepad_CurrentReading.png-dark
    • ContentControl_Inheritance.png
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
  • skia-windows-screenshots: 231 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Attributed_text_FontSize_Changing.png
    • Battery.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • Clipping652.png-dark
    • Clipping652.png
    • EmailManagerTests.png-dark
    • EmailManagerTests.png
    • GetFocus.png-dark
    • GetFocus.png
    • Hyperlink_Disabled.png-dark
    • Hyperlink_Disabled.png
    • ImageAlignment2541.png-dark
    • ImageAlignment2541.png
    • EllipseAlignment2542_2547.png-dark
    • EllipseAlignment2542_2547.png
    • ImageSourceUrlMsAppDataScheme.png-dark
    • ImageSourceUrlMsAppDataScheme.png
    • ElementLevelTheme.png-dark

@MartinZikmund
MartinZikmund merged commit 005db43 into feature/breakingchanges Aug 31, 2026
52 of 53 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/android-shard-count branch August 31, 2026 07:51
MartinZikmund added a commit that referenced this pull request Sep 1, 2026
The ms-appdata load intermittently never completes on the Android Skia
runtime-test host: the test starts, then 30 seconds of total silence
follow with no ImageOpened, no ImageFailed and no exception, until the
inner WaitAsync trips. That is the same signature already tracked for
the Linux hosts in #23967, which the existing exclusion covers.

#24215 already excluded SkiaAndroid for this test, but gated behind
RUNTIME_NATIVE_AOT while investigating #24271. The hang is not specific
to NativeAOT -- it reproduces on the plain Android Skia leg -- so the
exclusion is un-gated here rather than duplicated, and #24271 is kept
in the comment.

The test only began running on Android at all once #24003 aligned shard
0's UITEST_RUNTIME_TEST_GROUP_COUNT (4 -> 5, 005db43): selection is
a stable hash modulo that count, so before the fix When_MsAppData was
one of the 14.7% of methods no shard selected. It is not a new failure,
just a newly executed one.

Since that merge it has failed on three unrelated PR builds within
hours of each other -- 231145 (#24186), 231142 (#24194) and 231152
(#19083) -- where the isolated retry only sometimes recovers, so it
reddens whichever PR happens to be unlucky. master still carries the
old count of 4 and therefore never runs it.

Scoped to this test alone: When_MsAppData_StreamDisposed_FileNotLocked
and When_Exif_Rotated_MsAppData use the same ms-appdata path and run
green on Android in every post-fix build checked, so they keep running.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015Lk1RUZfAj6A7xGWzYaoBw
@github-actions github-actions Bot mentioned this pull request Sep 1, 2026
4 of 5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android Skia CI shards miss 15% of runtime tests (shard 0 declares GROUP_COUNT 4, shards 1-4 declare 5)

5 participants