Repository navigation
fix(checks): stop the transient "PR already exists" card before the PR loads - #10008
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe checks panel now detects positive review evidence that is not yet rendered and passes it to the PR refresh resolver. The resolver can select an active foreground fetch for this condition. Empty-state handling displays a checking status during queued or in-flight refreshes while preserving concurrent branch blockers. Additional tests cover refresh selection and state precedence. 🚥 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 |
…R loads The Checks panel briefly showed the terminal "Pull request already exists" card (Open Review only) on a cold mount, and only rendered the real PR panel after a manual refresh. Root cause (regression from #9428): the eligibility probe resolves `existing_review` from cache faster than the renderable PR hydrates, and the new exhaustive selector ranks `existing_review` as a terminal safety blocker above every loading state. So during the fetch window the panel settled on the terminal card instead of a self-updating loading state. The auto-fetch also used a lazy SWR priority, so the PR landed slowly unless the user forced a foreground refresh. Fix: - Selector: while a PR fetch is queued/in-flight and we have positive-but-not- yet-renderable review evidence (existing_review or positive_unresolved), show the self-updating "Checking status" state instead of the terminal card. It flips to the review once details land. A concurrent branch blocker still owns the copy. - Fetch: when a review is known to exist but no renderable PR is cached, escalate the auto-fetch to a foreground `active`/80 request (matching manual refresh) so it resolves promptly. Reuses existing i18n keys; adds unit coverage for both parts.
53445ac to
b534fa6
Compare
…sient-pr-already-exists # Conflicts: # src/main/ipc/worktree-common-git-directory.ts # src/main/skills/skill-installation-topology.ts
…sient-pr-already-exists
Fold unresolved-review promotion into the existing refresh effect so cached evidence produces one dispatch instead of an SWR plus active pair. Keep non-GitHub evidence on the budgeted path to avoid forced GitHub work for GitLab and other providers.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/renderer/src/components/right-sidebar/ChecksPanel.tsx (1)
528-528: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument the foreground-refresh deduplication ref.
Line 528 introduces non-obvious coordination state. Add a concise comment explaining that it prevents repeated foreground provider work for the same refresh context and review evidence.
As per coding guidelines, TypeScript/JavaScript code should add concise, ideally one-line comments only for non-obvious code, explaining why rather than how.
Proposed comment
+ // Avoid repeating foreground provider work for the same refresh context and review evidence. const foregroundedUnrenderedReviewKeyRef = useRef<string | null>(null)Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 77df5ea0-e379-4c52-8a4d-f47fa9a26f8f
📒 Files selected for processing (5)
src/renderer/src/components/right-sidebar/ChecksPanel.tsxsrc/renderer/src/components/right-sidebar/checks-panel-empty-state.test.tssrc/renderer/src/components/right-sidebar/checks-panel-empty-state.tssrc/renderer/src/components/right-sidebar/checks-panel-pr-refresh-request.test.tssrc/renderer/src/components/right-sidebar/checks-panel-pr-refresh-request.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/renderer/src/components/right-sidebar/checks-panel-empty-state.ts
- src/renderer/src/components/right-sidebar/checks-panel-empty-state.test.ts
- src/renderer/src/components/right-sidebar/checks-panel-pr-refresh-request.ts
…R loads (stablyai#10008) * fix(checks): stop the transient "PR already exists" card before the PR loads The Checks panel briefly showed the terminal "Pull request already exists" card (Open Review only) on a cold mount, and only rendered the real PR panel after a manual refresh. Root cause (regression from stablyai#9428): the eligibility probe resolves `existing_review` from cache faster than the renderable PR hydrates, and the new exhaustive selector ranks `existing_review` as a terminal safety blocker above every loading state. So during the fetch window the panel settled on the terminal card instead of a self-updating loading state. The auto-fetch also used a lazy SWR priority, so the PR landed slowly unless the user forced a foreground refresh. Fix: - Selector: while a PR fetch is queued/in-flight and we have positive-but-not- yet-renderable review evidence (existing_review or positive_unresolved), show the self-updating "Checking status" state instead of the terminal card. It flips to the review once details land. A concurrent branch blocker still owns the copy. - Fetch: when a review is known to exist but no renderable PR is cached, escalate the auto-fetch to a foreground `active`/80 request (matching manual refresh) so it resolves promptly. Reuses existing i18n keys; adds unit coverage for both parts. * fix(checks): bound unresolved review foreground refreshes * fix(types): exclude absent stat overloads * fix(checks): preserve refresh precedence and budget * fix(checks): avoid redundant foreground PR refreshes Fold unresolved-review promotion into the existing refresh effect so cached evidence produces one dispatch instead of an SWR plus active pair. Keep non-GitHub evidence on the budgeted path to avoid forced GitHub work for GitLab and other providers. * fix(checks): scope foreground refreshes by provider
Problem
On a cold mount, the Checks/right-sidebar panel briefly shows a terminal "Pull request already exists" card (with only an Open Review button) instead of the real PR panel. A manual refresh then loads the PR normally.
Root cause — regression from #9428
Two signals feed the panel's exhaustive state selector from different async sources:
existing_reviewcomes from the cache-backed eligibility probe — fast.reviewLookup: 'found'requires the fullPRInfoto hydrate into the PR cache — slower.#9428introduced the four-state selector and ranksexisting_reviewas a terminal safety blocker above every loading state. So during the hydration window the panel settles on the terminal "already exists" card rather than a self-updating loading state. Compounding it, the auto-fetch used a lazyswrpriority, so the renderable PR landed slowly unless the user forced a foreground refresh (which usesactive/80).Fix
checks-panel-empty-state.ts) — while a PR fetch isqueued/in-flightand we have positive-but-not-yet-renderable review evidence (existing_revieworpositive_unresolved), show the self-updating "Checking status" state instead of the terminal card. It flips to the review once details land. A concurrent branch blocker (publish/sync/auth/needs_push) still owns the copy.checks-panel-pr-refresh-request.ts+ call site) — when a review is known to exist but no renderable PR is cached, escalate the auto-fetch to a foregroundactive/80 request (matching manual refresh) so it resolves promptly.Reuses existing i18n keys; no new copy.
Verification
Ran end-to-end in the real Electron app via
/electron, against this PR's own worktree (branch has an open PR → the exactexisting_reviewcontext that used to stall).1. During load — the new self-updating "Checking pull request status" state (where the terminal "already exists" card used to appear):
2. Resolves automatically to the real PR panel — no manual refresh:
Also verified:
Unit tests:
checks-panel-empty-state.test.ts+checks-panel-pr-refresh-request.test.ts(35 pass) — the in-flight → Checking-status transition, the settled-fetch terminal card still showing, and the branch-blocker precedence.tsc(renderer project) + oxlint clean.The real selector module, as compiled by Vite and executed inside the running app, across every scenario:
existing_review+ in-flight fetchrenderReview=false)existing_review+ queued fetchexisting_review, fetch settledpositive_unresolved+ queued