Skip to content

refactor(cdp): split browser core and cdp scheduler - #386

Open
ldm0 wants to merge 102 commits into
mainfrom
browser-cdp-split3
Open

refactor(cdp): split browser core and cdp scheduler#386
ldm0 wants to merge 102 commits into
mainfrom
browser-cdp-split3

Conversation

@ldm0

@ldm0 ldm0 commented Sep 5, 2026

Copy link
Copy Markdown
Member

No description provided.

ldm0 added 30 commits September 5, 2026 04:54
ldm0 added 30 commits September 7, 2026 12:32
Move BrowserContext, WebContents, DocumentHost and navigation resources into the Core Browser owner. Share one AppState BrowserService across CDP, BiDi and Classic, and remove connection-owned engines and implicit Browser constructors.

Migrate protocol fixtures to exact Browser ownership and preserve Document-bound lifecycle, cookie policy and history behavior.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (17308 passed, 13 configured skips; run 093415a0-3472-4572-845a-d34464a6593d). Cookie/resource/site-data stress: 124 tests x 20 iterations passed. Full lifecycle exit and release/performance acceptance remain pending.
Replace six navigation-work maps with one stage enum registry. Keep an in-flight entry while work runs, invalidate it on Context/WebContents teardown, supersession and matching cancellation, and only finish into the original live entry. Preserve initial-document cancellation results.

Add no-DevTools Browser lifecycle and shutdown coverage through the native DocumentCommit boundary, plus controlled network regressions for six retirement paths. Restrict the local mutable Context test helper to test-support builds.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast: 17316 passed, 13 configured skips (9f93df95-07dd-4d68-9d59-f69dfe6cbdfb). The original late-completion regression failed 5/5 before the fix; 15 owner/initial-document regressions passed 20/20 stress iterations after it (d49fd9ab-0a1a-4e04-93c3-981a22817a37).
Close the ServiceWorker completion lane before teardown, retire versions and waiting state, and settle pending fetch and navigation-preload work. Reuse existing lifecycle terminal actions and remove the host-only teardown path. Persistent StoragePartition registrations remain untouched.

Add a no-DevTools Browser regression holding actual Window, module, DedicatedWorker, SharedWorker and ServiceWorker requests through Context removal and service shutdown. Verify peer Context isolation and retained endpoint cleanup. Add focused regressions for queued/late completion rejection and controlled fetch cancellation.

The live install-event retirement regression failed 5/5 before the fix (90e451fe-c445-407e-8a30-0a2c128d5de3); both new lower-level regressions also failed (ec666314-448a-4605-96f4-683be13be1c0). After the fix, 17 owner/context-shutdown tests passed all 20 stress iterations (94e66d7a-0932-4f4f-ae90-bf123c912531).

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast: 17319 passed, 13 configured skips (00248d27-c4fa-4d38-b672-aa6c5add8edb). Fixed dev artifact CDP: 43/43 groups, 451 scenarios; WebDriver: 7/7 groups, 165 checks. Artifacts: target/smoke/worker-context-retirement.pq0Gwa; binary SHA256 56a6f16b748c1be7f14e841bffb831fc82831cd08d85c4938f00bdb10a43272b.
…lers

Publish bounded Browser Context events with atomic snapshot/resubscription. Retire exact DevTools projections, sessions and pending calls through existing CDP, BiDi and Classic loops, without repeating native disposal or invalidating peer resource runtimes.

Validate fmt, workspace all-targets/all-features clippy, 17,331 nextest tests, 56 lifecycle/scheduler regressions across 20 stress iterations, and full public CDP/WebDriver smoke.
Bind the completion lane once and keep its receiver outside socket actors. Remove sender replacement APIs, forwarding parameters, and duplicate response waiters.

Reject renderer lifecycle callbacks after native Context retirement and preserve real Service Worker realm IDs across event and log routes. Cover ingress ownership, Classic/BiDi reattachment, and late lifecycle delivery.

Validation: cargo fmt --all; workspace all-targets/all-features clippy -D warnings; 17,340 nextest tests; 63 related tests x 100; public CDP 43 groups/451 scenarios and WebDriver 7 groups/165 checks.
Share commit snapshots and inspection projection between command completions and Browser events. Recover exact current Documents after subscriber lag, bind native renderer output from Core reservations, and restore inspection on attachment-scoped tasks. Preserve terminal calls across superseded projection fences.
Keep Classic HTTP and BiDi final lifecycle waits out of the adapter command turn, retaining exact replies, deadlines, and teardown semantics. Cancel parser source work on its last consumer without disrupting shared script consumers or Context HTTP-cache reuse.
Route Classic HTTP and attached BiDi through the shared scheduler with exact session context, Page and pending-command ownership. Remove the private Classic runtime loop and duplicated AppState runtime configuration.

Preserve cross-frontend document output, allocate unique child frame IDs, and consume bounded renderer ingress each owner turn to prevent control-message starvation. Cover shared-page progress, isolation and lifecycle output with real-server regressions.

Validation: workspace fmt and all-targets/all-features clippy; 17,387 nextest passes; focused regressions x20 and affected packages x3; CDP 43 groups/451 scenarios; full WebDriver 165 checks x3.
Share native membership adoption across startup snapshots, Created events and lag recovery without replacing native objects or binding the lazy default. Reuse shared AgentHost discovery and exact-Context auto-attachment.

Keep frozen Page publications with their originating journal until transport admission, remove the lossy context publisher, and cover native frontend reuse and independent Browser observers.
Keep activation work and selection revisions on the Browser owner; project exact native occurrences and remove Protocol selection transactions. Fix shared Classic runtime navigation-deadline leakage exposed by full validation.
Observe each original renderer journal from its exact Browser Document owner and publish lifecycle state independently of DevTools ingress. Remove the CDP lifecycle mutation entrypoint, keep projection receipt and visibility separate, and preserve terminal response ownership after renderer retirement or rejected publication.
Publish admission and retirement facts from the Browser owner with exact Navigation and Document identity. Recover native observation holds without releasing command response or Document projection fences. Remove legacy pending-navigation clear entry points.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant