Repository navigation
Conversation
2c797cc to
2160bc6
Compare
2160bc6 to
bb948e8
Compare
📝 WalkthroughWalkthroughAdds remote commit-file URL resolution across Git providers, local and SSH runtimes, IPC, RPC, preload APIs, and browser runtime clients. Extends Source Control with persisted commit-file list/tree preferences, context-menu actions, lazy loading, tree rendering, virtualized history rows, refresh handling, and resizable panels. Adds validation, persistence, unit, integration, and end-to-end coverage, plus localized strings and style guidance. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
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: 1
🧹 Nitpick comments (2)
src/main/runtime/rpc/methods/git-params.ts (1)
254-269: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDocument the constraint rationale with a
// Why:comment.The try/catch block mapping
normalizeRuntimeRelativePathfailures to a validation error is a specific constraint pattern. As per coding guidelines, please add a concise comment explaining why this constraint exists (e.g., rejecting path traversal and invalid paths before runtime evaluation).📝 Proposed comment addition
const GitRelativePath = z .unknown() .transform((value) => (typeof value === 'string' ? value : '')) .pipe(z.string().min(1, 'Missing relative path')) + // Why: reject path traversal and invalid relative paths before URL resolution. .transform((value, context) => { try { return normalizeRuntimeRelativePath(value)Source: Coding guidelines
tests/e2e/source-control-large-file-count.spec.ts (1)
536-537: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
deepPathsilently depends on the fixture'sfilesPerDirectorydefault (100).The
/ 100divisor andpadStartwidths must matchwriteFileTreeinlarge-file-count-fixtures.ts. Since this test doesn't passfilesPerDirectory, it relies on the default staying100; if that default ever changes, the computed path diverges and the deep-file assertions fail confusingly rather than at the source. Consider deriving the divisor from a shared constant.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 68b2ee31-ccf1-4c70-9bae-e7a11b77bfba
📥 Commits
Reviewing files that changed from the base of the PR and between f8b430f and 2160bc69f8f5b61946c2e161facab9da1860c60a.
📒 Files selected for processing (56)
docs/STYLEGUIDE.mdsrc/main/codex-accounts/runtime-home-service.test.tssrc/main/codex-accounts/service.test.tssrc/main/git/hosted-remote-url.test.tssrc/main/git/hosted-remote-url.tssrc/main/git/repo-hosted-url.test.tssrc/main/git/repo.tssrc/main/ipc/filesystem.test.tssrc/main/ipc/filesystem.tssrc/main/persistence.test.tssrc/main/providers/ssh-git-provider.test.tssrc/main/providers/ssh-git-provider.tssrc/main/providers/types.tssrc/main/runtime/orca-runtime-git.test.tssrc/main/runtime/orca-runtime-git.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/git-params.tssrc/main/runtime/rpc/methods/git.test.tssrc/main/runtime/rpc/methods/git.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/right-sidebar/GitHistoryCommitFileContextMenu.test.tsxsrc/renderer/src/components/right-sidebar/GitHistoryCommitFileContextMenu.tsxsrc/renderer/src/components/right-sidebar/GitHistoryCommitFiles.test.tssrc/renderer/src/components/right-sidebar/GitHistoryCommitFiles.tsxsrc/renderer/src/components/right-sidebar/GitHistoryPanel.test.tsxsrc/renderer/src/components/right-sidebar/GitHistoryPanel.tsxsrc/renderer/src/components/right-sidebar/GitHistoryPanel.virtualization.test.tsxsrc/renderer/src/components/right-sidebar/GitHistoryRefreshError.tsxsrc/renderer/src/components/right-sidebar/SourceControl.tsxsrc/renderer/src/components/right-sidebar/SourceControl.virtual-file-list.test.tsxsrc/renderer/src/components/right-sidebar/git-history-panel-overflow-menu.tsxsrc/renderer/src/components/right-sidebar/git-history-virtual-rows.test.tssrc/renderer/src/components/right-sidebar/git-history-virtual-rows.tssrc/renderer/src/components/right-sidebar/source-control-tree.tssrc/renderer/src/components/right-sidebar/source-control-virtual-file-list.test.tsxsrc/renderer/src/components/right-sidebar/source-control-virtual-file-list.tsxsrc/renderer/src/components/right-sidebar/use-git-history-commit-files.tssrc/renderer/src/components/right-sidebar/use-git-history-panel-resize.tssrc/renderer/src/components/right-sidebar/useGitHistoryCommitActions.test.tsxsrc/renderer/src/components/right-sidebar/useGitHistoryCommitActions.tssrc/renderer/src/components/right-sidebar/useGitHistoryCommitFileActions.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/runtime/runtime-git-client.test.tssrc/renderer/src/runtime/runtime-git-client.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/constants.test.tssrc/shared/constants.tssrc/shared/types.tstests/e2e/large-file-count-fixtures.tstests/e2e/source-control-large-file-count.spec.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/right-sidebar/use-git-history-panel-resize.test.ts (1)
42-72: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for keyboard resize and the
collapsedguard.This suite only exercises pointer-based resize ownership/cleanup.
onResizeKeyDown(ArrowUp/ArrowDown/Home/End + clamping) and thecollapsedbranch ofonResizePointerDownare part of the hook's public surface (and wired to a keyboard-accessible separator witharia-valuemin/max/nowinGitHistoryPanel.tsx), but have no test coverage here.Also, Line 59 hardcodes
256as the expected default height; referencing the hook's exported default constant instead would keep the test resilient if the default changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a5c842ef-a178-43e8-9c96-f4480ec9b929
📥 Commits
Reviewing files that changed from the base of the PR and between 2160bc69f8f5b61946c2e161facab9da1860c60a and bb948e89cf15306a2067d3a565d6d6c2ff5980fb.
📒 Files selected for processing (47)
docs/STYLEGUIDE.mdsrc/main/git/hosted-remote-url.test.tssrc/main/git/hosted-remote-url.tssrc/main/git/repo-hosted-url.test.tssrc/main/git/repo.tssrc/main/ipc/filesystem.test.tssrc/main/ipc/filesystem.tssrc/main/providers/ssh-git-provider.test.tssrc/main/providers/ssh-git-provider.tssrc/main/providers/types.tssrc/main/runtime/orca-runtime-git.test.tssrc/main/runtime/orca-runtime-git.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/git-params.tssrc/main/runtime/rpc/methods/git.test.tssrc/main/runtime/rpc/methods/git.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/right-sidebar/GitHistoryCommitFileContextMenu.test.tsxsrc/renderer/src/components/right-sidebar/GitHistoryCommitFileContextMenu.tsxsrc/renderer/src/components/right-sidebar/GitHistoryCommitFiles.test.tssrc/renderer/src/components/right-sidebar/GitHistoryCommitFiles.tsxsrc/renderer/src/components/right-sidebar/GitHistoryPanel.test.tsxsrc/renderer/src/components/right-sidebar/GitHistoryPanel.tsxsrc/renderer/src/components/right-sidebar/GitHistoryPanel.virtualization.test.tsxsrc/renderer/src/components/right-sidebar/SourceControl.tsxsrc/renderer/src/components/right-sidebar/git-history-virtual-rows.test.tssrc/renderer/src/components/right-sidebar/git-history-virtual-rows.tssrc/renderer/src/components/right-sidebar/source-control-virtual-file-list.test.tsxsrc/renderer/src/components/right-sidebar/source-control-virtual-file-list.tsxsrc/renderer/src/components/right-sidebar/use-git-history-panel-resize.test.tssrc/renderer/src/components/right-sidebar/use-git-history-panel-resize.tssrc/renderer/src/components/right-sidebar/useGitHistoryCommitActions.test.tsxsrc/renderer/src/components/right-sidebar/useGitHistoryCommitActions.tssrc/renderer/src/components/right-sidebar/useGitHistoryCommitFileActions.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/runtime/runtime-git-client.test.tssrc/renderer/src/runtime/runtime-git-client.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/types.tstests/e2e/large-file-count-fixtures.tstests/e2e/source-control-large-file-count.spec.ts
🚧 Files skipped from review as they are similar to previous changes (36)
- src/main/runtime/orca-runtime.ts
- src/renderer/src/components/right-sidebar/GitHistoryCommitFileContextMenu.test.tsx
- src/renderer/src/components/right-sidebar/git-history-virtual-rows.ts
- src/renderer/src/web/web-preload-api.ts
- src/main/providers/ssh-git-provider.test.ts
- src/preload/api-types.ts
- src/renderer/src/components/right-sidebar/GitHistoryCommitFileContextMenu.tsx
- src/renderer/src/components/right-sidebar/source-control-virtual-file-list.tsx
- src/shared/types.ts
- src/renderer/src/components/right-sidebar/GitHistoryCommitFiles.test.ts
- src/main/runtime/rpc/methods/git.ts
- src/renderer/src/components/right-sidebar/useGitHistoryCommitFileActions.ts
- src/preload/index.ts
- src/renderer/src/components/right-sidebar/git-history-virtual-rows.test.ts
- src/renderer/src/i18n/locales/es.json
- src/renderer/src/web/web-preload-api.test.ts
- src/main/runtime/rpc/methods/git-params.ts
- src/renderer/src/runtime/runtime-git-client.ts
- src/renderer/src/components/right-sidebar/GitHistoryPanel.virtualization.test.tsx
- src/renderer/src/components/right-sidebar/use-git-history-panel-resize.ts
- docs/STYLEGUIDE.md
- src/renderer/src/i18n/locales/ko.json
- src/main/git/hosted-remote-url.test.ts
- src/renderer/src/components/right-sidebar/GitHistoryPanel.test.tsx
- src/main/ipc/filesystem.ts
- src/renderer/src/i18n/locales/zh.json
- src/renderer/src/components/right-sidebar/useGitHistoryCommitActions.test.tsx
- src/main/git/repo-hosted-url.test.ts
- src/main/ipc/filesystem.test.ts
- src/main/runtime/orca-runtime-git.test.ts
- src/main/runtime/rpc/methods/git.test.ts
- tests/e2e/source-control-large-file-count.spec.ts
- src/renderer/src/i18n/locales/en.json
- src/renderer/src/i18n/locales/ja.json
- src/renderer/src/components/right-sidebar/SourceControl.tsx
- src/renderer/src/components/right-sidebar/GitHistoryCommitFiles.tsx
bb948e8 to
f1e47d5
Compare
Add a list/tree layout switch for the expanded commit file list in the Git History panel, reusing the changes-tree builder and geometry. The layout persists as its own sourceControlCommitViewMode setting so the upper changes-layout control cannot alter it, and the action lives in a new overflow menu on the panel header to match the changes header's three-dots pattern (and VS Code). Directory collapse state lives in the panel hook under per-commit namespaced keys so it survives row collapse like the cached file list, and a generation counter discards stale file loads that resolve after a refresh. Tree chevrons honor reduced-motion settings.
f1e47d5 to
be87079
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/runtime/rpc/methods/git-params.ts (1)
270-276: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReuse
GitRelativePathfor consistent path normalization.
GitRemoteFileUrlduplicates the raw string coercion andmin(1)check, but misses out on thenormalizeRuntimeRelativePathlogic. Reusing the newly createdGitRelativePathschema here ensures all relative path handling is consistent and validated against unsafe paths.♻️ Proposed refactor
export const GitRemoteFileUrl = WorktreeSelector.extend({ - relativePath: z - .unknown() - .transform((v) => (typeof v === 'string' ? v : '')) - .pipe(z.string().min(1, 'Missing relative path')), + relativePath: GitRelativePath, line: z.number().int().min(1) })
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 56419655-0894-4a94-bfc7-a0ed45c8a818
📥 Commits
Reviewing files that changed from the base of the PR and between f1e47d516c13c820d60406146031517017f81118 and be87079.
📒 Files selected for processing (48)
docs/STYLEGUIDE.mdsrc/main/codex-accounts/runtime-home-service.test.tssrc/main/codex-accounts/service.test.tssrc/main/git/hosted-remote-url.test.tssrc/main/git/hosted-remote-url.tssrc/main/git/repo-hosted-url.test.tssrc/main/git/repo.tssrc/main/ipc/filesystem.test.tssrc/main/ipc/filesystem.tssrc/main/persistence.test.tssrc/main/providers/ssh-git-provider.test.tssrc/main/providers/ssh-git-provider.tssrc/main/providers/types.tssrc/main/runtime/orca-runtime-git.test.tssrc/main/runtime/orca-runtime-git.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/git-params.tssrc/main/runtime/rpc/methods/git.test.tssrc/main/runtime/rpc/methods/git.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/right-sidebar/GitHistoryCommitFileContextMenu.test.tsxsrc/renderer/src/components/right-sidebar/GitHistoryCommitFileContextMenu.tsxsrc/renderer/src/components/right-sidebar/GitHistoryCommitFiles.test.tssrc/renderer/src/components/right-sidebar/GitHistoryCommitFiles.tsxsrc/renderer/src/components/right-sidebar/GitHistoryPanel.test.tsxsrc/renderer/src/components/right-sidebar/GitHistoryPanel.tsxsrc/renderer/src/components/right-sidebar/GitHistoryPanel.virtualization.test.tsxsrc/renderer/src/components/right-sidebar/GitHistoryRefreshError.tsxsrc/renderer/src/components/right-sidebar/SourceControl.tsxsrc/renderer/src/components/right-sidebar/SourceControl.virtual-file-list.test.tsxsrc/renderer/src/components/right-sidebar/git-history-panel-overflow-menu.tsxsrc/renderer/src/components/right-sidebar/git-history-virtual-rows.test.tssrc/renderer/src/components/right-sidebar/git-history-virtual-rows.tssrc/renderer/src/components/right-sidebar/source-control-tree.tssrc/renderer/src/components/right-sidebar/source-control-virtual-file-list.test.tsxsrc/renderer/src/components/right-sidebar/source-control-virtual-file-list.tsxsrc/renderer/src/components/right-sidebar/use-git-history-commit-files.tssrc/renderer/src/components/right-sidebar/use-git-history-panel-resize.test.tssrc/renderer/src/components/right-sidebar/use-git-history-panel-resize.tssrc/renderer/src/components/right-sidebar/useGitHistoryCommitActions.test.tsxsrc/renderer/src/components/right-sidebar/useGitHistoryCommitActions.tssrc/renderer/src/components/right-sidebar/useGitHistoryCommitFileActions.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.json
🚧 Files skipped from review as they are similar to previous changes (41)
- src/renderer/src/components/right-sidebar/git-history-panel-overflow-menu.tsx
- src/renderer/src/components/right-sidebar/GitHistoryRefreshError.tsx
- src/renderer/src/components/right-sidebar/GitHistoryCommitFileContextMenu.test.tsx
- src/main/runtime/orca-runtime.ts
- src/renderer/src/components/right-sidebar/GitHistoryCommitFileContextMenu.tsx
- src/preload/index.ts
- src/renderer/src/components/right-sidebar/use-git-history-panel-resize.test.ts
- src/renderer/src/i18n/locales/es.json
- src/main/codex-accounts/runtime-home-service.test.ts
- src/preload/api-types.ts
- src/renderer/src/components/right-sidebar/SourceControl.virtual-file-list.test.tsx
- src/renderer/src/components/right-sidebar/git-history-virtual-rows.test.ts
- src/renderer/src/components/right-sidebar/source-control-tree.ts
- src/renderer/src/components/right-sidebar/git-history-virtual-rows.ts
- src/renderer/src/components/right-sidebar/use-git-history-commit-files.ts
- src/renderer/src/components/right-sidebar/source-control-virtual-file-list.tsx
- src/main/git/hosted-remote-url.test.ts
- src/main/runtime/orca-runtime-git.test.ts
- docs/STYLEGUIDE.md
- src/main/ipc/filesystem.test.ts
- src/main/git/hosted-remote-url.ts
- src/renderer/src/components/right-sidebar/useGitHistoryCommitActions.test.tsx
- src/renderer/src/i18n/locales/en.json
- src/main/codex-accounts/service.test.ts
- src/main/git/repo.ts
- src/renderer/src/components/right-sidebar/source-control-virtual-file-list.test.tsx
- src/renderer/src/i18n/locales/ko.json
- src/renderer/src/components/right-sidebar/useGitHistoryCommitActions.ts
- src/main/providers/types.ts
- src/main/ipc/filesystem.ts
- src/main/runtime/rpc/methods/git.test.ts
- src/renderer/src/components/right-sidebar/GitHistoryPanel.virtualization.test.tsx
- src/main/runtime/orca-runtime-git.ts
- src/main/git/repo-hosted-url.test.ts
- src/renderer/src/components/right-sidebar/GitHistoryPanel.test.tsx
- src/renderer/src/components/right-sidebar/useGitHistoryCommitFileActions.ts
- src/renderer/src/components/right-sidebar/SourceControl.tsx
- src/main/persistence.test.ts
- src/renderer/src/i18n/locales/ja.json
- src/renderer/src/components/right-sidebar/GitHistoryPanel.tsx
- src/renderer/src/i18n/locales/zh.json
Summary
Fixes #9593. Stacked on the commit file tree view PR (this branch includes its commits; the diff shrinks to the last two commits once it merges).
Adds a right-click context menu to commit files in Source Control → Commits:
/blob/, GitLab/-/blob/, Bitbucket/src/) for the file at the immutable commit SHA and opens it in an Orca browser tab. Deleted files resolve at the parent commit and path. If the commit is not reachable from any remote-tracking branch oforigin(not pushed — the hosted URL would 404), the action shows a clear toast instead of opening the browser; if the repo has no supported hosted remote, a separate toast explains that.The hosted-URL resolution returns a typed outcome (
ok/no-remote/commit-not-on-remote) end to end: repo layer (localgit for-each-ref --containsprobe), SSH provider, IPC, runtime RPC, preload, and renderer client. The containment probe runs on the host that owns the repo, so local, WSL, and SSH worktrees behave identically.Screenshots
Commit-file context menu:
An unpushed follow-up commit shows the guard toast instead of opening a hosted URL;
origin/mainremains on the previous commit:Testing
pnpm lint—oxlintclean; localization catalog + coverage verifiedpnpm typecheckpnpm test— 353 tests across repo/SSH provider/runtime/RPC/IPC/preload-client/hosted-url/action-hook suites pass, including new cases forcommit-not-on-remoteand probe-failure fallbackuse-git-history-panel-resize+GitHistoryPanelsuites pass 22/22 and full typecheck passes on the propagated stack; the regression covers second-pointer down/move/up/cancel and global body-style restorationpnpm build— app builds; the large-file-count e2e journey passes: pushed commit opens the hosted URL, unpushed commit shows the toast and opens no tabupdate-refand a follow-up unpushed commitAI Review Report
Reviewed with the coding agent for cross-platform compatibility (macOS/Linux/Windows — remote parsing handles HTTPS, SSH, and scp-like URLs; the probe uses
git for-each-ref --contains, available since Git 2.7, within the project's 2.25 baseline), SSH/remote/local compatibility (containment and remote-URL reads execute on the owning host: local subprocess, WSL distro, or SSH relay — no relay-side.gitaccess assumed), agent/integration compatibility (provider-neutral: GitHub, GitLab, Bitbucket; no GitHub-only naming in generic paths), performance (one extra git call per menu action, click-time only), UI quality (menu items per STYLEGUIDE; disabled state only for the root-commit-deleted edge where no target exists), and basic security (see below). Flags addressed: the push-guard check lives server-side, so the renderer never infers "pushed" from ref decorations; the inherited resize hook now scopes each global drag session to its initiatingpointerId, preventing concurrent touches from moving or ending it.Security Audit
Input handling:
shais validated as a full git object id andrelativePathas a git-relative path at both the IPC and RPC boundaries before reaching git; both are passed as argv elements (no shell). Command execution: fixed argument lists only (remote get-url,for-each-ref). No auth/secrets/dependency changes. IPC: handler return type narrowed to a result union, no new channels. No follow-up.Notes
origin), so the containment check scopes to the same remote the URL is built from.ELI5
In Git History, right-click a file in a commit for Open Diff, Open in Browser, or related actions. Browser open builds the hosted URL at that commit SHA and skips deleted files safely.