Skip to content

Split relay Git handler responsibilities - #17217

Merged
nwparker merged 49 commits into
mainfrom
ra/max-lines-bottom-21-git-handler
Aug 30, 2026
Merged

nwparker merged 49 commits into
mainfrom
ra/max-lines-bottom-21-git-handler

Conversation

@nwparker

@nwparker nwparker commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 0
Prod 15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1622 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1406 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​216

Summary

  • reduce src/relay/git-handler.ts from 1,638 lines to a 271-line facade
  • split command termination, operation context and registration, reads, worktree changes and discards, comparisons, fetch, synchronization and rebase, object diffs, exec and clone-adjacent operations, and worktree operations into 13 focused source modules no larger than 217 lines
  • preserve the exact GitHandler facade export, dispatcher and shared cache/capability/stream/watcher ownership, runtime-replaceable git, gitBuffer, and spawnClone methods, and two-argument Git call arity
  • preserve all 57 non-suppression comments, all 338 non-import literals, all 44 RPC and notification names in order, and 68 of 69 moved named bodies byte-for-byte after whitespace normalization; the sole mismatch is the recomposed registration table
  • keep direct node:child_process use in the grandfathered facade and use the shared runProcess boundary in the extracted termination module
  • remove the resolved max-lines baseline entry without changing Git commands or wire payloads

Validation

  • pnpm tc
  • pnpm tc:node
  • all 28 git-handler test files — 230 passed
  • direct consumer and integration set — 20 files, 199 passed
  • affected regression rerun — 49 passed
  • independent semantic and structural refactor audits
  • real-commit mechanical move audit with all residue adjudicated
  • focused default, native-plugin, and type-aware Oxlint
  • pnpm run check:code-quality:changed — zero new findings
  • pnpm check:max-lines-ratchet — 65 entries
  • pnpm run check:runtime-electron-ratchet
  • max-lines and runtime-ratchet tests — 21 passed
  • formatting, dependency-cycle check, and git diff --check

Stacked on #17215.

@greptile-apps

greptile-apps Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR refactors the relay Git handler into a small facade backed by focused operation modules while preserving the existing RPC surface and shared runtime state.

  • Extracts Git reads, mutations, comparisons, synchronization, fetches, object diffs, execution, worktree operations, and command termination into dedicated modules.
  • Centralizes operation construction and RPC registration.
  • Removes the obsolete max-lines baseline exception and updates the global-fetch audit location.

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/relay/git-handler.ts Reduces the original handler to a facade that retains shared subprocess, cache, watcher, capability, and response-stream ownership.
src/relay/git-handler-registration.ts Reconstructs the existing Git RPC and notification registration surface against the extracted operation set.
src/relay/git-handler-operation-context.ts Defines the shared host contract through which extracted handlers access Git execution, caching, watchers, and streaming.
src/relay/git-handler-operation-set.ts Instantiates and groups the focused operation handlers around one shared facade host.
src/relay/git-handler-command-termination.ts Moves termination-aware Git execution onto the shared process runner while preserving timeout, abort, output, and error metadata behavior.
src/relay/git-handler-fetch-operations.ts Extracts fetch, fork synchronization, remote-tracking, and hosted-review ref operations.
src/relay/git-handler-sync-operations.ts Extracts push, pull, fast-forward, and rebase synchronization flows.
src/relay/git-handler-worktree-operations.ts Extracts worktree listing, creation, removal, cleanliness, repository detection, and base-ref refresh operations.
src/relay/git-handler-read-operations.ts Extracts status, history, ignored-path, submodule, and file-diff reads while retaining deduplication and streaming.
src/relay/git-handler-discard-operations.ts Extracts single and bulk discard behavior with worktree-boundary and literal-path protections.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Client[SSH Git provider] --> Dispatcher[Relay dispatcher]
  Dispatcher --> Registration[Git handler registration]
  Registration --> Read[Read operations]
  Registration --> Changes[Worktree change and discard]
  Registration --> Compare[Comparison and object diff]
  Registration --> Fetch[Fetch and synchronization]
  Registration --> Worktree[Worktree operations]
  Registration --> Exec[Exec and clone operations]
  Read --> Host[GitHandler facade / shared host]
  Changes --> Host
  Compare --> Host
  Fetch --> Host
  Worktree --> Host
  Exec --> Host
  Host --> Git[Git subprocess]
  Host --> Cache[Shared caches and capabilities]
  Host --> Stream[Response streaming]
Loading

Reviews (4): 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
…1-git-handler

# Conflicts:
#	config/max-lines-baseline.txt
#	src/renderer/src/hooks/automation-dispatch-completion.ts
@nwparker
nwparker changed the base branch from ra/max-lines-bottom-20-cdp-bridge to main August 30, 2026 03:19
@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 15 minutes.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 70545d0b-a10a-41cc-b6b3-7821d64a43b8

📥 Commits

Reviewing files that changed from the base of the PR and between f3334c1 and 52986ad.

📒 Files selected for processing (16)
  • config/max-lines-baseline.txt
  • src/main/global-fetch-call-site-audit.test.ts
  • src/relay/git-handler-command-termination.ts
  • src/relay/git-handler-comparison-operations.ts
  • src/relay/git-handler-discard-operations.ts
  • src/relay/git-handler-exec-operations.ts
  • src/relay/git-handler-fetch-operations.ts
  • src/relay/git-handler-object-diff-operations.ts
  • src/relay/git-handler-operation-context.ts
  • src/relay/git-handler-operation-set.ts
  • src/relay/git-handler-read-operations.ts
  • src/relay/git-handler-registration.ts
  • src/relay/git-handler-sync-operations.ts
  • src/relay/git-handler-worktree-change-operations.ts
  • src/relay/git-handler-worktree-operations.ts
  • src/relay/git-handler.ts

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 91a35b9 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

* Split relay Git handler responsibilities

* Track moved relay Git fetch audit

* 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