Skip to content

[test-quarantine] Stabilize Blazor Web JS Initializers test case - #69193

Closed
BrundhaVelusamy wants to merge 16 commits into
dotnet:mainfrom
BrundhaVelusamy:68856_TestCase
Closed

BrundhaVelusamy wants to merge 16 commits into
dotnet:mainfrom
BrundhaVelusamy:68856_TestCase

Conversation

@BrundhaVelusamy

Copy link
Copy Markdown
Contributor

Stabilize Blazor Web JS Initializers test case

Description

Stabilizes BlazorWebJsInitializersTest.InitializersRunsModernCallbacksByDefaultWhenPresent by configuring block-webassembly-settings before navigating to the test page.

Previously, the test set the session storage value after navigation had already started. During application startup, the setting is consumed as part of the initialization flow, creating a potential race condition where the expected initializer behavior could be missed intermittently.

This change moves the WebAssembly configuration setup ahead of page navigation, ensuring the expected startup state is available before initialization begins. The update is limited to test code and does not affect product behavior or public APIs.

Fixes #68856

Testing

  • Built Microsoft.AspNetCore.Components.E2ETests
  • Ran BlazorWebJsInitializersTest.InitializersRunsModernCallbacksByDefaultWhenPresent successfully
  • Executed the targeted test in a loop for 100 iterations with zero failures
  • Verified no diagnostics, analyzer, or whitespace issues remain

The original intermittent failure could not be reproduced locally. Validation is based on eliminating a potential startup race condition in the test setup and confirming stability through repeated execution.

@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label Sep 10, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Sep 10, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Thanks for your PR, @BrundhaVelusamy. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@BrundhaVelusamy
BrundhaVelusamy marked this pull request as ready for review September 11, 2026 07:11
@BrundhaVelusamy
BrundhaVelusamy requested a review from a team as a code owner September 11, 2026 07:12
Copilot AI lite review requested due to automatic review settings September 11, 2026 07:12

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

The test setup race is addressed and validation passed.

Pull request overview

Stabilizes the Blazor Web JS initializers E2E test by configuring WebAssembly session state before navigation.

Changes:

  • Moves block-webassembly-settings setup before page navigation.
  • Removes quarantine marking and an unused import.
File summaries
File Description
src/Components/test/E2ETest/ServerRenderingTests/BlazorWebJsInitializersTest.cs Fixes test setup ordering to eliminate the startup race.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@PureWeen

Copy link
Copy Markdown
Member

/review

@PureWeen PureWeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One validated test-setup issue below.

This review comment was generated by GitHub Copilot with the help of a human.

@ilonatommy

Copy link
Copy Markdown
Member

@BrundhaVelusamy, this comment: #68856 (comment) is right. Both tests share the same setup and both fail on the same line. Could you fix both in this PR?

Now, about the fix implementation. Why are we using session-storage in this test for startup config? Does it matter in the test how we pass the config? Why can't we pass it with page's URL? We are already passing streaming/wasm/server this way. That would remove the execution order dependency. What do you think?

@BrundhaVelusamy

BrundhaVelusamy commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

@BrundhaVelusamy, this comment: #68856 (comment) is right. Both tests share the same setup and both fail on the same line. Could you fix both in this PR?

Now, about the fix implementation. Why are we using session-storage in this test for startup config? Does it matter in the test how we pass the config? Why can't we pass it with page's URL? We are already passing streaming/wasm/server this way. That would remove the execution order dependency. What do you think?

@ilonatommy, Thanks for the suggestion. I updated both theory tests to pass enable-classic-initializers and block-webassembly-settings through the target URL instead of using sessionStorage. This removes the startup configuration ordering dependency and allows both tests to use the same deterministic setup flow.

I also updated App.razor to read these initializer-specific options from the query string (while retaining the existing storage fallback for unrelated callers), removed the setup navigation/helper logic, and removed the quarantine from InitializersRunsClassicInitializersWhenEnabled.

@ilonatommy

Copy link
Copy Markdown
Member

Failure in BlazorWebTemplate_ConditionalPasskeyRegistration is not related, we can escape once the other jobs finish.

@ilonatommy

Copy link
Copy Markdown
Member

E2E test failures are connected, @BrundhaVelusamy please check the logs in https://dev.azure.com/dnceng-public/public/_build/results?buildId=1617664&view=ms.vss-test-web.build-test-results-tab.

auto-merge was automatically disabled October 7, 2026 06:46

Head branch was pushed to by a user without write access

@BrundhaVelusamy

Copy link
Copy Markdown
Contributor Author

E2E test failures are connected, @BrundhaVelusamy please check the logs in https://dev.azure.com/dnceng-public/public/_build/results?buildId=1617664&view=ms.vss-test-web.build-test-results-tab.

@ilonatommy,

  • I investigated the E2E-related CI failures. The browser logs showed WebAssembly startup failing while loading /subdir/_framework/dotnet.js, which prevented the expected initializer callbacks from executing.
  • To address this, I updated Components.TestServer.lib.module.js so that when no WebAssembly options are supplied, beforeWebAssemblyStart configures the WasmMinimal resource loader before startup. This preserves the original regression coverage while avoiding the invalid asset-loading path observed in CI.
  • For validation, I ran BlazorWebJsInitializersTest locally 100 consecutive times, covering all theory combinations, and did not observe any failures. All runs completed successfully, and the expected initializer callbacks were produced in each execution. CI rerun will provide final confirmation for the Linux environment.

@BrundhaVelusamy BrundhaVelusamy changed the title Stabilize Blazor Web JS Initializers test case [test-quarantine] Stabilize Blazor Web JS Initializers test case Oct 19, 2026
@PureWeen

Copy link
Copy Markdown
Member

/review

@github-actions github-actions Bot 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.

Source-only review of frozen head 52632d6b7ff773a06494f01baad2ab21882617a4 found one new P3 test-path issue: the added WebAssembly fallback loader is registered after dotnet.js URL selection, so WebAssembly theory rows remain unable to start under the forced null settings.

Both routed guides completed: docs/CrossCuttingGuidance.md and docs/BlazorComponentsGuidance.md. The earlier setup-race feedback at discussion_r4093474335 was valid for a superseded revision and is resolved by the query-string setup; it does not duplicate this finding. No unresolved candidates or materially changed uncovered areas remain.

Provenance: PR 69193; merge base 8192456de81ed6bbc6e484404069f59907bd0d6f; base tip and immutable guidance commit ceb0eec49d8d2c77f4f7c26b85ddb6e96940dfed. Proof is source-only from the frozen version-2 bundle. Target code, builds, CI, tests, browser workflows, and samples were not executed; security assessment was excluded by policy. Review is limited to tracked Git bytes and cannot observe feedback posted after bundle preparation.

Generated by ASP.NET Core Pull Request Review for #69193 · copilot · gpt56 · 448.6 AIC · ⌖ 10.3 AIC · ⊞ 18.8K
Comment /review to run again

@PureWeen

Copy link
Copy Markdown
Member

Non-blocking coverage note (pre-existing at 52632d6b): the streaming=true rows select InitializersStreamingRequest.razor, but neither it nor its ancestor/import chain enables [StreamRendering]. Source tracing through EndpointComponentState and EndpointHtmlRenderer shows streaming defaults to false and the asynchronous work is awaited before the initial response, so those rows do not exercise the streamed-response initializer path.

If that matrix dimension is meant to cover the streamed-response path, enable [StreamRendering] on this scenario. If the test also needs to assert that the browser receives the initial response while work is pending, the existing AutoPauseTestStreamGate pattern could hold completion until that response is observed. This is a source-level coverage observation, not a reproduced failure or a regression introduced by this PR; it does not invalidate the URL-based startup configuration change and can be tracked separately.

This review was created by GitHub Copilot with help from a human.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime.
To make sure no conflicting changes have occurred, please rerun validation before merging. You can do this by leaving an /azp run comment here (requires commit rights), or by simply closing and reopening.

@dotnet-policy-service dotnet-policy-service Bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Nov 3, 2026
@kotlarmilos

Copy link
Copy Markdown
Member

Duplicate of #70258

@kotlarmilos kotlarmilos marked this as a duplicate of #70258 Nov 6, 2026
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 community-contribution Indicates that the PR has been added by a community member pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quarantine BlazorWebJsInitializersTest.InitializersRunsModernCallbacksByDefaultWhenPresent

5 participants