Repository navigation
Conversation
|
Thanks for your PR, @Yuvan111. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
🔵 Needs a closer look
Human review is needed because the tie-breaker selects between equal-priority roots with different conventions or route values, and the supplied tests do not cover those overlaps.
No open issues 🎉
What changed in this PR
Fixes #70461 by resolving duplicate Blazor framework endpoint matches when multiple roots are mapped with MapRazorComponents, avoiding ambiguous-match HTTP 500 responses.
Changes:
- Adds an internal matcher policy that resolves equal-priority ties between marked framework endpoints with matching handlers.
- Registers the policy, marks framework endpoints, and documents selection behavior while retaining per-root conventions.
- Adds routing tests covering multiple roots, route groups, host and method restrictions, registration order, response behavior, and application endpoint priority.
| File | Description |
|---|---|
src/Components/Endpoints/test/Builder/RazorComponentsEndpointRouteBuilderExtensionsTest.cs |
Adds routing regression tests for duplicate framework endpoints and routing restrictions. |
src/Components/Endpoints/src/DependencyInjection/RazorComponentsServiceCollectionExtensions.cs |
Registers the matcher policy with Razor Components services. |
src/Components/Endpoints/src/Builder/RazorComponentsEndpointRouteBuilderExtensions.cs |
Documents framework endpoint conventions and tie resolution. |
src/Components/Endpoints/src/Builder/RazorComponentEndpointDataSource.cs |
Marks framework endpoints before applying root conventions. |
src/Components/Endpoints/src/Builder/BlazorWebEndpointMatcherPolicy.cs |
Adds marker metadata and the policy that resolves matching framework endpoint ties. |
Review effort: Balanced
|
/review |
|
Copilot's local review panel found no issues to raise at this commit. Reviewed head [UNRESOLVED] / [DISCARDED] confirmation, non-blocking[UNRESOLVED] O:C1 (1/3): The question concerns which root's conventions or route values apply when framework endpoints have equal priority. Arm O described first-registered-root selection, but did not establish stable ordering or a documented precedence contract. It retained this as an unresolved intent question, not a verified defect. CCR review 5887712198 already asks for closer review of equal-priority roots with different conventions or route values. This trace records that relationship without posting the question again. O:D1: O's Blazor worker discarded the same convention-overlap concern. Arm O did not adopt that full refutation because endpoint metadata can still differ. It kept O:C1 unresolved and linked it to the existing review. [DISCARDED] G:G-1: This related candidate has a different trigger: independent framework Posted for informational purposes so the author can confirm the verifier didn't discard or leave unresolved a real finding; this item does not block Human-directed and GitHub Copilot-generated. |
|
@PureWeen , Added overlap tests confirming the selected endpoint retains its own metadata and route values in both registration orders. |
|
Could we simplify this for a bug fix? The same handler and routing score do not necessarily make endpoints equivalent when their conventions and metadata differ. This introduces an unspecified assumption rather than just removing duplicate mappings. Why we can't prevent duplicate registration while preserving route groups and host restrictions? |
|
@kotlarmilos, I’ve removed request-time tie-breaking; equivalent framework endpoints are now shared before routing, while distinct metadata, route groups, and host restrictions remain intact. This still uses conservative metadata comparison would you prefer a different registration-time approach to keep the fix simpler? |
|
/review |
There was a problem hiding this comment.
🟡 Changes recommended
Switching from a registered to an unregistered static-assets manifest retains stale assets and import maps, causing rebuilt endpoints to advertise the previous resource-collection URL without regenerating its handler.
1 open issue
3 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
Source-only review of frozen head 56e06ce599abc04b82ee546aa557fa2a132d4894 produced two unresolved P2 questions, not verified defects: identical route-rewriting conventions and independently created equivalent authorization metadata both remain ambiguous, but the frozen evidence lacks the binding incomplete-fix contracts needed to require either scenario.
Both routed guides completed with independent gpt-5.6-sol workers (reasoning effort was not supplied; runtime default). Cross-cutting checks covered compatibility, correctness, endpoint production/consumption, change-token lifetime, synchronization, diagnostics, metadata equivalence, packaging, trimming, and test shape. Blazor checks covered route-builder scoping, conventions, metadata comparison, routing ambiguity, static assets, hot reload, diagnostics, and managed endpoint tests. The two provisional candidates then received one independent frozen-source verifier result each; both were downgraded for missing binding contracts and are surfaced inline as unresolved.
Existing feedback was assessed for deduplication. Earlier threads cover diagnostics metadata, collection invalidation, static-assets test setup, and broader root-metadata concerns; they are not endorsements of these two distinct unresolved scenarios and were not republished as new findings. No deduplicated true-positive finding remains at this head. Routine discarded checks found no public API compatibility break, no source-supported loss of collection or child change notifications, and no browser/E2E owner-layer requirement for this managed routing behavior.
Guidance provenance: trusted workflow snapshot c5baf473f31fa3bbe9f8201e3411361c632f3a91. Test boundary: frozen-source review only; target code, builds, tests, CI, browser workflows, and samples were not executed. Security assessment was excluded by supplied policy. No materially changed product area was left without a routed guide; non-applicable component lifecycle, rendering, interop, forms, and WebAssembly topics were assessed as such. Limitations: tracked Git bytes only; symlink, submodule, and LFS targets are inert, and feedback posted after bundle preparation is not observable.
Generated by ASP.NET Core Pull Request Review for #70532 · copilot · gpt56 · 247.1 AIC · ⌖ 8.65 AIC · ⊞ 20.1K
Comment /review to run again
PureWeen
left a comment
There was a problem hiding this comment.
All three local review arms reviewed commit 56e06ce599abc04b82ee546aa557fa2a132d4894. G and S independently identified the custom-host-metadata comparison below; it is the one new P2 finding retained by the panel. Existing hosted route-rewrite and equivalent-authorization threads are not duplicated inline.
Non-blocking unresolved and discarded checks
[UNRESOLVED] O: resource-collection endpoints with multiple WebAssembly roots. A scratch managed-routing test reproduced AmbiguousMatchException when two roots request _framework/resource-collection.js without Accept-Encoding; the rerun reproduced it, while gzip and one-root controls returned 200. This is pre-existing behavior, not an established regression. The verifier returned DROP/unestablished: no binding contract was established requiring this PR to deduplicate those additional endpoints. The earlier panel's discarded item is in review 5945448720; O adds head-only runtime evidence, not proof of a new defect.
[DISCARDED] G: equivalent per-root CORS conventions. Both required independent double-checks declined publication: the source-backed ambiguity also exists before this PR, and no binding incomplete-fix contract was established. G's route-rewrite candidate was also declined and is already covered by the hosted thread.
Routine discarded checks included cross-group sharing, ordinary unknown-metadata handling, child change notifications, token ownership, grouped endpoints, preload values, delegate equality, and public API changes. These are negative checks, not additional findings.
Posted for informational purposes so the author can confirm the verifier didn't discard or leave unresolved a real finding; this item does not block agent-reviewed-approved.
Untested coverage: The custom host/suppression case below was established from source, not executed. The existing distinct-root-metadata test replaces the route pattern and exits deduplication before reaching this comparison; it does not cover this case.
Validation boundary: G and S used frozen-source review. O ran scoped scratch managed-routing tests at this head and repeated the no-gzip failure, with placeholder JS bundles that routing does not read. No browser validation was performed, and the merge base was not executed.
Human-directed and GitHub Copilot-generated.
|
/review |
There was a problem hiding this comment.
🟡 Changes recommended
Endpoint deduplication incorrectly treats custom metadata with opposite suppression values as equivalent, allowing registration order to drop the matchable root and cause framework URLs to return 404.
1 open issue
1 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
Source-only review of frozen head ee41ae362580f65fa64e4e34c94d4a98b37117b9 found one independently verified P2 regression: broad IRouteDiagnosticsMetadata equivalence can discard the only matchable framework endpoint when custom diagnostics metadata also carries suppression behavior.
Both routed guides completed with independent gpt-5.6-sol workers (reasoning effort not supplied; runtime default). Cross-cutting checks covered compatibility, correctness, metadata equivalence, routing producer/consumer paths, synchronization, change tokens, diagnostics, performance shape, trimming, and test false-pass risk. Blazor checks covered endpoint sharing boundaries, route groups, conventions, static assets, hot reload, metadata, routing ambiguity, and managed endpoint tests. The candidate then passed the independent frozen-source verifier.
Existing feedback was assessed for deduplication. Earlier threads about stale diagnostics, collection invalidation, static-assets test setup, custom host metadata, and equivalent route/authorization metadata are separate concerns and are neither endorsed nor repeated as this finding. No unresolved candidates remain. Discarded checks included root-specific metadata selection, stale collection notifications, post-initialization convention updates, resource-collection state, public API/package/template changes, and browser-boundary test fit, each ruled out or assessed as non-applicable from frozen source.
Per-guide completion: docs/CrossCuttingGuidance.md complete; docs/BlazorComponentsGuidance.md complete. Guidance provenance: trusted workflow commit 415ed2bad38605bfc133a8bbed1877a3c9c82a94. No materially changed product area was left without a routed guide; unrelated lifecycle, rendering, interop, forms, and WebAssembly topics were assessed as non-applicable changed edges.
Test boundary: source review only; target code, builds, tests, CI, browser workflows, and samples were not executed. Security assessment was excluded by supplied policy. Proof is limited to tracked frozen Git source; symlink, submodule, and LFS targets are inert, and feedback posted after bundle preparation is not observable.
Generated by ASP.NET Core Pull Request Review for #70532 · copilot · gpt56 · 300.4 AIC · ⌖ 11.4 AIC · ⊞ 18.9K
Comment /review to run again
PureWeen
left a comment
There was a problem hiding this comment.
One new issue remains: endpoint sharing can drop the only matching framework endpoint because it ignores out-of-line route policies.
The existing diagnostics/suppression comment already covers the other supported issue. The earlier resource-collection scope note also remains relevant. I have not repeated either item.
Non-blocking unresolved traces and discarded checks
[UNRESOLVED] Host equivalence, line 123: G compared separate roots using RequireHost("EXAMPLE.COM") and RequireHost("example.com"). The verifier could not establish a binding deduplication requirement or the exact final ambiguity.
[UNRESOLVED] Method equivalence, line 122: G compared ["GET", "POST"] with ["POST", "GET"]. The verifier could not establish the same required contract and final-effect evidence. These traces are not confirmed defects.
[DISCARDED], routine checks: The arms ruled out cross-builder/group sharing, ordinary endpoint removal, unknown-metadata fallback, delegate equality, and data-source ordering concerns. They also ruled out startup-performance, invalidation, initialization-error, cancellation-lifetime, lock-ordering, and resource-metadata reset concerns. Other checks covered public API, DI, packaging, documentation scope, manifest staging, and test-layer ownership. The disposed-change-token edge predates this change.
Posted for informational purposes so the author can confirm the verifier didn't discard or leave unresolved a real finding; this item does not block agent-reviewed-approved.
Untested coverage: The arms noted missing cases for out-of-line policy maps, reversed registration order, custom diagnostics metadata, and equivalent host/method alternatives. Other gaps include successful dispatch through both shared framework URLs, post-initialization configuration changes, and two-WASM-root resource collections. Callback tests do not establish an actual Hot Reload edit session.
Validation boundary: All three arms used frozen source. They did not build, run tests, or use a browser.
Human-directed and GitHub Copilot-generated.
|
/review |
|
Copilot's local review panel found no issues to raise at this commit. All three local arms reviewed Non-blocking discarded checks[DISCARDED] G: equivalent per-root CORS conventions, at Routine negative checks covered metadata and route-policy preservation, route-builder isolation, change notifications, resource-state refresh, ordering, and delegate equality. These are not additional findings. Posted for informational purposes so the author can confirm the verifier didn't discard or leave unresolved a real finding; this item does not block Untested coverage, separate from discarded checks: Mocked render-mode providers do not establish complete Server/WebAssembly startup. The arms did not execute multi-root resource-module requests or an actual Hot Reload edit session. S also noted that the post-manifest-change Validation boundary: All three arms used frozen-source review; none ran a target build, test, sample, or browser. The current-head hosted Human-directed and GitHub Copilot-generated. |
|
@Yuvan111 The endpoint deduplication fix looks focused, but this metadata also changes route diagnostics when conventions rewrite a framework endpoint’s route pattern. Please keep the deduplication marker separate from |
|
@kotlarmilos , Addressed: the deduplication marker remains separate from IRouteDiagnosticsMetadata, and regression coverage now explicitly enforces that separation while validating the final rewritten route diagnostics. |
| { | ||
| (HttpMethodMetadata left, HttpMethodMetadata right) => | ||
| left.AcceptCorsPreflight == right.AcceptCorsPreflight && left.HttpMethods.SequenceEqual(right.HttpMethods), | ||
| (HostAttribute left, HostAttribute right) => left.Hosts.SequenceEqual(right.Hosts), |
There was a problem hiding this comment.
HostAttribute.Hosts is an allow-list, so entry order does not change matching. If two roots call RequireHost("a.example", "b.example") in opposite orders, SequenceEqual returns false and the collection retains both endpoints. A request matching either host can still be ambiguous. Compare host constraints independent of order and add a regression for this case.



Fix ambiguous Blazor framework endpoints when mapping multiple roots
Mapping multiple Blazor roots can cause duplicate framework endpoint matches and HTTP 500 responses. This fix resolves those matches while preserving host restrictions and root-specific conventions.
Before fix:
After fix:
Root cause
Each root registers the same framework handlers. Equally ranked matches cause AmbiguousMatchException, including across overlapping route groups.
Solution
Add an internal matcher policy that resolves ties between marked framework endpoints with matching handlers. Preserve normal routing priority and application endpoint ambiguity.
Test coverage
Two routing-level tests cover multiple roots, overlapping/separate groups, host restrictions, registration order, and response behavior.
Fixes #70461