Skip to content

[blazor] Stabilize navigation lock cancellation test - #70829

Merged
maraf merged 1 commit into
mainfrom
maraf-navigation-lock-test-stability
Nov 26, 2026
Merged

maraf merged 1 commit into
mainfrom
maraf-navigation-lock-test-stability

Conversation

@maraf

@maraf maraf commented Nov 25, 2026

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: d99ea43e75e452eb50d181b782f331b91617630d

Dimension Assessment Rationale
Change confidence 8/10 ↑ Existing readiness waits preserve both locks and assertions; 24 repeated server runs passed.
↓ Linux Chrome container behavior has not been checked.
Diagnosis confidence 8/10 ↑ Handler registration happens after rendering; the pre-fix test reproduced the missing second control.
↓ The registration race was not instrumented directly.
Evidence fit 7.5/10 ↑ The local pre-fix failure matched the reported CI assertion and line.
↓ The precise timing in the CI failure was not observed.

[blazor] Stabilize navigation lock cancellation test

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Wait for both navigation locks to become ready before navigating.

Description

Wait for each existing navigation-lock-ready signal before starting the navigation, as the neighboring continue test already does. This preserves the two-lock cancellation scenario and all existing assertions. The change addresses a possible race between navigation and registration of the second handler.

The failure was observed in CI build 1697387 for #70526. No associated issue.

Validation on macOS with Chrome, after source activate.sh:

  • dotnet build src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj --no-restore -v:q -p:UseIisNativeAssets=false — passed.
  • dotnet test src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj --no-build --filter "FullyQualifiedName~NavigationLock_CanBlockNavigation_Then" — passed all four Server and WebAssembly cases.
  • dotnet test src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj --no-build --filter "FullyQualifiedName~ServerRoutingTest.NavigationLock_CanBlockNavigation_ThenCancel" — passed 24 repeated runs after the change; the original failed twice in 16 runs, with one captured failure matching the CI assertion.
  • ./eng/build.sh — failed on a GetFilesToPublish circular dependency in Microsoft.AspNetCore.App.Runtime.sfxproj; the targeted project subsequently built successfully.

Linux Chrome container CI was not run locally.

Note

This PR description was generated with the assistance of GitHub Copilot.

…on_ThenCancel

On Blazor Server, NavigationLock registers its location-changing handler in
OnAfterRenderAsync, which runs only after the client acknowledges the render
batch. Navigating immediately after clicking the second lock's checkbox could
reach the server before that handler was registered. Wait for the existing
navigation-lock-ready signal, as the sibling ThenContinue test already does.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@maraf maraf added the area-blazor Includes: Blazor, Razor Components label Nov 25, 2026
@maraf maraf self-assigned this Nov 25, 2026
@maraf
maraf marked this pull request as ready for review November 25, 2026 14:07
@maraf
maraf requested a review from a team as a code owner November 25, 2026 14:07
Copilot AI balanced review requested due to automatic review settings November 25, 2026 14:07

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.

🟢 Approval recommended

There are no active review issues for the change adding readiness waits to the navigation-lock cancellation test.

No open issues 🎉

What changed in this PR

Stabilizes the Blazor navigation-lock cancellation E2E test by waiting for both locks to report readiness before navigating, addressing a possible handler-registration race.

Changes:

  • Adds readiness waits for both navigation locks, matching the neighboring continue test.
  • Preserves the two-lock cancellation scenario and all existing assertions.
File Description
src/​Components/​test/​E2ETest/​Tests/​RoutingTest.cs Waits for both navigation locks to become ready before testing cancellation.

Review effort: Balanced

@PureWeen

Copy link
Copy Markdown
Member

/review

@maraf
maraf merged commit 9469ea1 into main Nov 26, 2026
40 checks passed
@maraf
maraf deleted the maraf-navigation-lock-test-stability branch November 26, 2026 14:34
@maraf
maraf temporarily deployed to copilot-pat-pool November 26, 2026 14:34 — with GitHub Actions Inactive
@maraf
maraf temporarily deployed to copilot-pat-pool November 26, 2026 14:34 — with GitHub Actions Inactive
@maraf
maraf temporarily deployed to copilot-pat-pool November 26, 2026 14:35 — with GitHub Actions Inactive
@maraf
maraf temporarily deployed to copilot-pat-pool November 26, 2026 14:37 — with GitHub Actions Inactive
@maraf
maraf temporarily deployed to copilot-pat-pool November 26, 2026 14:38 — with GitHub Actions Inactive
@maraf
maraf temporarily deployed to copilot-pat-pool November 26, 2026 14:39 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown
Contributor

✅ No documentation PR was created.

Confidence that documentation is needed: 2%

No docs needed: the PR only stabilizes an E2E test (tests/test infrastructure category).

Documentation surfaces considered

  • Conceptual article: Not required — Only src/Components/test/E2ETest/Tests/RoutingTest.cs changed; no user-visible behavior.
  • Migration guidance: Not required — No behavior or defaults change for upgrading users.
  • Breaking change: Not required — No compatibility impact; test-only change.

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — d99ea43e Deployed Nov 26, 2026 by maraf via conclusion #485
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants