Repository navigation
feat(right-sidebar): pick between a workspace's reviews in Checks and Source Control - #267
Merged
Merged
Conversation
… Source Control A workspace can hold several review attachments while its compatibility slots name only one active review, and both panes only ever showed that one. The Checks pane's review number and the Source Control header's review link are now split controls: the link keeps opening the review, and a chevron lists every review the workspace holds (`PR #12` / `MR !7`, with the title) and switches which one the pane describes. Switching drives the panes' reads, not just their labels: - Checks re-reads checks, comments and review metadata for the picked review's number, drops the previous review's rows while that read is in flight, and maps the review onto the PR shape the pane already keys its head-sha freshness gate and comment actions on. - Source Control's header link, review actions and compare base follow the pick. The file list, commit area, push target and PR creation keep resolving through the workspace's own review: pointing those at another branch's review would retarget a push. The selection is the panes' view, not the workspace's link. It lives in the fork's session-only renderer slice, keyed by worktree and shared between the two panes so they cannot disagree, and never moves `linkedPR` — that slot is what push-target and PR-creation safety resolve through. It is keyed on provider and number rather than the attachment key, which moves when a background refresh fills in a title or URL. Unlinking now removes the review the switcher shows instead of the workspace's slot, so it cannot unlink the review the user is not looking at. A picked review is read through its own hosted-review cache key, so switching does not overwrite the branch's review entry, and the Checks Refresh button refreshes the picked review rather than the branch's.
…view switcher Round 1 (Opus 5.5, high) found two blocking defects and six should-fix items. The first blocker: the Checks pane's Refresh took its number from any picked review, so a picked GitLab MR sent `!7` to GitHub as PR #7 and a picked Bitbucket PR reused the branch PR's head. The picked path now branches on the provider the pane actually renders — GitHub checks and comments for a GitHub review, `fetchGitLabDetails` for an MR, and the branch path for anything this pane cannot render. The second: both panes cleared the shared pick whenever their own default matched it. Their defaults come from different async sources, so a transient null in one pane wiped the other's pick. Nothing writes the selection from a derived condition any more; the selection's flag stays a per-pane render decision, and a stored key that names another pane's default is simply that pane's default. Should-fix items closed: - The Checks switcher lists only reviews this pane can render, and its checked row is the review the header shows, so a listed row is never a review that is not on screen. - Every "is a pick shown" decision reads the same value: the PR-check fetch no longer passes this worktree's branch for a picked review, which had been writing another PR's check status onto this branch's cached PR. - Refresh-after-mutation and the entry refresh follow the pick; the triage strip's worktree-acting AI actions are hidden for a pick, because they start an agent in *this* worktree and would fix another branch's checks by committing here. - Unlinking removes the row that carries the shown review and tombstones a GitHub one, so a slot-only clear cannot leave the review behind, and a failed update now reports. - The selection is memoized, rows clear with a loading state, and the Refresh of a pick keys its results on the refreshed head instead of discarding them. Tests cover the decision everything downstream reads (`shown-review.test.ts`), both provider branches of a picked Refresh, the picked unlink, the header with a pick, and that the hook never writes the shared selection on its own.
…e regression of its own The delta review (Opus 5.5, high) confirmed both round-1 blockers resolved and found one blocker and three should-fix defects introduced by those fixes. The blocker: the picked Refresh's staleness guard compared `asyncResultKeyRef.current` with itself, which always passes, so a switch mid-flight wrote the old pick's rows under the new review's header. The key is now captured locally, assigned to the ref, and compared as a local — and the loading flags are cleared only by the request that still owns them. Should-fix items closed: - `findWorkspaceReviewAttachment` matched issues too. A GitLab issue and an MR have separate number spaces, so unlinking `!42` could remove the issue `#42`; the search is filtered to review attachments, with a test that shares a number. - Unlinking a picked GitHub review overwrote the `suppressedGitHubPR` tombstone of a branch PR the user had already unlinked, letting that PR come back. The tombstone is written only for the workspace's own review, which is the only one the branch lookup can resolve. - The row-clear effect raised the loading flags on mount and on every return to the workspace review, where nothing guarantees a matching clear. It now runs on a switch only, and raises the flags only for a pick. Minor items closed: the shared pick is cleared only when it names the review being unlinked; Unlink is disabled again for a review with no row and no slot, whose unlink would do nothing; the switcher never checks a row the header is not showing, in either pane; a picked GitHub read no longer clears this branch PR's refresh error; and a picked MR is re-read on tab entry and after a mutation, like the branch path. Two round-1 gaps in coverage are also closed: the picked Refresh's guard is now exercised with a real comparison and a mid-flight switch, and the polling path is pinned to pass no branch for a pick.
…review's result key Round 3 (Opus 5.5, high, on the R2..R3 delta) confirmed eight of the nine round-2 findings resolved and found that N1 was only half-closed. The remaining hole: after `refreshSelectedReview()` resolved, the picked Refresh only checked `isCurrentRequest()`, which a review switch does not invalidate. It then claimed `asyncResultKeyRef.current` with the *old* pick's key, so the old review's rows landed under the new header and the new review's own in-flight read was discarded. The GitLab sub-path had the same shape, passing no currency predicate to `fetchGitLabDetails`. The fix answers "is this still the review on screen" from the stored selection rather than the result key: the result key cannot tell a switch from the refreshed review landing with a new head, which is the refresh working. Both the claim and the loading flags now sit behind that check, while the refresh latch stays on the request alone so it is always released. Also closed: a pick whose row no longer matches no longer falls through to the branch slot path, which would have addressed a review that is not on screen (and could write the pick's number over an earlier branch-PR tombstone); the duplicate dependency in the entry-refresh hook; and the redundant provider guard, now that `findWorkspaceReviewAttachment` returns the narrowed attachment type. Coverage added for the round-2 items that had none: a switch inside `refreshSelectedReview`, an issue and an MR sharing a number with no URLs (asserting the issue survives the removal), no tombstone written for a pick, no slot path for a pick with no row, and no branch-PR error retraction from a picked read.
…ions able to fail
Round 4 (Opus 5.5, high, on the R3..R4 delta) came back clean: no blockers, no
should-fix, and all seven round-3 findings resolved. Its three NITs were all about
tests that could not fail, so they are worth closing even though a NIT never blocks.
- The tombstone assertion used `expect.not.objectContaining({ suppressedGitHubPR:
expect.anything() })`, which passes for a write of `suppressedGitHubPR: null` —
exactly the write that would clear an earlier branch-PR tombstone and let that PR
come back. It now asserts the key's absence.
- The mid-refresh-switch test now also pins that the result key was never claimed and
that the refresh latch was released; a regression gating the latch on the pick check
would have left Refresh disabled for good with no test failing. A second case switches
the selection after the key was claimed, so the post-read pick check has its own test
instead of relying on the result-key half.
- The issue/MR number-collision test moved to the GitLab unlink block, where it belongs,
and its comment was wrong.
Both new guards were checked against their own absence: removing the post-read pick
check fails the claimed-key test, and removing the pick-with-no-row guard fails the
no-row test. The issue/MR test already discriminated, since the removal is keyed on an
attachment identity that folds in the type.
One round-4 assumption was checked and left alone: the GitLab details path clears its
loading flags on an abandoned request, which looks like the round-3 flags bug but is
deliberate — a generation counter keeps it off a newer request, and an upstream test
pins that an abandoned relink must release them or the pane keeps a spinner forever.
Adding a currency guard there broke that test, so the change was reverted rather than
the contract.
nplez1
added a commit
that referenced
this pull request
Nov 1, 2026
Round 1 of the gate-2 review (Opus 5.5, high) returned BLOCKING against the ledger entry, not the code: the deletion and the overlay rows were clean, but the entry stated one invariant wrongly and left two recorded nowhere. - The pick is display-only in Source Control only. In the Checks pane it is operational: HostedReviewActions gets the shown review and a mutation's refresh goes to the pick first. Scoped the bullet and stated the other half. - Added the two invariants that lost their only guard: the shown-review switch effect (fires on a change rather than on mount, clears the previous review's rows, raises loading flags only for a pick) and the pick-first tab-entry and post-mutation refresh. Neither hook is rendered by any test under right-sidebar/**, which is why the ledger has to carry them. - Corrected the refresh bullet's reason: refreshRequestKeyRef is per-request, so a switch never changes it and isCurrentRequest cannot see one — it is the result key that cannot tell a switch from this review's own head moving. Added the two test-pinned clauses (re-check the pick after the await and before claiming asyncResultKeyRef; compare pickedRequestKey as a local because isCurrentAsyncResult reads the ref). - Added "a pick's read must not retractStalePRRefreshError", pinned at use-checks-panel-polling.test.tsx. - Fixed the figures: the ratchet counts 118 of the deleted lines (the diff deletes 120; two are JSX comment continuation lines the line rule skips), and the baseline measured 6062 at #267's parent, not 6051 — #268's 11 were already in the tree and #266 removed them afterwards, which is the 6169 this branch carried. - The two overlay rows named the cache key by position; they name use-workspace-review-selection.ts instead, so a prune or reorder cannot break the pointer. Both ratchets still green (6051/6051, 0 stale; 664 focus reads). No code changed, so the unit-gate verdict for e88b0f0 still stands and the review is not voided by this commit (LOCAL-PATCHES.md only).
nplez1
added a commit
that referenced
this pull request
Nov 1, 2026
…s reads The lint gate was 42/44 on this branch, both reds from #267 and both entirely inside src/renderer/src/components/right-sidebar/**: - check-upstream-file-comments: 6180 against a 6051 baseline. #267 added 118 comment lines across 12 files upstream owns. All 118 are removed rather than marked `fork-comment-ok`: each was prose above upstream's code explaining a fork decision, and the fork's own modules (workspace-review-selection.ts, use-workspace-review-selection.ts, WorkspaceReviewSwitcher.tsx) already state the same design without a hunk to resolve on every sync. Total is back to exactly 6051 with 0 stale entries, so no re-baseline was needed. - check:focus-read-ratchet: three files at 1 read each. They are one transitive read, not three routing decisions: use-workspace-review-selection.ts builds its hosted-review cache key through getWorkspaceReferenceRuntimeVersion, which folds getProviderRuntimeContextKey(null) in — null is this app, not the focused host — and it reuses the sidebar card's key on purpose so a switch does not overwrite the branch's entry. The two panes then count because they call the hook. Recorded in config/focus-setting-read-baseline.fork.txt with the reason, the same shape as the 2026-10-16 use-linked-issue-pane-actions.ts row, rather than restructuring reviewed code to dodge a regex. The invariants those comments guarded (display-only pick, the one suppressedGitHubPR tombstone, row-not-slot unlink, renderable rows, the store as the refresh switch test, no branch argument for a picked review) now live in LOCAL-PATCHES.md § local(lint), next to #266's marker note. Verified: check-upstream-file-comments and check:focus-read-ratchet green; tc:web clean; the 9 test files covering the touched hooks and components pass.
nplez1
added a commit
that referenced
this pull request
Nov 1, 2026
Round 1 of the gate-2 review (Opus 5.5, high) returned BLOCKING against the ledger entry, not the code: the deletion and the overlay rows were clean, but the entry stated one invariant wrongly and left two recorded nowhere. - The pick is display-only in Source Control only. In the Checks pane it is operational: HostedReviewActions gets the shown review and a mutation's refresh goes to the pick first. Scoped the bullet and stated the other half. - Added the two invariants that lost their only guard: the shown-review switch effect (fires on a change rather than on mount, clears the previous review's rows, raises loading flags only for a pick) and the pick-first tab-entry and post-mutation refresh. Neither hook is rendered by any test under right-sidebar/**, which is why the ledger has to carry them. - Corrected the refresh bullet's reason: refreshRequestKeyRef is per-request, so a switch never changes it and isCurrentRequest cannot see one — it is the result key that cannot tell a switch from this review's own head moving. Added the two test-pinned clauses (re-check the pick after the await and before claiming asyncResultKeyRef; compare pickedRequestKey as a local because isCurrentAsyncResult reads the ref). - Added "a pick's read must not retractStalePRRefreshError", pinned at use-checks-panel-polling.test.tsx. - Fixed the figures: the ratchet counts 118 of the deleted lines (the diff deletes 120; two are JSX comment continuation lines the line rule skips), and the baseline measured 6062 at #267's parent, not 6051 — #268's 11 were already in the tree and #266 removed them afterwards, which is the 6169 this branch carried. - The two overlay rows named the cache key by position; they name use-workspace-review-selection.ts instead, so a prune or reorder cannot break the pointer. Both ratchets still green (6051/6051, 0 stale; 664 focus reads). No code changed, so the unit-gate verdict for e88b0f0 still stands and the review is not voided by this commit (LOCAL-PATCHES.md only).
nplez1
added a commit
that referenced
this pull request
Nov 1, 2026
* fix(lint): remove #267's fork comments and record its transitive focus reads The lint gate was 42/44 on this branch, both reds from #267 and both entirely inside src/renderer/src/components/right-sidebar/**: - check-upstream-file-comments: 6180 against a 6051 baseline. #267 added 118 comment lines across 12 files upstream owns. All 118 are removed rather than marked `fork-comment-ok`: each was prose above upstream's code explaining a fork decision, and the fork's own modules (workspace-review-selection.ts, use-workspace-review-selection.ts, WorkspaceReviewSwitcher.tsx) already state the same design without a hunk to resolve on every sync. Total is back to exactly 6051 with 0 stale entries, so no re-baseline was needed. - check:focus-read-ratchet: three files at 1 read each. They are one transitive read, not three routing decisions: use-workspace-review-selection.ts builds its hosted-review cache key through getWorkspaceReferenceRuntimeVersion, which folds getProviderRuntimeContextKey(null) in — null is this app, not the focused host — and it reuses the sidebar card's key on purpose so a switch does not overwrite the branch's entry. The two panes then count because they call the hook. Recorded in config/focus-setting-read-baseline.fork.txt with the reason, the same shape as the 2026-10-16 use-linked-issue-pane-actions.ts row, rather than restructuring reviewed code to dodge a regex. The invariants those comments guarded (display-only pick, the one suppressedGitHubPR tombstone, row-not-slot unlink, renderable rows, the store as the refresh switch test, no branch argument for a picked review) now live in LOCAL-PATCHES.md § local(lint), next to #266's marker note. Verified: check-upstream-file-comments and check:focus-read-ratchet green; tc:web clean; the 9 test files covering the touched hooks and components pass. * local(lint): correct the #267 ledger entry the gate-2 review caught Round 1 of the gate-2 review (Opus 5.5, high) returned BLOCKING against the ledger entry, not the code: the deletion and the overlay rows were clean, but the entry stated one invariant wrongly and left two recorded nowhere. - The pick is display-only in Source Control only. In the Checks pane it is operational: HostedReviewActions gets the shown review and a mutation's refresh goes to the pick first. Scoped the bullet and stated the other half. - Added the two invariants that lost their only guard: the shown-review switch effect (fires on a change rather than on mount, clears the previous review's rows, raises loading flags only for a pick) and the pick-first tab-entry and post-mutation refresh. Neither hook is rendered by any test under right-sidebar/**, which is why the ledger has to carry them. - Corrected the refresh bullet's reason: refreshRequestKeyRef is per-request, so a switch never changes it and isCurrentRequest cannot see one — it is the result key that cannot tell a switch from this review's own head moving. Added the two test-pinned clauses (re-check the pick after the await and before claiming asyncResultKeyRef; compare pickedRequestKey as a local because isCurrentAsyncResult reads the ref). - Added "a pick's read must not retractStalePRRefreshError", pinned at use-checks-panel-polling.test.tsx. - Fixed the figures: the ratchet counts 118 of the deleted lines (the diff deletes 120; two are JSX comment continuation lines the line rule skips), and the baseline measured 6062 at #267's parent, not 6051 — #268's 11 were already in the tree and #266 removed them afterwards, which is the 6169 this branch carried. - The two overlay rows named the cache key by position; they name use-workspace-review-selection.ts instead, so a prune or reorder cannot break the pointer. Both ratchets still green (6051/6051, 0 stale; 664 focus reads). No code changed, so the unit-gate verdict for e88b0f0 still stands and the review is not voided by this commit (LOCAL-PATCHES.md only). * local(lint): fix the two MINOR wording errors the delta re-check found Round 2 (the R1..R2 delta re-check, Opus 5.5 high) resolved all seven round-1 findings and reported two MINOR wording errors in the bullet R2 added. Both are one-hunk text fixes, so they are fixed here rather than listed in the PR body: - The bullet title said the switch effect and the tab-entry refresh "are a pick's only re-reads". They are not: the switch effect reads nothing (it clears rows and sets flags), and a manual refresh and polling both read a pick. The title now names what the bullet actually guards, which is that neither hook is rendered by a test. - The mount-guard reason was wrong. In an ordinary single-review workspace shownReviewKey is '' and the unguarded effect would clear rows that are already empty and raise no flags. The guard earns its place on a remount where the pick's cache entry is already warm: showsPickedReview resolves true on the first render, so the unguarded effect would clear rows and raise loading flags with no switch and no read in flight, and setChecksLoading/setCommentsLoading are otherwise written only by a manual refresh, so nothing would clear them. Both ratchets still green. LOCAL-PATCHES.md only: no code changed, so the unit gate verdict for e88b0f0 still stands for that revision, and this commit does not void the review. No third review round: AGENTS.md requires the user's approval for one, and these are the reviewer's own suggested fixes.
nplez1
added a commit
that referenced
this pull request
Nov 10, 2026
…mments The `check:code-quality:changed` whole-step entry said to prune it on the first run after `git push origin main`; `node local/gate-lint.mjs --prune` did, and nothing else in `local/lint-known-red.json` was stale. That run then put this commit's own footprint on the comment ratchet. `check-upstream-file-comments` diffs against the sync base, so wrapping a try/catch/finally into a module helper relocates the fork comments inside the block and every moved line reads as a newly written one: `use-checks-panel-manual-refresh.tsx` (9) and `ai-vault-session-refresh.ts` (10, two of them the max-lines suppression the ownership rule requires) cross their maxima with no new prose. Three entries pin those two counts and the total. The prose this commit had added to upstream files is deleted rather than recorded — the `Why` lines in `DiffViewer.tsx`, `useFileExplorerVisibleRowProjection.ts` and `ai-vault-session-refresh.ts` are gone (5465 -> 5459 total) and the reasoning lives in LOCAL-PATCHES.md, which is the #267 precedent and the shape that keeps a fix-only diff mergeable. The nine reds the gate still reports are pre-existing: none of their files is in this commit, and their recorded counts drifted before it. LOCAL-PATCHES.md and their own entries say they are recorded, not accepted, and belong to the sync that caused them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Orca lets a workspace hold several pull requests, as it lets it hold several issues, but the Checks
and Source Control panes only ever described the one its compatibility slots named. The issue panel
already got a dropdown for this; this adds the same control to both review panes, so a workspace
with more than one review can switch which one is shown.
The Checks pane's review number and the Source Control header's review link become split controls:
the link keeps opening the review, and a chevron lists every review the workspace holds (
PR #12/MR !7, with the title) and picks the one the pane describes.What switching changes
Checks re-reads checks, comments and review metadata for the picked review's number, drops the
previous review's rows while that read is in flight, and maps the review onto the PR shape the pane
already keys its head-sha freshness gate and comment actions on. Refresh, title edits and
post-mutation refreshes follow the pick; so does tab entry, which is the pane's only periodic
re-read of review metadata. The GitHub checks read passes no branch for a pick — that argument is
what writes a PR's check status onto a branch's cached PR, and this branch's cached PR is a
different review.
Source Control follows the pick for the header link, review state, review actions and the
compare base. The file list, commit area, push target and PR creation keep resolving through the
workspace's own review: a commit or push acts on this worktree's branch, so pointing those at
another branch's review would retarget a push.
What deliberately does not change
The selection is the panes' view, not the workspace's link. It lives in the fork's session-only
renderer slice, keyed by worktree and shared between the two panes so they cannot disagree, and it
never moves
linkedPR— that slot is what push-target and PR-creation safety resolve through. It iskeyed on provider and number rather than the attachment key, which moves when a background refresh
fills in a title or URL.
Two things are gated on the pick instead of following it: the triage strip's Fix-checks-with-AI and
Resolve-conflicts-with-AI, which start an agent in this worktree and would fix another branch's
checks by committing here; and Unlink, which removes the row that carries the review on screen
rather than clearing a slot that would leave the row behind.
Verification
pnpm tc:webclean;pnpm run check:code-quality:changedclean;oxlintandoxfmtcleanverify-localization-extractionandverify-localization-catalogclean (2 new strings in thefork overlay)
provider branches of a picked Refresh (a switch mid-read, a switch inside the review refresh
itself, and a switch after the result key was claimed), the picked unlink (an issue and an MR
sharing a number, the tombstone a pick must not write, and a rowless pick), the Source Control
header with a pick, the polling path's branch argument and its error retraction, the review
resolver and the switcher
pnpm tcand the full unit suite. The diff touches onlysrc/renderer/**, so gate 1 is not required for this change; the full suite runs nightly onfork-main-tests.ymland again at release.Review
Reviewed by Opus 5.5, high: R1 (2 blocking fixed), delta R2 (1 blocking fixed), delta R3 (1 blocking fixed), delta clean on R4
R1 found two blockers — the Refresh sent any picked review's number to GitHub, and both panes
auto-cleared the shared pick from their own notion of the workspace's review — plus six should-fix
items; all were fixed in R2. The R1..R2 delta found one blocker its own fixes introduced (the
Refresh's staleness guard compared the async-result ref with itself) and three should-fix defects;
all were fixed in R3. The R2..R3 delta found that fix only half-closed (a switch inside the review
refresh still claimed the old pick's result key) plus two should-fix items; all were fixed in R4.
The R3..R4 delta came back clean, with three test-only NITs, which R5 closes: two of those
assertions could not fail, so they were rewritten and checked against their own absence.
Known limitations
keys worktrees by id the same way, so this follows existing behaviour rather than introducing it.
not change) and reports a provider failure only to the console; the pane's error banner reads the
branch's refresh state.
its own. Its checks still poll per review number.