Skip to content

DevFlow: use canonical WebView context IDs across tooling (Unit 3) - #662

Draft
mattleibow wants to merge 1 commit into
mattleibow-shared-webview-bridgefrom
mattleibow-canonical-webview-contexts
Draft

mattleibow wants to merge 1 commit into
mattleibow-shared-webview-bridgefrom
mattleibow-canonical-webview-contexts

Conversation

@mattleibow

@mattleibow mattleibow commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Make WebView targeting consistent and unambiguous across HTTP, Client, CLI, MCP and Inspector.

  • Give every registration a unique canonical webview-<index> ID, including unnamed and duplicate-AutomationId hosts. Index, AutomationId, elementId and descriptive hostKind remain metadata, not alternate selectors.
  • Use contextId throughout the protocol and tooling, with CLI --context-id. Explicit blank, invalid or removed selectors fail without selecting another document. Omission/JSON-null retains the active-host default; query contextId takes precedence over typed-body contextId.
  • Emit only ready for readiness. Preserve internal readiness checks and native-owner correlation.
  • Reject malformed/non-object Inspector JSON, duplicate contextId and removed webviewId fields before dispatch. Initially select an active-ready host and freeze the selected target before JavaScript confirmation.
  • Update human-readable context listing/status, consumer tests, protocol schemas/examples and mirrored guidance.

Compatibility

Obtain IDs from /api/v1/webview/contexts. Numeric indices, AutomationIds and element IDs no longer select contexts. HTTP webview, Inspector/MCP webviewId, CLI --webview/-w and the duplicate isReady field are removed; C# named arguments use contextId.

Update Agent, CLI, Client, WebView and Blazor packages together and rebuild consumers. No selector/readiness compatibility shims remain. Portable Client support, Driver namespaces/type forwards and descriptive hostKind extensibility are preserved.

Validation

Contract tests cover valid/default/null targeting, query/body precedence, duplicate IDs, removed/blank values and zero dispatch for invalid selections. Inspector proxy tests reject 40 invalid requests without downstream calls and dispatch six valid/default/null requests exactly once. Client, CLI/MCP and protocol regressions pass; netstandard2.0 builds.

Actual Chromium Inspector tests verify initial selection and a target frozen through confirmation. Agent/shared-engine/CLI/MCP document-isolation proofs exercise one click/fill event sequence, useful errors, native PNG targeting and failure exits. Mac Catalyst target isolation and original Hybrid/native callbacks are also exercised; no Windows/GTK/WPF or physical-device runtime claim.

Related: #654, #621, #232, #407. No timing, screenshot-flake or native-crash resolution is claimed.

@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: 2 independent reviewers found no issues. Methodology: 2-model adversarial consensus. (1 reviewer failed to complete — reduced coverage, no tiebreaker)

Generated by Expert Code Review (auto) for #662 · copilot · gpt56 · 322.4 AIC · ⌖ 21.4 AIC · ⊞ 37.6K · ◷

@mattleibow

Copy link
Copy Markdown
Member Author

Current consolidation position: this draft canonical-context layer is directly above the prepared #661, at head 99c89ad77813c93530b6de82dc5d8c2d875b8528, in the unified native stack. Earlier base hashes and original implementation counts in the initial description are historical.

The canonical-only slice maps 31 original files to 35 because regressions were composed into the smaller bug fixes existing test files. Direct single-evaluation CLI JavaScript and CDP Input.insertText remain intact rather than restoring the old bundled typed-CLI migration. Useful failures, native PNGs and aggregate batch exits are preserved. Invalid/removed/blank targets still cannot silently select a default, and Inspector confirmation freezes its selected target. Layout remains the next #664 layer. Every PR remains draft; the complete-graph evidence and retained limits are recorded on #665.

@Redth Redth added the DevFlow Issues or PRs that have to do with DevFlow label Oct 13, 2026
@mattleibow
mattleibow force-pushed the mattleibow-canonical-webview-contexts branch 4 times, most recently from 3f373e7 to e460680 Compare October 14, 2026 12:51
@mattleibow
mattleibow force-pushed the mattleibow-canonical-webview-contexts branch from e460680 to c8349af Compare October 14, 2026 13:46
Require contextId with webview-<index> IDs and ready-only responses. Migrate portable Client, CLI, MCP, Inspector, existing tests and contract guidance together; reject removed and invalid selectors before document dispatch.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a938040f-8bf7-45ea-bd22-f199669fdd18
@mattleibow
mattleibow force-pushed the mattleibow-canonical-webview-contexts branch from c8349af to 2ca56e1 Compare October 15, 2026 03:04

This branch has not been deployed

No deployments
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 DevFlow Issues or PRs that have to do with DevFlow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants