Skip to content

Fix Create PR visibility when upstream status is unknown#6492

Open
AmethystLiang wants to merge 2 commits into
mainfrom
fix-create-pr-button-visibility
Open

Fix Create PR visibility when upstream status is unknown#6492
AmethystLiang wants to merge 2 commits into
mainfrom
fix-create-pr-button-visibility

Conversation

@AmethystLiang

Copy link
Copy Markdown
Contributor

Summary

  • rethrow hosted review lookup failures when upstream status is unknown
  • keep local blocker fallback limited to dirty, explicitly unpushed, or behind branches
  • add regression coverage for the unknown-upstream lookup failure case

Tests

  • pnpm exec vitest run --config config/vitest.config.ts src/main/source-control/hosted-review-creation.test.ts

Catch errors during hosted review lookup if local blockers are present.
This ensures that network or API failures do not completely hide the
Create PR preparation UI if we can still guide the user to resolve local
issues first.
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

getHostedReviewCreationEligibility now catches errors from getHostedReviewForBranch, rethrows when upstream status is unknown, and otherwise continues with review set to null so local eligibility blockers can still be returned. The test suite adds coverage for dirty branches that remain blocked by commit and for upstream-unknown failures that rethrow the original error.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes summary and tests, but it omits required Screenshots, AI Review Report, Security Audit, and Notes sections. Add the missing template sections, including screenshots/no visual change, AI review findings, security audit summary, and notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing Create PR visibility when upstream status is unknown.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch fix-create-pr-button-visibility

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/main/source-control/hosted-review-creation.test.ts (1)

597-632: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for the other two fallback blockers.

getHostedReviewCreationEligibility now also suppresses lookup failures for hasUpstream === false and behind > 0, but these tests only cover the dirty path and the rethrow path. Please add one case that expects blockedReason: 'no_upstream' and one that expects blockedReason: 'needs_sync' when the lookup rejects, so the new fallback contract stays pinned down.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d302fab5-755d-45f2-a122-bb36fe2debd5

📥 Commits

Reviewing files that changed from the base of the PR and between a8f949d and cee5775.

📒 Files selected for processing (2)
  • src/main/source-control/hosted-review-creation.test.ts
  • src/main/source-control/hosted-review-creation.ts

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