Repository navigation
Start the homepage environment fade even when a long task delays the next frame - #1993
Merged
David Pine (IEvangelist) merged 1 commit intoOct 30, 2026
Merged
Conversation
The environment panel transition cleared data-transition with a 200 ms timer started at click time. When a long task delayed the next rendering frame past that timer, the attribute was removed before style was recalculated, so the fade-in never started and visitors got an abrupt swap. This is also the recurring "fades environment changes" homepage E2E flake. Flush style with getAnimations() so the CSS fade starts synchronously, and settle the panels when that animation finishes (or immediately when no fade applies) instead of racing a fixed timer. Co-authored-by: Copilot <[email protected]>
Contributor
Frontend HTML artifact readyThe latest frontend build uploaded the This comment updates automatically when a new frontend build artifact is uploaded. |
David Fowler (davidfowl)
marked this pull request as ready for review
October 30, 2026 11:48
David Fowler (davidfowl)
requested a review
from David Pine (IEvangelist)
as a code owner
October 30, 2026 11:48
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the environment-switching fade fix and its regression coverage.
No open issues 🎉
What changed in this PR
This PR fixes a homepage environment-switching race that could skip the fade when a long task delayed rendering.
Changes:
- Replaces the fixed cleanup timer with synchronous animation creation and cleanup when the fade finishes.
- Adds a regression test that blocks the main thread after switching environments and verifies the fade starts and transition state clears.
| File | Description |
|---|---|
src/frontend/tests/e2e/homepage.spec.ts |
Adds regression coverage for environment fades during a delayed frame. |
src/frontend/src/components/home/HomeEnvironment.astro |
Uses the fade animation’s completion promise instead of a fixed timer to settle panels. |
Review effort: Balanced
David Pine (IEvangelist)
approved these changes
Oct 30, 2026
David Pine (IEvangelist)
deleted the
aspireagent/fix-environment-fade-race
branch
October 30, 2026 13:20
David Pine (IEvangelist)
pushed a commit
that referenced
this pull request
Nov 1, 2026
…ation events (#2005) ## Summary Fixes a recurring retry-only E2E flake in `tests/e2e/homepage.spec.ts` › "fades environment changes and pauses independent resource motion". No open issue tracks it. It still occurs after #1993 because #1993 fixed a different root cause, in product code. **Signature**, from all three projects: ``` expect(locator).toHaveAttribute(expected) failed Locator: locator('[data-home-environments]').locator('[data-environment-panel="test"]') Expected: "true" Received: "false" … <article … data-transition="fade-in" data-test-fade-seen="false" …> ``` **Occurrences since #1993 merged (2026-10-30 13:20Z):** the test passed only on retry in these CI jobs: - [41063267878](https://github.com/microsoft/aspire.dev/actions/runs/41063267878) (mobile) - [41073244315](https://github.com/microsoft/aspire.dev/actions/runs/41073244315) (desktop) - [41077887607](https://github.com/microsoft/aspire.dev/actions/runs/41077887607) (tablet) - [41079312370](https://github.com/microsoft/aspire.dev/actions/runs/41079312370) (mobile and desktop) - [41089832463](https://github.com/microsoft/aspire.dev/actions/runs/41089832463) (mobile) **Root cause (test-only):** the test recorded the fade with an `animationstart` listener registered with `{ once: true }` and no target check. Revealing a panel restarts its topology animations, such as `topology-node-idle` and `topology-cycle-four`, and their `animationstart` events bubble to the panel. When one of them is dispatched before the panel's own `environment-panel-fade-in` event, it consumes the one-shot listener. The real fade then goes unrecorded, even though it ran. The product behavior is correct: the snapshot above shows `data-transition="fade-in"` on the panel. **Fix:** a shared `recordPanelFade()` helper. It only accepts `environment-panel-fade-in` events whose target is the panel itself, and removes its listener after recording one. The two inline listeners in the fade test and the one in the long-task fade test now use it. No assertions, timeouts or retries changed, and the product code is unchanged. **Regression test:** "records the environment fade when a descendant animation starts first". It dispatches a bubbling `animationstart` from a topology card before clicking **Test**, then asserts that the panel's own fade is still recorded. This deterministically reproduces the ordering seen in CI. This doesn't change any rendered output, so there are no screenshots. ## Third-party links and affiliations None. ## Validation **Reproduced on unmodified `main` (f05f556):** I ran a local dev server, loaded a fresh page in a mobile 390×844 context each time with no CPU throttling, and made the first **Test** click while recording events with both the old one-shot listener and a persistent listener. - In 5 of 32 loads, the first `animationstart` reaching the panel came from a descendant (`topology-node-idle` or `topology-cycle-four`), and the old listener missed the fade. - The persistent listener saw the fade in 32 of 32 loads. **Fail before, pass after:** - New regression test with the old `{ once: true }` listener: **9/9 failed** (3 projects × 3 repeats), `Received: "false"`. - With the fix, the new test, the fade test and the long-task fade test (3 projects × 3 repeats): 26 of 27 passed. - The one failure was the existing long-task test on desktop, the second test of the run on a cold dev server. Its unchanged `data-transition` settle assertion timed out after 2s. - Re-running the long-task and new tests (3 projects × 4 repeats) gave **24/24 passed**. **Other checks:** - `npx vitest run`: 84 files, 1,120 passed, 1 skipped. - `npx eslint . --max-warnings 0`: clean. --- **🤖 Posted by AspireAgent (AI Agent)** Co-authored-by: davidfowl <[email protected]> Co-authored-by: Copilot <[email protected]>
Sébastien Ros (sebastienros)
added a commit
that referenced
this pull request
Nov 11, 2026
- TypeScript API parameter descriptions (#2009) - No locale prefix or hreflang alternates for English-only pages: the footer language picker (#1988), hreflang (#1987) and the sidebar Glossary link (#1989) - Footer link to the Aspire MIT license - Homepage: environment fade (#1993), stale AppHost animations (#1950), the dashboard carousel keeps the selected slide on activation - Search: first-result highlight with out-of-order renders (#2007), hover cursor flicker (#1977) - Live status over WebSocket (#1942) and twoslash hover, merged into the copies of the frontend scripts - Icon data 5.40.0 and the regenerated sprite - src/frontend now uses Bun: README and script usage updated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On the homepage's environment section (Local / Test / Production), switching environments is supposed to fade the new panel in.
HomeEnvironment.astroremoveddata-transitionwith a 200 ms timer that started at click time. If a long task delayed the next rendering frame past that timer, the attribute was gone before style was recalculated. The fade never started, so visitors on busy or low-end devices got an abrupt swap.The same race is the recurring homepage E2E flake
fades environment changes and pauses independent resource motion. It failed on the first attempt and passed on retry in 5 of the 15 most recent successfulci.ymlruns I scanned. Both failures I inspected show the same signature:data-test-fade-seenExpected"true", Received"false". For example:Testpanel, retry Enable HSTS in production and add HTTPS redirection #1 passed.Localpanel, retry Enable HSTS in production and add HTTPS redirection #1 passed.Fix: after setting
data-transition, callnextPanel.getAnimations(). This flushes style, so the CSS fade is created synchronously. The panels then settle when that animation'sfinishedpromise resolves, or immediately if no fade applies, for example when motion isn't active. No timeouts, sleeps or retries are added; the fixed timer is removed. Cancelled animations (a new selection, pause, hidden page or scrolling away) still go through the existingsettlePanels()paths.Regression test:
starts the environment fade even when a long task delays the next frameclicksTestand then blocks the main thread for 250 ms in the same task. It asserts that the fade'sanimationstartfires and thatdata-transitionclears.No screenshots: the panel looks the same before and after once it settles. The fix restores a 180 ms opacity animation, which a still image can't show. The evidence is the
animationstartassertion above.Third-party links and affiliations
None
Validation
astro devin desktop, tablet and mobile Chromium:data-test-fade-seenExpected"true", Received"false". This matches the CI flake.environment, run twice each across the 3 projects (including the existing fade test): 24/24 passed.vitest run: 82 files; 1108 passed, 1 skipped.eslint . --max-warnings 0passes, andprettier --checkonHomeEnvironment.astropasses. The new test block is Prettier-clean;homepage.spec.tsalready has a Prettier warning onmain.🤖 Posted by AspireAgent (AI Agent)