Skip to content

Wait for real provider progress in the virtualization cancellation test - #70804

Merged
richlander merged 1 commit into
mainfrom
dev/richlander/virtualization-cancellation-readiness
Nov 25, 2026
Merged

richlander merged 1 commit into
mainfrom
dev/richlander/virtualization-cancellation-readiness

Conversation

@richlander

Copy link
Copy Markdown
Member

Wait for real provider progress in the virtualization 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.

Synchronize the existing cancellation test with real virtualized data requests.

Description

Only eight lines are added to CancelsOutdatedRefreshes_Async; no shipping code, test asset, assertions, browser defaults or package versions change.

Wait for the existing loading attribute before releasing the initial provider, then wait for actual loaded items before scrolling. After each native scrollTo, wait for a new non-null pending-placeholder window before issuing another scroll. Preserve every exact scroll-position wait and the final cancellation-count assertion.

This prevents the initial scroll from being clamped before data establishes the scroll extent, and prevents all five scrolls from coalescing into one provider request. There are no sleeps or injected observer/provider callbacks.

Boundary: Virtualize and its native browser observers own request production. Existing loading/placeholder DOM observes that real path; the existing cancellation count observes the material result. Permanent coverage remains the existing Server/WASM Selenium cases. A synthetic callback test would bypass the lost-scroll/coalescing preconditions.

Red/green evidence

Against current main a6110c23cf, the unchanged two-case run initially passed, then a fresh repeat failed ServerVirtualizationTest.CancelsOutdatedRefreshes_Async at the exact scroll-position wait, line 420. The WASM case passed both baseline runs; no WASM baseline failure is claimed.

An intermediate counter-instrumented test-asset variant passed the cancellation cases but failed the server sizing control (7/8 passed). That approach was discarded entirely. The final change observes existing DOM and has no test-asset diff.

All commands ran after source activate.sh in the same immutable AL4 Chrome image used by #70689 (sha256:42d8a12504aa39a3c6e336a43937320a7086ad87701dd7b5d1e1c7cc6a8ddd30), SDK 12.0.100-alpha.1.26557.102, Chrome 158, default viewport and untrimmed Release applications.

Build: passed, zero warnings/errors.

dotnet build src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj --no-restore -c Release -p:UseMonoRuntime=false -p:UseIisNativeAssets=false -p:TestTrimmedApps=false -m:2 -v:q

Final targeted run: Passed: 8, Failed: 0, Skipped: 0, exit 0. Both Server/WASM cancellation cases plus RerendersWhenItemSizeShrinks_Async, RerendersWhenItemSizeShrinks_Sync and EmptyContentRendered_Async controls passed.

dotnet test src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj --no-build -c Release -p:UseMonoRuntime=false -p:UseIisNativeAssets=false -p:TestTrimmedApps=false --filter "FullyQualifiedName~CancelsOutdatedRefreshes_Async|FullyQualifiedName~RerendersWhenItemSizeShrinks_Async|FullyQualifiedName~RerendersWhenItemSizeShrinks_Sync|FullyQualifiedName~EmptyContentRendered_Async" --logger "trx;LogFileName=green-dom.trx" --results-directory /evidence/virtualization-repair-green

Five additional fresh runs: Passed: 2, Failed: 0, Skipped: 0 each, all exit 0. This is a bounded stability sample, not proof across hosts/load.

for attempt in 1 2 3 4 5; do
  dotnet test src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj --no-build -c Release -p:UseMonoRuntime=false -p:UseIisNativeAssets=false -p:TestTrimmedApps=false --filter FullyQualifiedName~CancelsOutdatedRefreshes_Async --logger "trx;LogFileName=green-$attempt.trx" --results-directory /evidence/virtualization-repair-repeat || exit $?
done

Every exported final TRX was parsed: exact expected names/counts, unique execution/test identities, matching definitions, all executed/passed and zero skipped/failed/aborted/pending. The expected failing baseline was separately parsed.

Formatting and diff checks: passed, exit 0.

dotnet format whitespace --folder /repo/src/Components/test/E2ETest/Tests --include VirtualizationTest.cs --verify-no-changes --verbosity quiet
git diff --check

Draft pending complete hosted/trimmed Components E2E qualification.

Fixes #70803.

Wait for initial loading and loaded items before scrolling, and observe a new pending placeholder window between native scrolls. Preserve every existing scroll and cancellation assertion without changing the test asset or shipping code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label Nov 24, 2026
@richlander
richlander marked this pull request as ready for review November 24, 2026 23:57
@richlander
richlander requested a review from a team as a code owner November 24, 2026 23:58
Copilot AI balanced review requested due to automatic review settings November 24, 2026 23:58

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

No active review issues block the test-only synchronization change intended to reduce timing-related virtualization cancellation failures.

No open issues 🎉

What changed in this PR

This PR addresses #70803 by synchronizing the existing virtualization cancellation test with observable provider progress, reducing timing-related failures without changing shipping code.

Changes:

  • Wait for initial loading and loaded items before scrolling.
  • Wait for a distinct pending-placeholder window after each native scroll.
  • Preserve exact scroll-position checks and the final cancellation-count assertion.
File Description
src/​Components/​test/​E2ETest/​Tests/​VirtualizationTest.cs Adds observable DOM waits to CancelsOutdatedRefreshes_Async for the existing Server/WASM Selenium cases.

Review effort: Balanced

@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 dotnet/aspnetcore#70804 at d81702d4f0949b99ac50cd1feab4e9e5708f9f2d: one unresolved P3 test-reliability concern, no verified defect. The new pre-scroll placeholder snapshot is outside a retry. The exact DOM replacement and stale-element response needed to abort this test were not established; a pending observer callback can leave the distribution unchanged, and a render can retain the selected node.

Guide completion: Cross-cutting and Blazor Components both completed their in-scope source review. The only changed area is one existing Server/WASM Selenium test. The guides traced the native scroll–observer–provider path and checked the test boundary and false-pass risk: the unchanged final assertion proves at least one cancellation, not one per scroll, and the previous version could already pass with favorable timing. No materially changed area lacked a routed guide.

Existing feedback: No equivalent finding in the frozen snapshot. Review 6049440029 describes the synchronization changes but does not raise the snapshot issue. Feedback after preparation was not observable.

DISCARDED
  • Loading-marker concerns: Virtualize.cs:566–571 passes _loading to the element AddAttribute(int, string, bool) overload. RenderTreeBuilder.cs:192–209 emits the attribute when true and omits it when false; WaitAssert.cs:63–83 polls for a match. The selector can observe pending state before items load.
  • Synthetic scroll concern: VirtualizationTest.cs:421 calls native scrollTo; Virtualize.ts:889–907,996–1084 still owns browser-observer delivery. The test does not inject an observer callback.

Provenance and limits: Frozen merge base a6110c23cfa4805ee95a6a00ee3812a1e9f1857f; base tip and immutable workflow guidance d848fbf2e3ead0c4f7aa53df35e9b808960a5dea. Source only: no build, tests, CI, browser workflow, or samples were run; reported PR runs are not independent evidence. Security assessment was excluded.

Generated by ASP.NET Core Pull Request Review for #70804 · copilot · gpt62 · 133.2 AIC · ⌖ 7.27 AIC · ⊞ 19K
Comment /review to run again


for (var y = 1000; y <= 5000; y += 1000)
{
var previousPlaceholder = Browser.FindElements(By.Id("async-placeholder")).FirstOrDefault()?.Text;

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.

P3 · unresolved — [UNRESOLVED] A stale placeholder reference could abort the test before the next scroll.

Why unresolved: No real-browser trace or faithful reproduction of the existing Server or WASM five-scroll case shows a pending callback detaching the exact node returned by FindElements before .Text and the stale-element response aborting the test. A callback can leave the distribution unchanged, and a render can retain the selected node.

Repro scenario (not confirmed): Run CancelsOutdatedRefreshes_Async in the Server or WASM Selenium suite. After a changed-placeholder wait succeeds, a delayed render would need to detach the next iteration’s selected placeholder between lookup and text retrieval.

What goes wrong: The old loop did not make this read. Unlike the later Browser.True predicate, this snapshot does not retry a stale element, so the run could stop before the cancellation assertion.

If confirmed, retry the lookup and text read together, keeping a missing placeholder a valid baseline:

var previousPlaceholder = Browser.Exists(
    () => Browser.FindElements(By.Id("async-placeholder")).FirstOrDefault()?.Text,
    timeout: default);

@richlander
richlander merged commit f40ce54 into main Nov 25, 2026
33 checks passed
@richlander
richlander deleted the dev/richlander/virtualization-cancellation-readiness branch November 25, 2026 03:33
@github-actions

Copy link
Copy Markdown
Contributor

✅ No documentation PR was created.

Confidence that documentation is needed: 2%

No docs needed: the PR only synchronizes an existing E2E test with real virtualization requests. No shipping code changed.

Documentation surfaces considered

  • Conceptual article: Not required — Test-only change to VirtualizationTest.cs; no public API or behavior change.
  • Migration guidance: Not required — No user-facing behavior or defaults change.
  • Breaking change: Not required — No compatibility impact; no shipping code changed.

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — d81702d4 Deployed Nov 25, 2026 by richlander via conclusion #455
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.

Synchronize virtualization cancellation E2E test with provider progress

4 participants