Skip to content

Split CDP bridge responsibilities - #17215

Merged
nwparker merged 46 commits into
mainfrom
ra/max-lines-bottom-20-cdp-bridge
Aug 30, 2026
Merged

nwparker merged 46 commits into
mainfrom
ra/max-lines-bottom-20-cdp-bridge

Conversation

@nwparker

@nwparker nwparker commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1823 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1382 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​441

Summary

  • reduce cdp-bridge.ts from 1,611 lines to a 277-line facade
  • split command composition, shared state and queueing, debugger events/lifecycle, navigation waits, ref/iframe recovery, and page, pointer, element, text-input, and tab commands into 12 focused source modules no larger than 224 lines
  • preserve the exact two-name facade export surface, complete public method/async/arity shape, original state-map ownership, and the runtime-private getRegisteredTabs() hook
  • preserve all 53 non-suppression comments, all 377 non-import literals, every pre-existing callee count, public Promise adoption, per-tab serialization, debugger/listener ordering, iframe routing, and navigation/network timer behavior
  • remove the resolved max-lines baseline entry without touching SSH or remote-browser behavior

Validation

  • pnpm tc
  • pnpm tc:node
  • eight focused browser/runtime suites — 105 passed
  • exact source preservation audit — public facade shape, 377 literals, 53 comments, pre-existing callee counts, named bodies, and split-internal cycles
  • independent structural and semantic refactor audits
  • changed-file Oxlint plus focused native and type-aware code-quality audits
  • pnpm run check:code-quality:changed — zero new findings
  • pnpm check:max-lines-ratchet — 66 entries
  • pnpm run check:runtime-electron-ratchet
  • max-lines and runtime-ratchet tests — 21 passed
  • changed-file formatting
  • git diff --check

Stacked on #17206.

@greptile-apps

greptile-apps Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR decomposes the CDP bridge into focused modules while retaining CdpBridge as the public facade.

  • Centralizes shared tab state and per-tab command serialization in CdpBridgeState.
  • Separates debugger lifecycle, event handling, navigation, reference resolution, and browser commands by responsibility.
  • Removes the obsolete max-lines baseline exemption for cdp-bridge.ts.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
src/main/browser/cdp-bridge.ts Reduces the original implementation to a facade delegating browser operations to the new command modules.
src/main/browser/cdp-bridge-state.ts Owns shared active-tab access, tab state, reference invalidation, and per-tab command queue processing.
src/main/browser/cdp-bridge-command-set.ts Constructs the shared lifecycle and resolution dependencies and exposes the focused command modules.
src/main/browser/cdp-debugger-lifecycle.ts Extracts debugger attachment, sender creation, listener registration, and teardown responsibilities.
src/main/browser/cdp-ref-resolution.ts Extracts snapshot-reference resolution, iframe routing, scrolling, and coordinate translation.
src/main/browser/cdp-page-commands.ts Contains page-level navigation, capture, scrolling, waiting, and evaluation commands.
src/main/browser/cdp-tab-commands.ts Contains active-tab selection, metadata lookup, listing, switching, and tab lifecycle handling.
config/max-lines-baseline.txt Removes the CDP bridge exemption after the facade falls below the configured line limit.

Class Diagram

%%{init: {'theme': 'neutral'}}%%
classDiagram
  class CdpBridge
  class CdpBridgeState
  class CdpBridgeCommandSet
  class CdpDebuggerLifecycle
  class CdpNavigationOperations
  class CdpRefResolution
  class CdpPageCommands
  class CdpPointerCommands
  class CdpElementStateCommands
  class CdpTextInputCommands
  class CdpTabCommands
  CdpBridge --> CdpBridgeState
  CdpBridge --> CdpBridgeCommandSet
  CdpBridgeCommandSet --> CdpDebuggerLifecycle
  CdpBridgeCommandSet --> CdpNavigationOperations
  CdpBridgeCommandSet --> CdpRefResolution
  CdpBridgeCommandSet --> CdpPageCommands
  CdpBridgeCommandSet --> CdpPointerCommands
  CdpBridgeCommandSet --> CdpElementStateCommands
  CdpBridgeCommandSet --> CdpTextInputCommands
  CdpBridgeCommandSet --> CdpTabCommands
Loading

Reviews (3): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

…ax-lines-bottom-10-automation-dispatch-events
…lines-bottom-20-cdp-bridge

# Conflicts:
#	src/main/browser/cdp-bridge.ts
…0-cdp-bridge

# Conflicts:
#	src/renderer/src/hooks/automation-dispatch-completion.ts
@nwparker
nwparker changed the base branch from ra/max-lines-bottom-19-local-pty-provider to main August 30, 2026 03:18
@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a1d89d84-e160-4a53-9354-a3458ab32485

📥 Commits

Reviewing files that changed from the base of the PR and between 5650ec8 and 59a8523.

📒 Files selected for processing (14)
  • config/max-lines-baseline.txt
  • src/main/browser/cdp-bridge-command-module.ts
  • src/main/browser/cdp-bridge-command-set.ts
  • src/main/browser/cdp-bridge-state.ts
  • src/main/browser/cdp-bridge.ts
  • src/main/browser/cdp-debugger-events.ts
  • src/main/browser/cdp-debugger-lifecycle.ts
  • src/main/browser/cdp-element-state-commands.ts
  • src/main/browser/cdp-navigation-operations.ts
  • src/main/browser/cdp-page-commands.ts
  • src/main/browser/cdp-pointer-commands.ts
  • src/main/browser/cdp-ref-resolution.ts
  • src/main/browser/cdp-tab-commands.ts
  • src/main/browser/cdp-text-input-commands.ts

📝 Walkthrough

Walkthrough

The CDP bridge now delegates browser automation to dedicated state, lifecycle, navigation, reference, page, tab, pointer, element, and text command modules. Shared state manages active tabs, per-tab records, reference invalidation, and FIFO command queues. Debugger lifecycle and event handling were extracted into separate modules. Page and interaction commands retain CDP operations through shared services.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit f3334c1 into main Aug 30, 2026
4 of 20 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* Split speech session lifecycle

* Split terminal output scheduler pipeline

* Split mobile browser pane modules

* Prune resolved max-lines suppressions

* Split pane tree equalization logic

* Extract mobile troubleshoot screen styles

* Split external automation manager

* Split main window service attachments

* Split hosted review creation checks

* Split automation dispatch event handling

* Split settings navigation metadata

* Split daemon initialization lifecycle

* Split GitLab item dialog

* Split relay dispatcher layers

* Split mobile host screen

* Retarget mobile view settings source test

* Split runtime file client layers

* Split ports panel layers

* Split runtime environments pane layers

* Split local PTY provider responsibilities

* Split CDP bridge responsibilities

* Fix F3-speech for stablyai#17123

* Fix F1-cycle for stablyai#17131

* Fix F4-navtest for stablyai#17157

* Fix F2-allowlist for stablyai#17161
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