[Android] Fix SafeAreaShouldWorkOnAllShellTabs test failure on API 36#34239
[Android] Fix SafeAreaShouldWorkOnAllShellTabs test failure on API 36#34239praveenkumarkarunanithi wants to merge 9 commits intodotnet:inflight/currentfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes Android safe-area padding instability during Shell tab transition animations (notably impacting the SafeAreaShouldWorkOnAllShellTabs UI test on API 36) by preserving raw view position signals used to detect in-progress animations.
Changes:
- Computes horizontal/vertical “view is animating” state using raw on-screen coordinates before margin clamping occurs.
- Reorders left/right edge logic to evaluate animation state before overlap-based partial inset reduction.
- Renames animation flags for clarity (
viewIsAnimatingHorizontally,viewIsAnimatingVertically).
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34239Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34239" |
…otnet#34548) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Adds a [gh-aw (GitHub Agentic Workflows)](https://github.github.com/gh-aw/introduction/overview/) workflow that automatically evaluates test quality on PRs using the `evaluate-pr-tests` skill. ### What it does When a PR adds or modifies test files, this workflow: 1. **Checks out the PR branch** (including fork PRs) in a pre-agent step 2. **Runs the `evaluate-pr-tests` skill** via Copilot CLI in a sandboxed container 3. **Posts the evaluation report** as a PR comment using gh-aw safe-outputs ### Triggers | Trigger | When | Fork PR support | |---------|------|-----------------| | `pull_request` | Automatic on test file changes (`src/**/tests/**`) | ❌ Blocked by `pre_activation` gate | | `workflow_dispatch` | Manual — enter PR number | ✅ Works for all PRs | | `issue_comment` (`/evaluate-tests`) | Comment on PR |⚠️ Same-repo only (see Known Limitations) | ### Security model | Layer | Implementation | |-------|---------------| | **gh-aw sandbox** | Agent runs in container with scrubbed credentials, network firewall | | **Safe outputs** | Max 1 PR comment per run, content-limited | | **Checkout without execution** | `steps:` checks out PR code but never executes workspace scripts | | **Base branch restoration** | `.github/skills/`, `.github/instructions/`, `.github/copilot-instructions.md` restored from base branch after checkout | | **Fork PR activation gate** | `pull_request` events blocked for forks via `head.repo.id == repository_id` | | **Pinned actions** | SHA-pinned `actions/checkout`, `actions/github-script`, etc. | | **Minimal permissions** | Each job declares only what it needs | | **Concurrency** | One evaluation per PR, cancels in-progress | | **Threat detection** | gh-aw built-in threat detection analyzes agent output | ### Files added/modified - `.github/workflows/copilot-evaluate-tests.md` — gh-aw workflow source - `.github/workflows/copilot-evaluate-tests.lock.yml` — Compiled workflow (auto-generated by `gh aw compile`) - `.github/skills/evaluate-pr-tests/scripts/Gather-TestContext.ps1` — Test context gathering script (binary-safe file download, path traversal protection) - `.github/instructions/gh-aw-workflows.instructions.md` — Copilot instructions for gh-aw development ### Known Limitations **Fork PR evaluation via `/evaluate-tests` comment is not supported in v1.** The gh-aw platform inserts a `checkout_pr_branch.cjs` step after all user steps, which may overwrite base-branch skill files restored for fork PRs. This is a known gh-aw platform limitation — user steps always run before platform-generated steps, with no way to insert steps after. **Workaround:** Use `workflow_dispatch` (Actions UI → "Run workflow" → enter PR number) to evaluate fork PRs. This trigger bypasses the platform checkout step entirely and works correctly. **Related upstream issues:** - [github/gh-aw#18481](github/gh-aw#18481) — "Using gh-aw in forks of repositories" - [github/gh-aw#18518](github/gh-aw#18518) — Fork detection and warning in `gh aw init` - [github/gh-aw#18520](github/gh-aw#18520) — Fork context hint in failure messages - [github/gh-aw#18521](github/gh-aw#18521) — Fork support documentation ### Fixes - Fixes dotnet#34602 --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
## Summary Enables the copilot-evaluate-tests gh-aw workflow to run on fork PRs by adding `forks: ["*"]` to the `pull_request` trigger and removing the fork guard from `Checkout-GhAwPr.ps1`. ## Changes 1. **copilot-evaluate-tests.md**: Added `forks: ["*"]` to opt out of gh-aw auto-injected fork activation guard. Scoped `Checkout-GhAwPr.ps1` step to `workflow_dispatch` only (redundant for other triggers since platform handles checkout). 2. **copilot-evaluate-tests.lock.yml**: Recompiled via `gh aw compile` — fork guard removed from activation `if:` conditions. 3. **Checkout-GhAwPr.ps1**: Removed the `isCrossRepository` fork guard. Updated header docs and restore comments to accurately describe behavior for all trigger×fork combinations (including corrected step ordering). 4. **gh-aw-workflows.instructions.md**: Updated all stale references to the removed fork guard. Documented `forks: ["*"]` opt-in, clarified residual risk model for fork PRs, and updated troubleshooting table. ## Security Model Fork PRs are safe because: - Agent runs in **sandboxed container** with all credentials scrubbed - Output limited to **1 comment** via `safe-outputs: add-comment: max: 1` - Agent **prompt comes from base branch** (`runtime-import`) — forks cannot alter instructions - Pre-flight check catches missing `SKILL.md` if fork isn't rebased on `main` - No workspace code is executed with `GITHUB_TOKEN` (checkout without execution) ## Testing - ✅ `workflow_dispatch` tested against fork PR dotnet#34621 - ✅ Lock.yml statically verified — fork guard removed from `if:` conditions - ⏳ `pull_request` trigger on fork PRs can only be verified post-merge (GitHub Actions reads lock.yml from default branch) --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🚦 Gate - Test Before and After Fix📊 Expand Full Gate —
|
…taType is compiled (dotnet#34717) ## Description Adds regression tests for dotnet#34713 verifying the XAML source generator correctly handles bindings with `Converter={StaticResource ...}` inside `x:DataType` scopes. Closes dotnet#34713 ## Investigation After thorough investigation of the source generator pipeline (`KnownMarkups.cs`, `CompiledBindingMarkup.cs`, `NodeSGExtensions.cs`): ### When converter IS in page resources (compile-time resolution ✅) `GetResourceNode()` walks the XAML tree, finds the converter resource, and `ProvideValueForStaticResourceExtension` returns the variable directly — **no runtime `ProvideValue` call**. The converter is referenced at compile time. ### When converter is NOT in page resources (runtime resolution ✅) `GetResourceNode()` returns null → falls through to `IsValueProvider` → generates `StaticResourceExtension.ProvideValue(serviceProvider)`. The `SimpleValueTargetProvider` provides the full parent chain, and `TryGetApplicationLevelResource` checks `Application.Current.Resources`. The binding IS still compiled into a `TypedBinding` — only the converter resolution is deferred. ### Verified on both `main` and `net11.0` All tests pass on both branches. ## Tests added | Test | What it verifies | |------|-----------------| | `SourceGenResolvesConverterAtCompileTime_ImplicitResources` | Converter in implicit `<Resources>` → compile-time resolution, no `ProvideValue` | | `SourceGenResolvesConverterAtCompileTime_ExplicitResourceDictionary` | Converter in explicit `<ResourceDictionary>` → compile-time resolution, no `ProvideValue` | | `SourceGenCompilesBindingWithConverterToTypedBinding` | Converter NOT in page resources → still compiled to `TypedBinding`, no raw `Binding` fallback | | `BindingWithConverterFromAppResourcesWorksCorrectly` × 3 | Runtime behavior correct for all inflators (Runtime, XamlC, SourceGen) | Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🤖 AI Summary📊 Expand Full Review —
|
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #34239 | Move viewIsAnimatingHorizontally detection before Math.Max(0, ...) margin clamping; reorder left/right edge animation checks before overlap checks; rename flags for clarity |
⏳ PENDING (Gate skipped — no new tests in PR) | SafeAreaExtensions.cs |
Original PR; prior agent review requested changes |
🔧 Fix — Analysis & Comparison
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| 1 | try-fix (claude-opus-4.6) | Early short-circuit: detect animation from raw coords before any margin adjustment; keep full safe area for ALL edges when animating; skip per-edge overlap calc entirely | ✅ PASS | SafeAreaExtensions.cs |
Two code paths (animating vs settled); most structural change |
| 2 | try-fix (claude-sonnet-4.6) | Geometric settled-position projection: remove Math.Max(0,...) clamp; project off-screen coords to settled position (checkLeft, checkRight); no animation booleans |
✅ PASS | SafeAreaExtensions.cs |
Elegant but subtle; removes animation flag documentation |
| 3 | try-fix (gpt-5.3-codex) | Deferred margin adjustment: keep raw coordinates immutable; apply margins inline within each edge overlap calculation | ✅ PASS | SafeAreaExtensions.cs |
Good principle; inline margin math reduces readability |
| 4 | try-fix (gpt-5.4) | Raw-coordinate snapshot: capture rawViewLeft/rawViewRight BEFORE Math.Max(0,...) mutation; use raw values for animation detection; keep existing clamping and overlap flow |
✅ PASS | SafeAreaExtensions.cs |
Most minimal; nearly identical to PR approach |
| PR | PR #34239 | Move viewIsAnimatingHorizontally detection before Math.Max margin clamping; use viewLeft < 0 || viewRight > screenWidth; reorder left/right edge checks — animation first, then overlap |
⏳ PENDING (Gate skipped) | SafeAreaExtensions.cs |
Well-commented; conceptually clean; targeted |
Cross-Pollination
| Model | Round | New Ideas? | Details |
|---|---|---|---|
| claude-opus-4.6 | 2 | No | "NO NEW IDEAS — five approaches cover the viable solution space across all design axes" |
Exhausted: Yes
Selected Fix: PR #34239's fix — All 4 independent attempts converge on the same root cause. The PR's approach mirrors Attempt 4 (raw snapshot) and adds conceptually cleaner reordering of animation-check-before-overlap for left/right edges. Most readable, well-commented, and matches codebase style. Single file, +47/-44 lines.
📋 Report — Final Recommendation
✅ Final Recommendation: APPROVE
Phase Status
| Phase | Status | Notes |
|---|---|---|
| Pre-Flight | ✅ COMPLETE | Issue #33034, Android landscape safe area regression |
| Gate | No new tests added in this PR; existing test Issue33034.SafeAreaShouldWorkOnAllShellTabs already covers the scenario |
|
| Try-Fix | ✅ COMPLETE | 4 attempts, 4 passing; cross-pollination exhausted |
| Report | ✅ COMPLETE |
Summary
PR #34239 fixes a safe area padding regression on Android API 36 when switching Shell tabs in landscape mode with a display cutout. The fix is logically sound — all 4 independent try-fix models converged on the same root cause understanding and each produced a passing alternative, confirming the PR author's diagnosis is correct. The PR's chosen approach is the cleanest and best-documented of the five solutions.
Root Cause
Math.Max(0, viewLeft - margins) in ApplyAdjustedSafeAreaInsetsPx was being applied before the animation state detection. When a view was mid-animation with viewLeft = -1 (just off-screen left), the clamp set viewLeft = 0, making viewIsAnimatingHorizontally impossible to detect — the view was then treated as settled and safe area padding was reduced too early, causing a visible padding jump on tab switch.
Fix Quality
Correct and well-targeted. The PR:
- Moves
viewIsAnimatingHorizontally = viewLeft < 0 || viewRight > screenWidthdetection before theMath.Max(0, ...)clamp — preserving animation signals from raw position values ✅ - Renames
viewIsAnimating→viewIsAnimatingVertically/viewIsAnimatingHorizontally— clarity improvement ✅ - Reorders left/right edge checks to evaluate animation before overlap — prevents partial-inset application near end of animation ✅
- Addressed prior review feedback (typo "hasn't happen yet" → "hasn't happened yet" fixed) ✅
Logic verified: When viewLeft < 0 → clamped to 0 → viewIsAnimatingHorizontally && viewLeft > 0 = false → falls to viewLeft < left (0 < left) → Math.Min(left - 0, left) = left — full inset preserved correctly.
One minor observation: The right-edge animation guard (if (right > 0 && viewIsAnimatingHorizontally)) fires even when only viewLeft < 0 triggered the flag (view off-screen left). This is acceptable: the view is about to settle at X=0 where viewRight ≈ screenWidth, so applying the full right inset during animation is correct behavior.
No new tests added — the existing SafeAreaShouldWorkOnAllShellTabs test (Issue33034.cs) covers the regression. Authors validated it locally on API 36. CI should run this test to confirm.
Selected Fix: PR
kubaflo
left a comment
There was a problem hiding this comment.
Could you please review the AI's summary?
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Adds arcade inter-branch merge workflow and configuration to automate merging `net11.0` into the `release/11.0.1xx-preview3` branch. ### Files added | File | Purpose | |------|---------| | `github-merge-flow-release-11.jsonc` | Merge flow config — source `net11.0`, target `release/11.0.1xx-preview3` | | `.github/workflows/merge-net11-to-release.yml` | GitHub Actions workflow — triggers on push to net11.0, daily cron, manual dispatch | ### How it works Uses the shared [dotnet/arcade inter-branch merge infrastructure](https://github.com/dotnet/arcade/blob/main/.github/workflows/inter-branch-merge-base.yml): - **Event-driven**: triggers on push to `net11.0`, with daily cron safety net - **ResetToTargetPaths**: auto-resets `global.json`, `NuGet.config`, `eng/Version.Details.xml`, `eng/Versions.props`, `eng/common/*` to target branch versions - **QuietComments**: reduces GitHub notification noise - Skips PRs when only Maestro bot commits exist ### Incrementing for future releases When cutting a new release (e.g., preview4), update: 1. `github-merge-flow-release-11.jsonc` → change `MergeToBranch` value 2. `.github/workflows/merge-net11-to-release.yml` → update workflow `name` field Follows the same pattern as `merge-main-to-net11.yml` / `github-merge-flow-net11.jsonc`. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The AI-suggested parent-walk approach was implemented and tested locally on an API 36 emulator — it does not fix the issue. The gate failure is due to CI not supporting API 36; |
Root Cause
During Shell tab navigation animations, views move from off-screen into their final positions (for example,
viewLeft < 0during horizontal movement or elevated viewTop values during vertical movement). The existing logic appliedMath.Max(0, position - margin)to account for margins, which clamped negative or small positive values to zero. This erased the signal used to detect that a view was still animating, causing the safe area logic to treat animating views as already settled. As a result, safe area padding was reduced too early during the final animation frames, leading to visible padding jumps.Description of Change
To preserve correct animation detection, the animation state is now calculated using raw view position values before any margin clamping is applied, ensuring off-screen and in-transition states are not lost. The safe area calculation logic was also reordered so animation checks are evaluated before overlap checks for the left and right edges. This prevents partial padding from being applied when a view is near its final position but still animating. Finally, the animation flags were renamed to
viewIsAnimatingHorizontallyandviewIsAnimatingVerticallyfor clarity.Note
The test case
SafeAreaShouldWorkOnAllShellTabsalready exists on the main branch (Issue33034.cs). It was validated locally on an API 36 emulator to confirm the regression. Before the fix, the test failed due to incorrect safe area padding during Shell tab animations. After applying the fix, the test passes, confirming that safe area padding is correctly maintained throughout the animation cycle.Tested the behaviour in the following platforms
Output Video
Beforefix_36.mov
AfterFix_36.mov