Repository navigation
[Android] Map: Recluster on a single zoom step - #37770
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37770Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37770" |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Hey there @@kevin68! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
Hey there @kevin68! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
36fa3be to
7221fcd
Compare
This comment has been minimized.
This comment has been minimized.
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 2 findings
See inline comments for details.
| // slack. | ||
| var currentZoom = _googleMap.CameraPosition.Zoom; | ||
| if (Math.Abs(currentZoom - _lastClusterZoom) > 1.0f) | ||
| if (Math.Abs(currentZoom - _lastClusterZoom) >= 0.999f) |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[moderate] Regression Prevention — This is a behavioral bug fix on a numeric boundary (delta of exactly 1.0f, and 1.0f minus one ulp across a binade boundary) with no accompanying test. The guard lives in the internal MapCallbackHandler.OnCameraIdle, which needs a live GoogleMap, so there is currently no seam to cover it: a single-level zoom step regressing back to "never reclusters" would not be caught by CI. Extracting the comparison into an internal static helper (e.g. internal static bool ShouldRecluster(float currentZoom, float lastClusterZoom)) would make the exact boundary cases (10f -> 11f, 10.3f -> 11.3f, 10f -> 10.5f, initial -1 seed) unit-testable without a device, and would pin the intended semantics of the new threshold.
There was a problem hiding this comment.
Done — the comparison is now MapHandler.ShouldRecluster(currentZoom, lastClusterZoom) in the shared handler, with a [Theory] in Controls/tests/Core.UnitTests/MapTests.cs covering the boundary: a one-level step in both directions (the case that regressed), a one-level step across a binade boundary (15.03f -> 16.03f), sub-level deltas that must not trigger a teardown (10f -> 10.5f, 10f -> 10.9f), and the -1 seed. Seven cases, all passing.
The seam already existed and I had missed it: MapTests.cs reaches MapHandler.GetClusterIconCacheKey through the InternalsVisibleTo("Microsoft.Maui.Controls.Core.UnitTests") in the Maps assembly, and the shared MapHandler.cs compiles for the same TFM the test project targets. So this cost two lines of production code rather than new infrastructure.
|
|
||
| // Recalculate clusters when zoom level changes significantly | ||
| // The zoom buttons and double-tap move by exactly one level, so a strict "> 1" never | ||
| // fires; and the delta can land ~2^-20 under 1.0f across a binade boundary, hence the |
There was a problem hiding this comment.
🔍 AI-Generated Review (multi-model)
[minor] Logic and Correctness — The comment justifies the slack by float error of "~2^-20 under 1.0f" (~9.5e-7), but the constant relaxes the threshold by 1e-3, about a thousand times that error. Concrete consequence: a pinch/fling that settles at a genuine 0.999-level zoom delta (not float noise) now also passes the gate and runs ReclusterPins(), which removes every marker in _markers, nulls the list, clears _clusterMarkers, and re-adds all pins via AddPins. That is a visible full marker teardown/rebuild for a sub-one-level zoom. If only float noise was meant to be absorbed, a tolerance closer to the cited error (e.g. 1.0f - 1e-4f) matches the stated reasoning; if triggering on near-one-level zooms is intentional, the comment should say so, since the constant currently reads as an epsilon but behaves as a policy change.
There was a problem hiding this comment.
Agreed, and tightened to 0.9999f.
You put it exactly right: the constant read as an epsilon and behaved as a policy change. Only float noise was meant to be absorbed. At 1e-4 the threshold still clears the worst real shortfall — 2^-20, about 9.5e-7, which happens only when the two zoom values straddle a binade boundary — with roughly a hundredfold margin, while narrowing the unintended widening from 1% of a zoom level to 0.01%. A genuine 0.999-level pinch no longer forces a full marker teardown and rebuild.
The constant and its reasoning now live next to ShouldRecluster in the shared handler, and the sub-level cases are pinned by the tests added for the other thread.
kubaflo
left a comment
There was a problem hiding this comment.
Could you please check the ai's suggestions?
7221fcd to
d3dbf85
Compare
|
Ran a before/after on device with a control build, logging every Method. Samsung SM-X230, Android 16 (API 36). Six presses of the Google Maps zoom buttons — three Control ( 2 reclusters for 6 presses. With this PR: 6 for 6, each logged delta exactly That is the reported symptom reproduced literally — a press does nothing, and the clusters only catch up on the next press, when the accumulated delta reaches 2 and clears the strict What the deltas say about the theoryEvery real delta on device is exactly Which leaves the binade fixture doing less than it looks.
Caveat on attribution. Measurements were taken with #37769 and #37774 also applied, since that is the intended landing order. The recluster counts are attributable to this PR alone — neither of the others touches One note on the ordering paragraph in the description: it credits #37769 with "a per-pin icon cache that skips the load — and therefore the await". That is #37774. Since reclustering now runs on every zoom step rather than every other one, #37774 is the one that keeps the extra passes from re-decoding every custom icon. |
This comment has been minimized.
This comment has been minimized.
`OnCameraIdle` only reclustered when the zoom had moved more than a full level away from the last clustering pass. The zoom buttons and double-tap - the ordinary way to zoom on Android - move by exactly one level, so a single press never crossed a strict `> 1.0f`. Clusters only updated after a second press, or after a pan nudged the zoom far enough past the boundary for the comparison to succeed, which reads as clustering being stuck. Make the comparison inclusive, with just enough tolerance for the one case where a full step lands short: 2^-20 under 1.0f, when the two zoom values straddle a binade boundary. The threshold stays an epsilon rather than becoming a policy change - a genuine sub-level zoom must not trigger a full marker teardown and rebuild. The comparison moves to `MapHandler.ShouldRecluster` in the shared handler so the boundary is unit-testable: `OnCameraIdle` itself needs a live `GoogleMap` and is out of reach of the test projects, which left nothing pinning `>` versus `>=`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The binade-boundary case did not discriminate. Math.Abs(16.03f - 15.03f) is 1.0000009537f, which the old strict "> 1.0f" already passed, so the fixture proved nothing about the epsilon it was named for - reverting ReclusterZoomStep to exactly 1.0f left all seven cases green. Swapped for 16.05f/15.05f, whose delta is 0.9999990463f - exactly 2^-20 short of a full level, and the worst shortfall over Google Maps' 1-22 zoom range. Added 10.9998f/10f (0.9997997284f) so the constant is pinned from below too and cannot drift from an epsilon into a sub-level recluster policy. Verified against real float semantics: 8/8 pass, and four cases now change answer between the old and new comparison. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
e7e5240 to
29967df
Compare
This comment has been minimized.
This comment has been minimized.
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@kevin68 — new AI review results are available based on commit
29967df.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ✅ PASSED
Platform: ANDROID · Base: net11.0 · Merge base: 5a7dc34e
✅ Verified (new API / feature) — this PR adds new API and a test that references it in the same project, so reverting the fix un-compiles the test: there is no valid "fails without the fix" baseline to establish (a compile-coupled baseline). The gate instead verified the fix by a clean build + pass with the fix, so this is a real PASS rather than a non-committal INCONCLUSIVE.
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
🧪 MapTests MapTests |
🛠️ BUILD ERROR | ✅ PASS — 32s |
🔴 Without fix — 🧪 MapTests: 🛠️ BUILD ERROR · 85s
Error-relevant lines (filtered from the build log):
/home/vsts/work/1/s/src/Controls/tests/Core.UnitTests/MapTests.cs(833,38): error CS0117: 'MapHandler' does not contain a definition for 'ShouldRecluster' [/home/vsts/work/1/s/src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj]
🟢 With fix — 🧪 MapTests: PASS ✅ · 32s
(no coded error found; showing last 1200 chars)
ms]
Passed MapClickedAndLongClickedCanCoexist [< 1 ms]
Passed MapLongClickedEventArgsContainsLocation [< 1 ms]
Passed LastUserLocation_UpdatedOnLocationUpdate [< 1 ms]
Passed HideInfoWindowDoesNotThrowWhenPinHasNoParent [< 1 ms]
Passed MapElementZIndexDefaultIsZero [< 1 ms]
Passed SettingSameClusterImageProviderMethodGroupDoesNotRebuildPins [< 1 ms]
Passed TracksRemove [3 ms]
Passed ItemMove [< 1 ms]
Passed IconCacheEvictsLeastRecentlyUsedEntry [5 ms]
Passed ClusterImageSourceInheritsBindingContext [< 1 ms]
Passed MoveToRegionRequestProperties [< 1 ms]
[xUnit.net 00:00:04.74] Finished: Microsoft.Maui.Controls.Core.UnitTests
Passed TracksAdd [< 1 ms]
Passed ClusterInfoConstructorThrowsOnNullArguments [< 1 ms]
Passed GetClusterImagePrefersProviderOverStatic [< 1 ms]
Passed ClusterImageSourceDefaultIsNull [< 1 ms]
Passed GetClusterImageFallsBackToStaticWhenProviderThrows [< 1 ms]
Passed MapLongClickedMultipleHandlersAllFire [< 1 ms]
Passed MapElementIsVisibleDefaultIsTrue [< 1 ms]
Passed TracksReplace [< 1 ms]
Passed LastUserLocation_IsNullByDefault [< 1 ms]
Test Run Successful.
Total tests: 108
Passed: 108
Total time: 5.7189 Seconds
⚠️ Failure Details
- 🛠️ MapTests without fix: build failed before tests could run
/home/vsts/work/1/s/src/Controls/tests/Core.UnitTests/MapTests.cs(833,38): error CS0117: 'MapHandler' does not contain a definition for 'ShouldRecluster' [/home/vsts/work/1/s/src/Controls/tests/Core.U...
📁 Fix files reverted (2 files)
src/Core/maps/src/Handlers/Map/MapHandler.Android.cssrc/Core/maps/src/Handlers/Map/MapHandler.cs
📋 Pre-Flight — Context & Validation
Issue: #37768 - [Android] Map: clusters do not recompute after a single zoom step
PR: #37770 - [Android] Map: Recluster on a single zoom step
Platform: Android
Base: net11.0 at merge base 5a7dc34eeed0e0c7d5ab838e1de606b3249f2922
Files Changed: 2 implementation, 1 unit-test
Problem and Reproduction
MapCallbackHandler.OnCameraIdle reclusters only when
Math.Abs(currentZoom - _lastClusterZoom) > 1.0f. Android's Google Maps zoom
buttons and double-tap move exactly one level, so one action does not recluster;
the next one produces an accumulated delta of two and catches up. The issue was
validated on Android API 30 and 36. Device instrumentation on a Samsung SM-X230
recorded exact 1.0f deltas and 2 reclusters for 6 button presses before the
fix, versus 6 for 6 with the PR.
Direct Diff Inspection
src/Core/maps/src/Handlers/Map/MapHandler.Android.csreplaces the strict
comparison withMapHandler.ShouldRecluster(currentZoom, _lastClusterZoom).src/Core/maps/src/Handlers/Map/MapHandler.csadds an internal helper using
an inclusive0.9999fthreshold. The tolerance covers subtraction error
across a float binade boundary without making ordinary sub-level zoom changes
trigger a complete marker teardown/rebuild.src/Controls/tests/Core.UnitTests/MapTests.csadds a theory covering exact
one-level changes in both directions, the worst in-range float shortfall,
meaningful sub-level changes, a value just below the threshold, and the
initial-1fseed.- Earlier review feedback requested a test seam and warned that the original
tolerance was too broad. The current revision addresses both with the helper,
focused theory, and a tightened0.9999fthreshold. - A PR discussion correction notes that #37774, not #37769, supplies the icon
cache that avoids repeated custom-icon decoding during the additional
recluster passes. This does not change the numeric boundary being fixed here.
Test Contract
Primary test:
dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj --filter "MapTests"The prior gate passed: the filtered run passed all 108 MapTests cases with the
PR fix. The no-fix side is compile-coupled because the retained PR test calls
MapHandler.ShouldRecluster; alternative candidates therefore must preserve
that internal helper signature while implementing a mechanism different from
the PR's fixed 0.9999f threshold.
Mandatory regression tests: None. Regression cross-reference result is
CLEAN (revert_count: 0, overlap_count: 0).
Do not rerun gate verification and do not modify
CustomAgentLogsTmp/PRState/37770/PRAgent/gate/content.md.
Try-Fix Boundaries
The baseline script's expected writable production-file allow-list is:
src/Core/maps/src/Handlers/Map/MapHandler.Android.cssrc/Core/maps/src/Handlers/Map/MapHandler.cs
The unit-test file remains in the PR state and is read-only for try-fix.
Unrelated pre-existing worktree changes must remain untouched. Each candidate
gets one test pass and at most one focused correction/retest, followed by the
mandatory script-only restore.
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #37770 | Inclusive fixed threshold (0.9999f) extracted to ShouldRecluster |
Gate PASS | MapHandler.Android.cs, MapHandler.cs |
Current submitted fix; alternatives must use a different mechanism |
STEP 5a Review Scope
No separate expert-review agent was launched. The dedicated expert comparison
is reserved for STEP 5b; each try-fix invocation performs only its required
inline self-review.
🔬 Code Review — Deep Analysis
Expert PR Evaluation
Verdict: LGTM
Confidence: medium
Inline findings: None (inline-findings.json contains []).
The Android reclustering guard now accepts a one-level zoom change while retaining a narrow tolerance for binary32 rounding near a binade boundary. The extracted MapHandler.ShouldRecluster helper preserves the existing null guards, seed behavior, and update ordering in OnCameraIdle; it does not alter public API or other platform handlers.
The tests cover positive and negative one-level movement, the worst relevant rounding-shortfall case, meaningful sub-level deltas, the lower side of the tolerance, both directions, and the -1 seed. The expert review found no concrete correctness, lifecycle, threading, cross-platform, performance, or regression issue. The 0.9999f margin is wider than the exact observed shortfall but remains bounded to 0.01% of a zoom level and is pinned by a negative boundary test.
🛠️ Try-Fix — Analysis & Comparison
Try-Fix Candidates for PR #37770
Platform: Android
Primary test: dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj --filter "MapTests"
Mandatory regression tests: None (CLEAN)
Candidate limit: 2
Aggregate Status After Candidate 2
| Candidate | Model | Approach | Result | Test | Diff |
|---|---|---|---|---|---|
| 1 | claude-opus-5 |
Compare discrete integer zoom buckets instead of a float delta threshold | Not run | Empty | |
| 2 | gpt-5.6-sol |
Compare each zoom directly with the other endpoint plus one level | Not run | Empty |
Candidate 1 — Discrete Zoom-Level Buckets
Model: claude-opus-5
Result:
Attempt artifacts: CustomAgentLogsTmp/PRState/37770/PRAgent/try-fix/attempt-1
Candidate narrative: CustomAgentLogsTmp/PRState/37770/PRAgent/try-fix-1/content.md
Approach
Quantize each zoom with (int)MathF.Floor(zoom) and recluster when the integer
levels differ, while retaining the internal
ShouldRecluster(float currentZoom, float lastClusterZoom) seam required by
the PR's tests.
The PR subtracts two floats and compares the magnitude against a fixed
0.9999f threshold. This candidate would not subtract or use a tolerance:
integer bucket inequality makes binade-boundary subtraction error irrelevant.
The candidate was designed but never applied.
Files Changed and Diff
No tracked files were modified.
Test Result
The required primary command was not run:
dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj --filter "MapTests"EstablishBrokenBaseline.ps1 stopped at its dirty-worktree fail-fast check
because unrelated pre-existing changes exist under .github/scripts,
.github/skills, and eng/scripts. It did not create
.github/.baseline-state.json, so there was no safe RevertedFiles allow-list
and the skill correctly stopped before editing. Running the test without an
applied candidate would only have retested the PR fix.
Failure Analysis and Self-Review
The result is blocked by the baseline harness precondition, not a candidate
test failure. Inline self-review recorded zero findings against the empty final
diff. The analysis also records a design risk that would require evaluation if
the approach were applied: flooring has no hysteresis near an integer boundary.
The exact required cleanup command ran:
pwsh .github/scripts/EstablishBrokenBaseline.ps1 -RestoreIt reported No baseline state found. Restored False, which is the accepted
no-state outcome because no candidate edit occurred. Unrelated worktree changes
and gate artifacts were left untouched.
Current Comparison
Candidate 1 provides a distinct mechanism but no empirical result. It cannot
outrank a tested candidate.
Candidate 2 — Symmetric Directional Endpoint Comparison
Model: gpt-5.6-sol
Result:
Attempt artifacts: CustomAgentLogsTmp/PRState/37770/PRAgent/try-fix/attempt-2
Candidate narrative: CustomAgentLogsTmp/PRState/37770/PRAgent/try-fix-2/content.md
Approach
Avoid subtracting zoom values by checking the endpoints in both directions:
recluster when the current zoom is at least lastClusterZoom + 1.0f, or the
last clustered zoom is at least currentZoom + 1.0f. The internal
ShouldRecluster(float currentZoom, float lastClusterZoom) seam remains
available to the retained tests.
This differs from the PR because it has no subtraction-derived magnitude and
no epsilon threshold. It differs from Candidate 1 because it preserves the
fractional zoom values and does not assign them to integer floor buckets.
Adding one level to an endpoint produces the expected adjacent representable
zoom value directly, avoiding the cancellation error exercised by
16.05f - 15.05f.
Files Changed and Diff
No tracked files were modified.
Test Result
The required primary command was not run:
dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj --filter "MapTests"As in Candidate 1, EstablishBrokenBaseline.ps1 rejected the unrelated
pre-existing worktree changes before creating .github/.baseline-state.json.
Without a RevertedFiles allow-list, applying the candidate would violate the
try-fix restoration boundary. Testing the untouched tree would only exercise
the submitted PR fix.
Failure Analysis and Self-Review
The result is Blocked rather than Pass or Fail because no implementation was
safely applied and no candidate test ran. Inline self-review recorded zero
findings against the empty final diff.
The exact required cleanup command ran:
pwsh .github/scripts/EstablishBrokenBaseline.ps1 -RestoreIt reported the expected no-state Restored False result. No manual cleanup
command was used; unrelated changes and gate artifacts remain untouched.
Final STEP 5a Comparison
| Rank | Candidate | Evidence | Disposition |
|---|---|---|---|
| 1 | PR #37770 fixed inclusive threshold | Gate passed all 108 filtered MapTests; physical-device evidence reports 6/6 reclusters |
Only empirically validated fix |
| 2 | Candidate 2 endpoint comparison | Distinct and compatible by inspection, but not applied or tested | Carry as an unvalidated alternative |
| 3 | Candidate 1 integer buckets | Distinct but untested; additionally has boundary-hysteresis risk | Carry only as a lower-confidence alternative |
Both bounded alternative attempts completed their artifact and script-only
restore workflows, but both were blocked by the same baseline precondition.
Neither can be called Pass, Fail, or preferred over the gate-validated PR.
STEP 5b should compare the submitted fix against these designs using the
recorded uncertainty; it must not infer empirical success for either candidate.
📝 PR Finalize — Recommended Title & Description
Assessment: ✏️ Recommend updating — the title is accurate, but the dependency note incorrectly attributes the custom-icon cache to #37769 instead of #37774.
Recommended title
[Android] Map: Recluster on a single zoom step
Recommended description
Fixes #37768
### Description of Change
`MapCallbackHandler.OnCameraIdle` only reclustered when the zoom had moved **more than** a full level away from the last clustering pass:
```csharp
if (Math.Abs(currentZoom - _lastClusterZoom) > 1.0f)
```
The Google Maps zoom buttons and double-tap - the ordinary way to zoom on Android - move by exactly one level, so a single press never crossed a strict `> 1.0f`. Clusters only updated after a second press, or after a pan nudged the zoom far enough past the boundary for the comparison to succeed, which reads as clustering being stuck.
Make the comparison inclusive, with just enough tolerance for the one case where a full step lands short: `2^-20` under `1.0f`, when the two zoom values straddle a binade boundary. The threshold is `0.9999f` - about a hundredfold margin on that error, while widening the trigger band by 0.01% of a zoom level rather than 1%. It stays an epsilon rather than becoming a policy change: a genuine sub-level zoom must not trigger a full marker teardown and rebuild.
The comparison moves to `MapHandler.ShouldRecluster` in the shared handler so the boundary is unit-testable - `OnCameraIdle` itself needs a live `GoogleMap` and is out of reach of the test projects, which left nothing pinning `>` against `>=`. `Controls/tests/Core.UnitTests/MapTests.cs` now covers a one-level step in both directions, a one-level step across a binade boundary, sub-level deltas that must not trigger, and the `-1` seed.
### Dependency note
Reclustering now runs on every zoom step rather than every other one. The custom-icon cache from #37774 skips the image load - and therefore the await before `Map.AddMarker` - for an unchanged source, avoiding flicker while pins are rebuilt. The submitted PR base already includes #37774.
### Verification
On a physical device (Samsung SM-X230, Android 15) with 80 clustered pins: before the change, logged reclustering fired at zoom 10.72, 12.72 and 14.72 and never in between; after it, a single `-` press visibly merges the clusters.
### Issues Fixed
Fixes #37768
🏁 Report — Final Recommendation
✅ Final Recommendation: APPROVE
Winner: pr
The submitted PR is the only distinct implementation with empirical evidence: the trusted Gate passed all 108 filtered MapTests, including fail-without-fix/pass-with-fix verification, and the recorded Android device run reclustered on all 6 of 6 single zoom steps. The expert review found no blocking errors, discussion items, or actionable inline findings.
Comparative Ranking
| Rank | Candidate | Implementation | Validation | Assessment |
|---|---|---|---|---|
| 1 | pr |
Inclusive 0.9999f delta threshold extracted to MapHandler.ShouldRecluster |
Gate PASS; 108 filtered tests passed; physical-device behavior confirmed | Winner. Correctly fixes exact one-level changes, covers the relevant float shortfall, and preserves meaningful sub-level suppression. |
| 2 | pr-plus-reviewer |
Code-identical to pr; reviewer.patch is empty |
No rerun by contract; inherits the PR evidence because there is no code delta | Equally safe but adds no reviewer improvement, so it is not a distinct better candidate. |
| 3 | try-fix-2 |
Proposed symmetric endpoint-plus-one comparison | BLOCKED; no implementation diff and no test run | Plausible by inspection and avoids subtraction tolerance, but it has no empirical evidence and cannot outrank the passing PR. |
| 4 | try-fix-1 |
Proposed integer zoom-bucket comparison | BLOCKED; no implementation diff and no test run | Unvalidated and introduces boundary-crossing churn for tiny movements around an integer zoom boundary. |
Expert Assessment
MapCallbackHandler.OnCameraIdle retains its existing null guards and only updates _lastClusterZoom when reclustering occurs. The helper preserves the initial -1f seed behavior, remains internal, creates no public API change, and affects only the Android call site. Tests pin exact movement in both directions, the worst relevant binary32 shortfall, ordinary sub-level movement, a value immediately below the chosen threshold, and the seed path.
No mandatory regression tests were identified (CLEAN), and neither try-fix candidate failed a regression test; both were blocked before code or tests existed. Their uncertainty is therefore recorded rather than treated as a failure, but the tested PR still ranks above them.
Decision
Approve the raw submitted fix. pr-plus-reviewer contains no additional source change, and replacing the submitted implementation with either blocked try-fix design would discard the strongest available evidence without establishing a correctness or maintainability benefit.
📱 UI Tests — Button,Label,Layout
Detected UI test categories: Button,Label,Layout
✅ Deep UI tests — 360 passed, 0 failed, 7 skipped across 3 categories on platform-pool agent (replaces in-process counts above).
🧪 UI Test Execution Results (deep, platform pool)
| Category | Tests | Snapshot diffs |
|---|---|---|
Button |
71/73 (2 skipped) ✓ | — |
Label |
97/99 (2 skipped) ✓ | — |
Layout |
192/195 (3 skipped) ✓ | — |
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs) |
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
Fixes #37768
Description of Change
MapCallbackHandler.OnCameraIdleonly reclustered when the zoom had moved more than a full level away from the last clustering pass:The Google Maps zoom buttons and double-tap - the ordinary way to zoom on Android - move by exactly one level, so a single press never crossed a strict
> 1.0f. Clusters only updated after a second press, or after a pan nudged the zoom far enough past the boundary for the comparison to succeed, which reads as clustering being stuck.Make the comparison inclusive, with just enough tolerance for the one case where a full step lands short:
2^-20under1.0f, when the two zoom values straddle a binade boundary. The threshold is0.9999f- about a hundredfold margin on that error, while widening the trigger band by 0.01% of a zoom level rather than 1%. It stays an epsilon rather than becoming a policy change: a genuine sub-level zoom must not trigger a full marker teardown and rebuild.The comparison moves to
MapHandler.ShouldReclusterin the shared handler so the boundary is unit-testable -OnCameraIdleitself needs a liveGoogleMapand is out of reach of the test projects, which left nothing pinning>against>=.Controls/tests/Core.UnitTests/MapTests.csnow covers a one-level step in both directions, a one-level step across a binade boundary, sub-level deltas that must not trigger, and the-1seed.Note on ordering
Worth merging after #37769. Reclustering now runs on every zoom step rather than every other one, and until #37769 lands
AddPinAsyncawaits the image load beforeMap.AddMarker, so pins with a customImageSourceare absent from the map until their image resolves. #37769 adds a per-pin icon cache that skips the load - and therefore the await - for an unchanged source, which removes that flicker.Verification
On a physical device (Samsung SM-X230, Android 15) with 80 clustered pins: before the change, logged reclustering fired at zoom 10.72, 12.72 and 14.72 and never in between; after it, a single
-press visibly merges the clusters.Issues Fixed
Fixes #37768