Repository navigation
Implement confirm-only PR panel composer with classified error blocking - #9428
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 9c601b6db0fcaf91423d1bc4ada0a3a5ea8d5b0f and 4435c73. 📒 Files selected for processing (62)
💤 Files with no reviewable changes (2)
🚧 Files skipped from review as they are similar to previous changes (56)
📝 WalkthroughWalkthroughThe changes distinguish authoritative hosted-review lookup results from unavailable lookups across provider clients, eligibility checks, mobile creation, and shared intent decisions. GitHub PR refreshes now preserve classified failures and retry schedules through runtime, store, and coordinator layers. The Checks panel adds structured review evidence, confirmed-readiness tracking, blocker and refresh states, recovery actions, synchronization, draft retention, and localized copy. Tests cover provider failures, lookup outcomes, readiness rules, mobile gating, refresh behavior, and rendered state selection. 🚥 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: 1
🧹 Nitpick comments (1)
src/main/azure-devops/azure-devops-api-request.ts (1)
90-103: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winConsume/cancel the response body on failure paths; consider extracting the shared throwOnFailure branching. All three provider request helpers add an identical "throw on failure vs. return null" block without draining the
!response.okbody first, which can hold connections open under Node/undici and now gets exercised more often via the new retry-driven eligibility lookup.
src/main/azure-devops/azure-devops-api-request.ts#L90-L103: callawait response.text().catch(() => {})(or similar) beforereturn null/throwon the non-OK branch; consider extracting the shared throw/return-null logic into one helper reused by all three providers.src/main/bitbucket/client.ts#L106-L118: same fix — drain the response body before discarding it on the non-OK branch.src/main/gitea/client.ts#L95-L108: same fix — drain the response body before discarding it on the non-OK branch.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 18cb5dae-876c-4f95-af30-083b7a9231be
📒 Files selected for processing (58)
mobile/src/source-control/mobile-hosted-review-service.tsmobile/src/source-control/mobile-pr-create.test.tsmobile/src/source-control/mobile-pr-create.tssrc/main/azure-devops/azure-devops-api-request.tssrc/main/azure-devops/client.test.tssrc/main/azure-devops/client.tssrc/main/bitbucket/client.test.tssrc/main/bitbucket/client.tssrc/main/git/exec-error.tssrc/main/git/runner.tssrc/main/gitea/client.test.tssrc/main/gitea/client.tssrc/main/github/client.test.tssrc/main/github/client.tssrc/main/github/gh-utils.tssrc/main/github/pr-refresh-coordinator.tssrc/main/github/pr-refresh-error-classification.test.tssrc/main/github/pr-refresh-error-classification.tssrc/main/gitlab/client-mr.test.tssrc/main/gitlab/client.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/hosted-review.test.tssrc/main/source-control/forge-provider.tssrc/main/source-control/hosted-review-creation-eligibility.test.tssrc/main/source-control/hosted-review-creation.tssrc/renderer/src/components/right-sidebar/ChecksPanel.tsxsrc/renderer/src/components/right-sidebar/CommitArea.test.tsxsrc/renderer/src/components/right-sidebar/checks-panel-ambiguous-github-review.test.tssrc/renderer/src/components/right-sidebar/checks-panel-ambiguous-github-review.tssrc/renderer/src/components/right-sidebar/checks-panel-blocker-copy.tssrc/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-git-status-snapshot.tssrc/renderer/src/components/right-sidebar/checks-panel-review-copy.tssrc/renderer/src/components/right-sidebar/checks-panel-review-creation.test.tssrc/renderer/src/components/right-sidebar/checks-panel-review-creation.tssrc/renderer/src/components/right-sidebar/checks-panel-review-lookup-authority.test.tssrc/renderer/src/components/right-sidebar/checks-panel-review-lookup-authority.tssrc/renderer/src/components/right-sidebar/checks-panel-review-state-model.tssrc/renderer/src/components/right-sidebar/source-control-create-pr-intent-flow.test.tssrc/renderer/src/components/right-sidebar/source-control-create-review-blocked-action.test.tssrc/renderer/src/components/right-sidebar/source-control-dropdown-items.test.tssrc/renderer/src/components/right-sidebar/source-control-primary-action.create-pr-intent.test.tssrc/renderer/src/components/right-sidebar/source-control-primary-action.test.tssrc/renderer/src/components/right-sidebar/source-control-primary-create-pr-intent-action.tssrc/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.test.tssrc/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.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/store/slices/github.tssrc/shared/hosted-review.tssrc/shared/source-control-create-review-intent.tssrc/shared/source-control-primary-action-decision.test.tssrc/shared/types.ts
💤 Files with no reviewable changes (2)
- src/renderer/src/components/right-sidebar/checks-panel-ambiguous-github-review.ts
- src/renderer/src/components/right-sidebar/checks-panel-ambiguous-github-review.test.ts
👮 Files not reviewed due to content moderation or server errors (1)
- src/renderer/src/i18n/locales/ko.json
Replace the ambiguous GitHub hosted-review boolean with a four-state evidence model (found/positive_unresolved/not_found/unknown) so "No PR found" never appears without an accepted lookup result. Classify GitHub refresh failures into types (rate_limited, auth, network, permission, repo_unavailable, gh_unavailable, unknown) for stable, honest copy. Confirmed-only composer: preserve drafts across transient failures; hide Create during hard errors and positive-unresolved evidence. Hard errors clear only when an eligibility request starts after the error and returns an accepted outcome. Propagate error types and unified retry schedule through the store. Sync mobile parity with shouldOpenChecksPanelCreateComposer gating. Localize all new copy.
Add reviewLookupOutcome to hosted-review eligibility and thread it through the panel so it never claims "No PR found" without accepted evidence. A failed lookup is unavailable, not a settled no-PR. Fail closed on positive unresolved evidence, hard refresh errors, and unavailable lookups. Add structured GitHub refresh-error classification with Retry-After parsing. Implement confirmed-only composer gating based on fresh, matching-context eligibility with hard-error clearing. Mobile gates on reviewLookupOutcome to prevent false Create claims. Surface throwOnFailure variants for each provider so transport failures cross the RPC boundary instead of collapsing to null. (Design success criteria 1–4; invariant 8.)
Extracts stderr/stdout parsing and Retry-After detection into a lightweight module that can be imported without pulling in the heavier runner machinery. Supports PR-refresh error classification and proper rate-limit handling for gh commands.
Create / Push & Create now fails closed unless the lookup is not_found. Update mobile test fixtures so accepted-no-PR cases can still proceed.
forge-provider resolves branch reviews via the OrThrow variant so lookup failures surface as unavailable instead of "no PR found".
9c601b6 to
4435c73
Compare
…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.
…R loads (#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 #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
…ng (stablyai#9428) * Clarify PR panel guidance: classify errors and confirm-only composer Replace the ambiguous GitHub hosted-review boolean with a four-state evidence model (found/positive_unresolved/not_found/unknown) so "No PR found" never appears without an accepted lookup result. Classify GitHub refresh failures into types (rate_limited, auth, network, permission, repo_unavailable, gh_unavailable, unknown) for stable, honest copy. Confirmed-only composer: preserve drafts across transient failures; hide Create during hard errors and positive-unresolved evidence. Hard errors clear only when an eligibility request starts after the error and returns an accepted outcome. Propagate error types and unified retry schedule through the store. Sync mobile parity with shouldOpenChecksPanelCreateComposer gating. Localize all new copy. * Clarify PR panel guidance: classify errors and confirm-only composer Add reviewLookupOutcome to hosted-review eligibility and thread it through the panel so it never claims "No PR found" without accepted evidence. A failed lookup is unavailable, not a settled no-PR. Fail closed on positive unresolved evidence, hard refresh errors, and unavailable lookups. Add structured GitHub refresh-error classification with Retry-After parsing. Implement confirmed-only composer gating based on fresh, matching-context eligibility with hard-error clearing. Mobile gates on reviewLookupOutcome to prevent false Create claims. Surface throwOnFailure variants for each provider so transport failures cross the RPC boundary instead of collapsing to null. (Design success criteria 1–4; invariant 8.) * Add exec-error helpers for subprocess error classification Extracts stderr/stdout parsing and Retry-After detection into a lightweight module that can be imported without pulling in the heavier runner machinery. Supports PR-refresh error classification and proper rate-limit handling for gh commands. * test(mobile): include reviewLookupOutcome in create eligibility fixtures Create / Push & Create now fails closed unless the lookup is not_found. Update mobile test fixtures so accepted-no-PR cases can still proceed. * Add OrThrow mock variants to forge-provider test mocks forge-provider resolves branch reviews via the OrThrow variant so lookup failures surface as unavailable instead of "no PR found".
…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
Summary
This PR implements a fail-closed "confirm-only" model for the Create PR composer in the Checks panel. Create now opens only when the existing-review lookup proves no PR exists for the exact context, and hard refresh errors (auth/permission/repo/CLI unavailable) block both automatic and manual retry until cleared.
Core design changes:
reviewLookupOutcomefield distinguishes accepted no-review (not_found) from failed/unproven lookup (unavailable)isChecksPanelCreateEligibilityConfirmablefloor ensures both platforms fail consistently on the same hard blocksunavailable, never collapse to false "no PR found"Implementation highlights:
src/main/git/exec-error.tswith pure subprocess error helpers (Retry-After parsing, stderr/stdout extraction)pr-refresh-error-classification.tsfor classified error types matching PR panel empty-state copyhasAmbiguousGitHubHostedReviewbooleanTest coverage:
reviewLookupOutcomefieldBackwards compatibility: Runtime RPC result normalized via
normalizeRuntimePRForBranchOutcomeso older hosts still work (PRInfo|null mapped to found/no-pr).