Repository navigation
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Release the barrier immediately after the inbound pipeline returns on short circuits, and strengthen the corresponding test.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
This PR orders root-component operation batches without waiting for rendering or client acknowledgments.
Changes:
- Adds dispatcher-confined barriers between batches.
- Releases barriers on success and failure paths.
- Adds sequencing coverage for middleware, dependencies, failures, and acknowledgments.
| File | Summary | Findings |
|---|---|---|
src/Components/Server/test/Circuits/CircuitHostTest.cs |
Adds ordering and failure-path tests. | Short-circuit ordering test does not block the acknowledgment send, so it cannot verify early barrier release. |
src/Components/Server/src/Circuits/CircuitHost.cs |
Implements root-component batch ordering. | Inbound short circuits release the barrier only after the end-update send completes. |
54873c8 to
5ea3db7
Compare
5ea3db7 to
0612bed
Compare
|
|
||
| Assert.True(entered, "The initial circuit handler did not enter the gate."); | ||
|
|
||
| Browser.Click(By.Id("navigation-gate-next")); |
There was a problem hiding this comment.
This test still passes if the click does a full page reload. The gate only holds the first circuit opened after arm, so after a reload the second page gets a new, ungated circuit, becomes interactive, and the click-count assertion passes without exercising the CircuitHost barrier change.
Could we assert the navigation was enhanced (same page and circuit)? ClientValidationTest already does this with MarkEnhancedNavProbe / AssertWasEnhancedNavigation: set window.__enhancedNavProbe = true before clicking navigation-gate-next, then check it's still set once navigation-gate-second-button exists. A reload clears it.
|
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |

Why
UpdateRootComponentsbatches can overlap when lifecycle handlers, inbound middleware, rendering, or client acknowledgments yield. A dependent batch could apply its operations before its predecessor had even invoked Add/Update/Remove. Serializing entire batches would fix that ordering but unnecessarily make later batches wait for rendering, post-next()middleware, or a slow client acknowledgment.Fixes #59657.
What changed
TaskCompletionSourcewith asynchronous continuations. It awaits its predecessor without blocking the dispatcher. The barrier completes immediately after Add/Update/Remove have been invoked, or after inbound middleware returns without invokingnext(); it does not wait for rendering, quiescence, post-next()middleware, or acknowledgment.UnhandledException/ client-error flow, and causes circuit termination throughCircuitRegistry. Later batches skip operations and do not report the same error again. If a batch fails after releasing its barrier, operations already started by another batch may finish; subsequent batches still see the errored state and do not start operations.Validation
eng/build.cmd: succeeded with zero warnings/errors.dotnet test src\Components\Server\test\Microsoft.AspNetCore.Components.Server.Tests.csproj --no-build --filter 'FullyQualifiedName~CircuitHostTest|FullyQualifiedName~CircuitRegistryTest' -p:UseIisNativeAssets=false: 80 passed.next()failure allowed a later batch to apply; each failed at the expected assertion and passed with the fix. A gated-acknowledgment regression likewise showed a short-circuited batch previously held its successor until acknowledgment, and passes now.