kitenite/halved position#2102
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds a small auto-create-PR utility with tests, introduces GitHub PR URL utilities and tests, updates backend PR creation flow to build PR compare URLs (handling upstreams/forks), and adjusts frontend components/hooks to use the new utilities and open returned PR URLs. Changes
Sequence Diagram(s)sequenceDiagram
actor Client
participant Router as TRPC Router
participant Git as Git (local)
participant RepoMeta as Repo Metadata
participant Browser
Client->>Router: request create/open PR
Router->>Git: get current branch, tracking, config (gh-merge-base)
Router->>RepoMeta: query remote repo metadata (owner, default branch)
Router->>Router: parse upstream ref / normalize repo URL
Router->>Router: build compare URL (baseRepo, baseBranch, headOwner, headBranch)
Router->>Client: return { success:true, url }
Client->>Browser: open url in new tab
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ❌ 3❌ Failed checks (3 warnings)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
1 issue found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx">
<violation number="1" location="apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx:367">
P1: Bug: `hasGitHubRepo` check was dropped when extracting `shouldAutoCreatePRAfterPublish` into a utility. The original inline logic was `hasGitHubRepo && !isDefaultBranch && !hasExistingPR`, but the new function only checks `!hasExistingPR && !isDefaultBranch`. This means workspaces without a GitHub repo will now incorrectly trigger auto-PR creation after a branch publish.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| }); | ||
| const shouldAutoCreatePRAfterPublish = | ||
| hasGitHubRepo && !isDefaultBranch && !hasExistingPR; | ||
| const shouldAutoCreatePR = shouldAutoCreatePRAfterPublish({ |
There was a problem hiding this comment.
P1: Bug: hasGitHubRepo check was dropped when extracting shouldAutoCreatePRAfterPublish into a utility. The original inline logic was hasGitHubRepo && !isDefaultBranch && !hasExistingPR, but the new function only checks !hasExistingPR && !isDefaultBranch. This means workspaces without a GitHub repo will now incorrectly trigger auto-PR creation after a branch publish.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx, line 367:
<comment>Bug: `hasGitHubRepo` check was dropped when extracting `shouldAutoCreatePRAfterPublish` into a utility. The original inline logic was `hasGitHubRepo && !isDefaultBranch && !hasExistingPR`, but the new function only checks `!hasExistingPR && !isDefaultBranch`. This means workspaces without a GitHub repo will now incorrectly trigger auto-PR creation after a branch publish.</comment>
<file context>
@@ -364,8 +364,10 @@ export function ChangesView({ onFileOpen, isExpandedView }: ChangesViewProps) {
});
- const shouldAutoCreatePRAfterPublish =
- hasGitHubRepo && !isDefaultBranch && !hasExistingPR;
+ const shouldAutoCreatePR = shouldAutoCreatePRAfterPublish({
+ hasExistingPR,
+ isDefaultBranch,
</file context>
| const shouldAutoCreatePR = shouldAutoCreatePRAfterPublish({ | |
| const shouldAutoCreatePR = hasGitHubRepo && shouldAutoCreatePRAfterPublish({ |
There was a problem hiding this comment.
1 issue found across 4 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/desktop/src/lib/trpc/routers/changes/git-operations.ts">
<violation number="1" location="apps/desktop/src/lib/trpc/routers/changes/git-operations.ts:269">
P2: Empty catch block silently swallows errors from multiple git operations (upstream ref resolution and remote URL lookup). At minimum, log a warning with context so fork/upstream debugging is possible.
(Based on your team's feedback about avoiding empty catch blocks that hide failures.) [FEEDBACK_USED]</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| `branch.${branch}.gh-merge-base`, | ||
| ]); | ||
| return configuredBaseBranch.trim() || null; | ||
| } catch { |
There was a problem hiding this comment.
P2: Empty catch block silently swallows errors from multiple git operations (upstream ref resolution and remote URL lookup). At minimum, log a warning with context so fork/upstream debugging is possible.
(Based on your team's feedback about avoiding empty catch blocks that hide failures.)
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/lib/trpc/routers/changes/git-operations.ts, line 269:
<comment>Empty catch block silently swallows errors from multiple git operations (upstream ref resolution and remote URL lookup). At minimum, log a warning with context so fork/upstream debugging is possible.
(Based on your team's feedback about avoiding empty catch blocks that hide failures.) </comment>
<file context>
@@ -242,22 +242,92 @@ async function findOpenPRByHeadCommit(
+ `branch.${branch}.gh-merge-base`,
+ ]);
+ return configuredBaseBranch.trim() || null;
+ } catch {
+ return null;
+ }
</file context>
Auto create PR on publish branch
Summary by CodeRabbit
New Features
Bug Fixes