Repository navigation
refactor(comments): slim verbose comments in main integrations (git/providers) - #9543
Conversation
…roviders/…)
Collapse multi-line explanatory comment blocks into single-line "why" statements
per AGENTS.md ("Document the Why, Briefly"): drop restatements of the code and
mechanism narration; keep the non-obvious reason, external refs, and directives.
Comments-only — verified no code changed via a Babel/esbuild comment-strip
token-equality gate against origin/main; typecheck and oxlint clean.
Area: main — git, source-control, providers & integrations. 40 files changed, 1432 insertions(+), 4473 deletions(-).
Co-authored-by: Orca <[email protected]>
📝 WalkthroughWalkthroughThe pull request primarily revises explanatory comments across browser, account, hook, Git, hosted-review, speech, and SSH modules. Functional changes include safer agent-browser argument construction, improved tab/session lifecycle errors, OpenCode dangling-symlink handling, Codex hook/trust reconciliation updates, exported Git remote-count parsing, improved tracked-upstream retry coordination, and related test assertion updates. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b354cc8c-e5fc-412c-9596-7c4fada199ea
📒 Files selected for processing (40)
src/main/browser/agent-browser-bridge.tssrc/main/browser/browser-cookie-import.tssrc/main/browser/browser-guest-ui.tssrc/main/browser/browser-manager.tssrc/main/browser/browser-session-registry.tssrc/main/browser/cdp-bridge.tssrc/main/browser/grab-guest-script.tssrc/main/claude-accounts/runtime-auth-service.tssrc/main/claude/hook-service.tssrc/main/cli/cli-installer.tssrc/main/codex-accounts/runtime-home-service.tssrc/main/codex-accounts/service.tssrc/main/codex/config-settings-promotion.tssrc/main/codex/config-toml-trust.test.tssrc/main/codex/config-toml-trust.tssrc/main/codex/hook-service.tssrc/main/cursor/hook-service.tssrc/main/devin/hook-service.tssrc/main/gemini/hook-service.tssrc/main/git/repo.test.tssrc/main/git/repo.tssrc/main/git/runner.tssrc/main/git/status.tssrc/main/git/worktree.tssrc/main/github/client.tssrc/main/github/pr-refresh-coordinator.tssrc/main/github/project-view.tssrc/main/github/rate-limit.tssrc/main/github/work-item-details.tssrc/main/gitlab/client.tssrc/main/opencode/hook-service.test.tssrc/main/opencode/hook-service.tssrc/main/ports/advertised-url-watcher.tssrc/main/source-control/hosted-review-creation.tssrc/main/speech/model-manager.tssrc/main/ssh/ssh-connection.tssrc/main/ssh/ssh-relay-deploy.tssrc/main/ssh/ssh-relay-native-deps-install.test.tssrc/main/ssh/ssh-relay-session.tssrc/main/ssh/ssh-relay-versioned-install.ts
| // that runs in the page's own world. Keeping it as a template here lets main | ||
| // version it alongside the rest of the grab lifecycle. | ||
| // --------------------------------------------------------------------------- | ||
| /* eslint-disable max-lines -- the guest overlay runtime is one self-contained JS string injected atomically; splitting it adds a concat build step for no auditability gain. */ |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚖️ Poor tradeoff
Remove the max-lines disable directive.
As per coding guidelines, **/*.{js,jsx,ts,tsx} files must "Never disable ESLint or Oxlint max-lines, including line-specific disables". Please remove these directives and consider splitting the files if they exceed the maximum line limit.
src/main/browser/grab-guest-script.ts#L1-L1: remove theeslint-disable max-linescomment.src/main/browser/browser-guest-ui.ts#L1-L1: remove theeslint-disable max-linescomment.src/main/browser/browser-session-registry.ts#L1-L1: remove theeslint-disable max-linescomment.src/main/claude-accounts/runtime-auth-service.ts#L1-L1: remove theeslint-disable max-linescomment.src/main/github/pr-refresh-coordinator.ts#L1-L1: remove theeslint-disable max-linescomment.src/main/github/project-view.ts#L1-L1: remove theeslint-disable max-linescomment.src/main/browser/browser-manager.ts#L1-L1: remove theeslint-disable max-linescomment.src/main/browser/browser-cookie-import.ts#L1-L1: remove theeslint-disable max-linescomment.
📍 Affects 8 files
src/main/browser/grab-guest-script.ts#L1-L1(this comment)src/main/browser/browser-guest-ui.ts#L1-L1src/main/browser/browser-session-registry.ts#L1-L1src/main/claude-accounts/runtime-auth-service.ts#L1-L1src/main/github/pr-refresh-coordinator.ts#L1-L1src/main/github/project-view.ts#L1-L1src/main/browser/browser-manager.ts#L1-L1src/main/browser/browser-cookie-import.ts#L1-L1
Source: Coding guidelines
| /* eslint-disable max-lines -- Why: this service intentionally keeps Codex | ||
| account lifecycle, path safety, login, and identity parsing in one audited | ||
| main-process module so the managed-account boundary stays explicit. */ | ||
| /* eslint-disable max-lines -- Why: keeps Codex account lifecycle, path safety, login, and identity parsing in one audited main-process module. */ |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Do not disable max-lines.
As per coding guidelines, you must never disable ESLint or Oxlint max-lines, including line-specific disables. Please remove the max-lines directive from these comments.
src/main/codex-accounts/service.ts#L1-L1: Remove theeslint-disable max-linesblock and keep just the// Why: ...comment.src/main/github/work-item-details.ts#L1-L1: Remove theeslint-disable max-linesblock and keep just the// Why: ...comment.src/main/ports/advertised-url-watcher.ts#L1-L1: Removemax-lines(leavingno-control-regex) in theeslint-disableblock.src/main/codex-accounts/runtime-home-service.ts#L1-L1: Remove theeslint-disable max-linesblock and keep just the// Why: ...comment.
♻️ Proposed fixes
For src/main/codex-accounts/service.ts, src/main/github/work-item-details.ts, and src/main/codex-accounts/runtime-home-service.ts:
-/* eslint-disable max-lines -- Why: ... */
+// Why: ...For src/main/ports/advertised-url-watcher.ts:
-/* eslint-disable no-control-regex, max-lines -- ... */
+/* eslint-disable no-control-regex -- ... */📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /* eslint-disable max-lines -- Why: keeps Codex account lifecycle, path safety, login, and identity parsing in one audited main-process module. */ | |
| // Why: keeps Codex account lifecycle, path safety, login, and identity parsing in one audited main-process module. |
📍 Affects 4 files
src/main/codex-accounts/service.ts#L1-L1(this comment)src/main/github/work-item-details.ts#L1-L1src/main/ports/advertised-url-watcher.ts#L1-L1src/main/codex-accounts/runtime-home-service.ts#L1-L1
Source: Coding guidelines
| @@ -1,5 +1,4 @@ | |||
| /* eslint-disable max-lines -- Why: co-locating all GitHub client functions keeps the | |||
| concurrency acquire/release pattern and error handling consistent across operations. */ | |||
| /* eslint-disable max-lines -- Why: co-locating all GitHub client functions keeps acquire/release and error handling consistent. */ | |||
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Remove the max-lines disable directive.
As per coding guidelines, never disable ESLint or Oxlint max-lines, including line-specific disables.
🐛 Proposed fix
-/* eslint-disable max-lines -- Why: co-locating all GitHub client functions keeps acquire/release and error handling consistent. */📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /* eslint-disable max-lines -- Why: co-locating all GitHub client functions keeps acquire/release and error handling consistent. */ |
Source: Coding guidelines
| // Why: a concurrent snapshot may finish before this branch exists in git; re-probe instead of returning a synthetic null. | ||
| const retryInFlight = trackedUpstreamSnapshotInFlight.get(cacheKey) | ||
| if (retryInFlight) { | ||
| const retryResult = await retryInFlight | ||
| return retryResult.upstreamsByBranchName.get(branchName) ?? null | ||
| } | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Prevent bypassing the re-probe if retryInFlight is the same promise.
Depending on the JavaScript engine's microtask scheduling, trackedUpstreamSnapshotInFlight.get(cacheKey) might still return the original inFlight promise if the worker's finally block hasn't executed to clear it yet. If this happens, retryInFlight === inFlight, causing the code to erroneously return null (the synthetic null we want to avoid) instead of falling through to initiate a new probe.
Ensure that the retry promise is strictly a newer one.
🐛 Proposed fix
// Why: a concurrent snapshot may finish before this branch exists in git; re-probe instead of returning a synthetic null.
const retryInFlight = trackedUpstreamSnapshotInFlight.get(cacheKey)
- if (retryInFlight) {
+ if (retryInFlight && retryInFlight !== inFlight) {
const retryResult = await retryInFlight
return retryResult.upstreamsByBranchName.get(branchName) ?? null
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Why: a concurrent snapshot may finish before this branch exists in git; re-probe instead of returning a synthetic null. | |
| const retryInFlight = trackedUpstreamSnapshotInFlight.get(cacheKey) | |
| if (retryInFlight) { | |
| const retryResult = await retryInFlight | |
| return retryResult.upstreamsByBranchName.get(branchName) ?? null | |
| } | |
| } | |
| // Why: a concurrent snapshot may finish before this branch exists in git; re-probe instead of returning a synthetic null. | |
| const retryInFlight = trackedUpstreamSnapshotInFlight.get(cacheKey) | |
| if (retryInFlight && retryInFlight !== inFlight) { | |
| const retryResult = await retryInFlight | |
| return retryResult.upstreamsByBranchName.get(branchName) ?? null | |
| } | |
| } |
| JS plugin source emitted into OpenCode's plugins directory as a single | ||
| file; splitting the plugin source across TS modules would obscure the | ||
| runtime artifact and scatter tightly coupled string-template logic. */ | ||
| /* eslint-disable max-lines -- Why: holds an inline JS plugin source emitted as one file; splitting across TS modules would scatter tightly coupled string-template logic. */ |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔴 Critical | ⚡ Quick win
Remove the max-lines disable directive.
As per coding guidelines, you must never disable ESLint or Oxlint max-lines, including line-specific disables. Please remove this directive and refactor the code (e.g., extracting the inline plugin source or other logic into separate modules) to comply with the line limit.
🐛 Proposed fix
-/* eslint-disable max-lines -- Why: holds an inline JS plugin source emitted as one file; splitting across TS modules would scatter tightly coupled string-template logic. */📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /* eslint-disable max-lines -- Why: holds an inline JS plugin source emitted as one file; splitting across TS modules would scatter tightly coupled string-template logic. */ |
Source: Coding guidelines
| @@ -1,5 +1,4 @@ | |||
| /* eslint-disable max-lines -- Why: provider detection, eligibility, and creation | |||
| preflight share one boundary so renderer and main-process gating cannot drift. */ | |||
| /* eslint-disable max-lines -- Why: detection, eligibility, and creation preflight share one boundary so gating can't drift. */ | |||
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift
Remove max-lines lint disables.
The codebase has a strict policy against disabling the max-lines rule. As per coding guidelines, never disable ESLint or Oxlint max-lines, including line-specific disables. Please refactor the code to stay within the file length limit (e.g., by splitting logic into smaller modules), rather than suppressing the linter rule.
src/main/source-control/hosted-review-creation.ts#L1-L1: Remove theeslint-disable max-linesdirective and refactor to comply.src/main/gitlab/client.ts#L1-L1: Remove theeslint-disable max-linesdirective and refactor to comply.src/main/ssh/ssh-relay-deploy.ts#L2-L2: Remove theeslint-disable max-linesdirective and refactor to comply.src/main/git/runner.ts#L1-L1: Remove theeslint-disable max-linesdirective and refactor to comply.
📍 Affects 4 files
src/main/source-control/hosted-review-creation.ts#L1-L1(this comment)src/main/gitlab/client.ts#L1-L1src/main/ssh/ssh-relay-deploy.ts#L2-L2src/main/git/runner.ts#L1-L1
Source: Coding guidelines
…roviders/…) (stablyai#9543) Collapse multi-line explanatory comment blocks into single-line "why" statements per AGENTS.md ("Document the Why, Briefly"): drop restatements of the code and mechanism narration; keep the non-obvious reason, external refs, and directives. Comments-only — verified no code changed via a Babel/esbuild comment-strip token-equality gate against origin/main; typecheck and oxlint clean. Area: main — git, source-control, providers & integrations. 40 files changed, 1432 insertions(+), 4473 deletions(-). Co-authored-by: Orca <[email protected]>
Slim verbose code comments — main — git, source-control, providers & integrations
Part of a codebase-wide sweep to slim over-verbose comments per
AGENTS.md→ Document the "Why", Briefly. Comments should state the non-obvious why, not narrate the what/how when the code is already clear; multi-line blocks collapse to a single line.This PR — main — git, source-control, providers & integrations: 40 files changed, 1432 insertions(+), 4473 deletions(-).
What changed
Why:paragraphs → one-line why-statements.eslint-disable,@ts-expect-error,oxlint-disable, …),TODO/FIXME, JSDoc tags, and every genuine non-obvious reason / external reference (issue numbers, platform quirks, race & ordering constraints).useEffect/ regex / bitwise / concurrency: kept a ≤1-line summary where it aids reading.{/* … */}comment text shortened; comments inside template-literal strings left untouched.Safety
Every file in this PR is comments-only — enforced deterministically by stripping all comments (incl. JSX
{/* */}) from bothorigin/mainand the change and confirming the remaining code tokens are identical.pnpm typecheck✅ ·oxlint✅ (no new findings vsmain).Part of a set of 6 area PRs from one sweep.
🤖 Generated with Claude Code
Made with Orca 🐋