Skip to content

Add generic DevFlow WebView package with layered Blazor support - #651

Closed
mattleibow wants to merge 1 commit into
mainfrom
mattleibow-webview-devflow-validation
Closed

mattleibow wants to merge 1 commit into
mainfrom
mattleibow-webview-devflow-validation

Conversation

@mattleibow

Copy link
Copy Markdown
Member

Summary

  • Add Microsoft.Maui.DevFlow.WebView for standard MAUI WebView and HybridWebView, sharing one embedded CDP engine without ASP.NET/Razor dependencies.
  • Layer the existing Blazor package on the engine, retaining registration/source entry points and adding Blazor readiness/routing.
  • Fix context selection, exact-once actions, CLI failures, native-first CLI/MCP screenshots, and late CDP replies. Generalize active-host and DOM layout correlation, including hosts without AutomationIds.
  • Wire shipping solutions, maintained mixed-host samples, regression tests, protocol/package documentation, and onboarding skills.

Schema rationale

ready and isReady were already both emitted by the agent. The schema now documents the existing compatibility alias rather than inventing a second readiness state. index, automationId, and active were likewise existing response fields absent from the schema. url already could be null; its schema now permits null. These corrections are optional-field documentation, not new required fields.

hostKind is new and identifies webview/hybrid/blazor adapters. Owner-aware contexts receive stable webview-<index> IDs so duplicate AutomationIds and retained inactive pages cannot target another view; existing UI aliases remain supported. Readiness now explicitly describes initialized CDP, not merely loaded HTML.

The screenshot contract documents native-first PNG capture, which CLI/MCP now use. Browser-network capture remains unimplemented; /api/v1/webview/network explicitly returns 501 instead of misrepresenting native .NET captures as browser traffic. /api/v1/network/requests remains available.

Compatibility / breaking changes

  • Advanced precompiled consumers of the inherited Blazor WebViewBridge/Bridges surface must rebuild because nested type identities change during extraction. Existing builder registration and source entry points remain.
  • AgentClient.SendCdpCommandAsync throws for HTTP/CDP/JavaScript errors, and CLI failures return nonzero exits rather than success-shaped error data.
  • The WebView network route changes from its native-store alias to explicit unsupported browser capture. Owner-aware context IDs are stable and unique; AutomationId, element-ID and numeric-index aliases remain.
  • includeWebViewElements enables generic DOM layout enrichment; omission retains the legacy includeBlazorElements behavior.

Verification

  • 54/54 live Mac Catalyst native/Blazor/generic integration cases passed: relative navigation, exact-once clicks, reload/reinjection, Hybrid messages, mixed/unnamed host correlation, DOM diagnostics and PNG screenshots.
  • 61/61 focused agent/bridge/protocol tests, 61/61 portable Client tests, and 12/12 CLI WebView tests passed.
  • Real MCP source, evaluation and Hybrid screenshot calls passed.
  • Generic package packs with README and no ASP.NET/Razor dependencies.
  • Final generic Android/iOS builds and Blazor iOS build passed; AppKit builds checked during extraction. Windows, GTK and WPF runtime parity is not claimed.
  • Independent interop review findings resolved: canonical context selection, unique internal wire IDs across external ID reuse/timeouts, and root/scheme-relative URL resolution.

The broader CLI subset reported two failures in unchanged gesture paths (UiGesture_ReportsWhichTierHandledIt, UiGesture_Pinch_SendsScaleToGestureRoute); targeted WebView checks are green. Apple validation used Xcode 26.6 per process because the existing sample lacks the scene lifecycle required by the selected Xcode 27.

Extract shared CDP tooling for WebView and HybridWebView, preserve Blazor-specific integration, and fix context selection, exact-once actions, error reporting, and screenshots. Add maintained mixed-host samples, regression coverage, and protocol documentation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 606dd4d0-f861-42fc-8722-8b7df1a81773
@mattleibow mattleibow added the breaking-change This PR contains breaking changes label Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Expert Code Review — PR #651

Methodology: 2 independent reviewers (1 failed — reduced coverage, no tiebreaker) with adversarial consensus. Because this 63-file PR required batch splitting, batch-local findings were included at downgraded severity and marked low confidence.

Results: 2 findings posted as inline comments (0 critical, 0 moderate, 2 minor).

CI status: 56 checks reported; most completed checks are successful or skipped, several builds remain in progress, and handler-tests is currently failing.

Test coverage: The PR adds or updates targeted CLI, agent integration, client, registry/action, and WebView debug-service tests for the changed behavior. Runtime parity is not claimed for Windows, GTK, or WPF in the PR description.

Generated by Expert Code Review · 2 independent reviewers with adversarial consensus

Generated by Expert Code Review (auto) for #651 · copilot · gpt56 · 178.9 AIC · ⌖ 12.4 AIC · ⊞ 37.6K · ◷

@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.

Expert Code Review: 2 low-confidence batch-split findings posted inline. See the lean summary comment for methodology, CI state, and test coverage.

Generated by Expert Code Review (auto) for #651 · copilot · gpt56 · 178.9 AIC · ⌖ 12.4 AIC · ⊞ 37.6K

{
ObjectDisposedException.ThrowIf(_disposed, this);
var bridge = new WebViewBridge(this, evalJs, reload, navigate, automationId, deactivated, hostKind, owner);
_bridges.Add(bridge);

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.

🟢 MINOR — low confidence, single reviewer (batch split)

Each handler attachment appends a bridge, but deactivation never removes or reuses it. Repeated page/WebView recreation therefore leaves the singleton service retaining all historical bridges and their synchronization/lifetime objects, while Initialize() and Bridges continue traversing them. Please retire/dispose inactive bridges or reuse stable slots, with a repeated attach/detach test that verifies bounded storage.

return bridge?.InitializeAndMonitorAsync() ?? Task.CompletedTask;
}

public Task<string> SendCdpCommandAsync(string cdpJson) => SendCdpCommandAsync(0, cdpJson);

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.

🟢 MINOR — low confidence, single reviewer (batch split)

SendCdpCommandAsync(string) always targets bridge index 0. After a WebView handler is replaced, the old bridge is deactivated and the replacement is appended, so this compatibility overload can keep sending to the inactive bridge and return “WebView is no longer available” while an active replacement exists. Please resolve the current active/ready bridge (or track an explicit default) and cover detach/reattach through this overload.

@mattleibow

Copy link
Copy Markdown
Member Author

Superseded by the verified native stack: #652 corrects the existing protocol specs without changing runtime, and #655 carries the generic WebView implementation, additive Blazor adapter, clean context contract, tests and documentation. All intended feature changes were carried forward; compatibility shims and aliases were deliberately removed under the lockstep agent/CLI/bridge upgrade decision. Closing this original PR without merging; review and merge the replacement stack instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change This PR contains breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant