Skip to content

prs faster redirects -> Primary - #1053

Merged
arul28 merged 2 commits into
mainfrom
ade/prs-faster-redirects-c39bb86f
Aug 7, 2026
Merged

prs faster redirects -> Primary#1053
arul28 merged 2 commits into
mainfrom
ade/prs-faster-redirects-c39bb86f

Conversation

@arul28

@arul28 arul28 commented Aug 6, 2026

Copy link
Copy Markdown
Owner

ADE   Open in ADE  ·  ade/prs-faster-redirects-c39bb86f branch  ·  PR #1053

Summary by CodeRabbit

  • New Features
    • PR links now retain repository and pull request details across lanes, chats, toasts, timeline events, and direct URLs.
    • GitHub pull requests can be opened and resolved by repository coordinates, even while data is loading or when not locally mapped.
    • Unavailable PRs remain visible in a provisional state while details load.
  • Bug Fixes
    • Improved deep-link handling, selection persistence, repository matching, and closed PR history loading.
    • Reduced unnecessary refreshes while preserving existing data when refreshes fail.
  • Tests
    • Expanded coverage for coordinate-based navigation, loading states, refresh retries, and selection behavior.

@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ade Ignored Ignored Preview Aug 7, 2026 12:25am

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@arul28, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 33 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 97007d72-eaf9-47d1-a484-7570b66b8a7d

📥 Commits

Reviewing files that changed from the base of the PR and between 9f2435f and c04f348.

📒 Files selected for processing (13)
  • apps/desktop/src/renderer/components/lanes/LanesPage.test.ts
  • apps/desktop/src/renderer/components/lanes/LanesPage.tsx
  • apps/desktop/src/renderer/components/lanes/lanePageModel.ts
  • apps/desktop/src/renderer/components/prs/PRsPage.test.tsx
  • apps/desktop/src/renderer/components/prs/PRsPage.tsx
  • apps/desktop/src/renderer/components/prs/detail/PrDetailTimelineRails.test.tsx
  • apps/desktop/src/renderer/components/prs/detail/PrDetailTimelineRails.tsx
  • apps/desktop/src/renderer/components/prs/tabs/GitHubTab.tsx
  • apps/desktop/src/renderer/components/prs/tabs/GitHubTabRowsAndMapping.test.tsx
  • apps/desktop/src/renderer/components/prs/tabs/githubTabModel.ts
  • apps/desktop/src/renderer/components/prs/tabs/useGitHubTabSelection.ts
  • apps/desktop/src/renderer/components/prs/tabs/useGitHubTargetHistory.test.tsx
  • apps/desktop/src/renderer/components/prs/tabs/useGitHubTargetHistory.ts
📝 Walkthrough

Walkthrough

Changes

Coordinate-based PR deep links

Layer / File(s) Summary
Route contract and navigation
apps/desktop/src/renderer/components/prs/prsRouteState.ts, apps/desktop/src/renderer/components/prs/PRsPage.tsx, apps/desktop/src/renderer/components/prs/detail/*, apps/desktop/src/renderer/components/lanes/*, apps/desktop/src/renderer/lib/lanePrBadge.ts, apps/desktop/src/renderer/components/app/*
PR routes now carry GitHub PR numbers and repository coordinates. Navigation and detail URLs preserve coordinate-based selections.
GitHub selection and reconciliation
apps/desktop/src/renderer/components/prs/tabs/*
GitHubTab resolves coordinate targets through local, linked, provisional, unmapped, and expanded-history PR data.
Snapshot lookup and refresh behavior
apps/desktop/src/renderer/browserMock.ts, apps/desktop/src/renderer/components/lanes/LanesPage.tsx, apps/desktop/src/renderer/components/prs/state/*
Snapshot-backed coordinate APIs support PR detail data. Lane refreshes use local-first loading, scoped forced refreshes, retry handling, and stale-data preservation.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

  • arul28/ADE#608: Adds related coordinate-based GitHub PR routing and snapshot-backed status retrieval.
  • arul28/ADE#857: Extends GitHub PR deep links, snapshot retrieval, and navigation reconciliation.
  • arul28/ADE#887: Shares GitHub PR reconciliation, snapshot hydration, lane mapping, and coordinate navigation changes.

Suggested labels: desktop

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title identifies faster PR redirects, which matches the changes to PR deep-link navigation and loading behavior.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ade/prs-faster-redirects-c39bb86f

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

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/desktop/src/renderer/components/lanes/LanesPage.tsx (1)

3339-3355: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Route GitHub-only lane badges into the GitHub PR flow.

When target.linkedPrId is null, this handler opens GitHub externally. GitHub-only tags now carry githubPrNumber, repoOwner, and repoName, and the GitHub tab supports coordinate-only and provisional selection. This bypasses the new in-app deep-link flow.

For GitHub-only tags, navigate to the GitHub PR tab with a null local ID and the repository coordinates. Keep the external URL as a separate action if needed. Add a named regression test such as opens an unmapped lane PR badge in the GitHub tab by coordinates.

As per coding guidelines, **/*.test.{ts,tsx} must record a named regression test or exact alternate verification for every accepted correctness finding.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/src/renderer/components/lanes/LanesPage.tsx` around lines 3339 -
3355, Update the onActivate handler for GitHub-only targets in the lane PR badge
flow: when target.linkedPrId is null but githubPrNumber, repoOwner, and repoName
are available, navigate to the GitHub PR tab using a null local ID and those
repository coordinates instead of opening the URL externally. Keep external URL
opening as a separate fallback action, and add a named regression test such as
“opens an unmapped lane PR badge in the GitHub tab by coordinates.”

Source: Coding guidelines

🧹 Nitpick comments (3)
apps/desktop/src/renderer/components/prs/PRsPage.tsx (1)

291-322: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Simplify the duplicated localSelectedPr fallback.

target already falls back to localSelectedPr at Line 291. The extra localSelectedPr?.… fallbacks at Lines 320-322 can therefore only run when target is null, in which case both branches yield null. The branches add no behavior.

♻️ Proposed simplification
-      selectedPrNumber: hasPrNumber ? target?.prNumber : localSelectedPr?.githubPrNumber ?? null,
-      repoOwner: hasCoordinates ? target?.repoOwner : localSelectedPr?.repoOwner ?? null,
-      repoName: hasCoordinates ? target?.repoName : localSelectedPr?.repoName ?? null,
+      selectedPrNumber: target?.prNumber ?? null,
+      repoOwner: hasCoordinates ? target?.repoOwner ?? null : null,
+      repoName: hasCoordinates ? target?.repoName ?? null : null,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/src/renderer/components/prs/PRsPage.tsx` around lines 291 - 322,
In the buildPrsRouteSearch argument construction, remove the redundant
localSelectedPr fallbacks for selectedPrNumber, repoOwner, and repoName. Reuse
the already-resolved target values, returning null when target lacks those
fields, while preserving the existing coordinate checks and routing behavior.
apps/desktop/src/renderer/components/prs/tabs/GitHubTab.tsx (2)

451-471: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reuse prsByCoordinateMap instead of a linear scan.

prsByCoordinateMap (Lines 187-193) is keyed by githubCoordKey, which calls prRouteCoordinatesKey. prRouteCoordinatesEqual is defined as equality of those same keys. The prs.find(...) scan at Lines 459-470 is therefore equivalent to one map lookup, but runs in O(n) on every recompute and duplicates the normalization logic.

♻️ Proposed refactor
   const selectedLocalPr = React.useMemo((): PrWithConflicts | null => {
     if (!selectedItem) return null;
     if (selectedItem.linkedPrId) {
       const linked = prsByIdMap.get(selectedItem.linkedPrId);
       if (linked) return linked;
     }
     // Prefer the local row by GitHub coordinates when a stale snapshot has lost
     // its link (or carries a foreign machine's link id).
-    return prs.find((pr) => prRouteCoordinatesEqual(
-      {
-        prNumber: pr.githubPrNumber,
-        repoOwner: pr.repoOwner,
-        repoName: pr.repoName,
-      },
-      {
-        prNumber: selectedItem.githubPrNumber,
-        repoOwner: selectedItem.repoOwner,
-        repoName: selectedItem.repoName,
-      },
-    )) ?? null;
-  }, [prs, prsByIdMap, selectedItem]);
+    return prsByCoordinateMap.get(githubCoordKey(selectedItem)) ?? null;
+  }, [prsByCoordinateMap, prsByIdMap, selectedItem]);

If prRouteCoordinatesEqual becomes unused in this file after the change, remove its import.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/src/renderer/components/prs/tabs/GitHubTab.tsx` around lines 451
- 471, Update selectedLocalPr to use prsByCoordinateMap with the selected item's
GitHub coordinate key instead of scanning prs with prs.find and
prRouteCoordinatesEqual. Preserve the existing linked-pr lookup precedence and
null fallback, and remove the prRouteCoordinatesEqual import if it becomes
unused.

499-511: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Align the memo comment and dependency list.

The comment states that prs[0]?.projectId is captured at build time and that syntheticUnmappedId keys identity. The dependency array still lists prs, so the memo recomputes on every prs change regardless. Either drop prs from the deps (keeping the eslint-disable and the stated intent), or keep prs and remove the disable comment plus the unused syntheticUnmappedId dependency. The current mix is misleading for future readers.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/src/renderer/components/prs/tabs/GitHubTab.tsx` around lines 499
- 511, Align the selectedUnmappedPr React.useMemo dependencies with its
explanatory comment: remove prs from the dependency array while retaining
syntheticUnmappedId as the identity key and preserving the eslint suppression,
so changes to prs do not trigger recomputation after build time.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/desktop/src/renderer/components/prs/detail/PrDetailTimelineRails.tsx`:
- Around line 826-852: Preserve hash-based PR routes in handleVisibleEventChange
by detecting when location.hash contains the authoritative `#/prs` route and
updating or reconstructing that hash with the replacement eventId instead of
navigating only with pathname and search. Keep pathname/search navigation
unchanged for non-hash routes, and add a named regression test such as
“preserves a hash-based coordinate PR route when the visible event changes”
asserting the route retains `#/prs` and the replacement eventId.

In `@apps/desktop/src/renderer/components/prs/PRsPage.tsx`:
- Around line 232-262: Add component-test coverage in PRsPage.test.tsx for
reconciling a coordinate-only route containing pr, repoOwner, and repoName
without prId, asserting the route target and matching local PR selection are
handled correctly. Also cover the workflow-route branch around
setSelectedPrTarget so a non-null target is cleared when the route no longer has
an explicit PR selection. Keep the existing error-gating coverage unchanged.

In `@apps/desktop/src/renderer/components/prs/tabs/githubTabModel.ts`:
- Around line 224-239: Update itemMatchesSelectionTarget to require
target.repoOwner and target.repoName when matching repository coordinates,
preventing coordinate-less targets from matching externalPullRequests rows. When
target.prId is provided, return only the matching itemId with valid coordinates;
do not allow the number-based fallback to override an ID mismatch. For
coordinate-less prNumber targets, restrict the fallback to items whose scope is
"repo".

In `@apps/desktop/src/renderer/components/prs/tabs/useGitHubTabSelection.ts`:
- Around line 62-63: Update the selectedPrTarget resolution around
itemMatchesSelectionTarget so number-only targets are not resolved to the first
matching row: require repository coordinates for coordinate-based selection, or
resolve the number-only target only when exactly one displayed item matches.
Ensure ambiguous matches remain unresolved, and add a named regression test such
as does not resolve an ambiguous number-only PR route across repositories.

In `@apps/desktop/src/renderer/components/prs/tabs/useGitHubTargetHistory.ts`:
- Around line 97-129: Update requestHistory so the partial-history paging branch
only calls requestHistory when loaded.history.pageLimit is greater than the
historyPageLimit requested for the current fetch; otherwise stop paging and
invoke the existing 30-second retry path via scheduleRetry. Preserve the
existing max-page-limit handling and clearRetry behavior when history is
complete.

---

Outside diff comments:
In `@apps/desktop/src/renderer/components/lanes/LanesPage.tsx`:
- Around line 3339-3355: Update the onActivate handler for GitHub-only targets
in the lane PR badge flow: when target.linkedPrId is null but githubPrNumber,
repoOwner, and repoName are available, navigate to the GitHub PR tab using a
null local ID and those repository coordinates instead of opening the URL
externally. Keep external URL opening as a separate fallback action, and add a
named regression test such as “opens an unmapped lane PR badge in the GitHub tab
by coordinates.”

---

Nitpick comments:
In `@apps/desktop/src/renderer/components/prs/PRsPage.tsx`:
- Around line 291-322: In the buildPrsRouteSearch argument construction, remove
the redundant localSelectedPr fallbacks for selectedPrNumber, repoOwner, and
repoName. Reuse the already-resolved target values, returning null when target
lacks those fields, while preserving the existing coordinate checks and routing
behavior.

In `@apps/desktop/src/renderer/components/prs/tabs/GitHubTab.tsx`:
- Around line 451-471: Update selectedLocalPr to use prsByCoordinateMap with the
selected item's GitHub coordinate key instead of scanning prs with prs.find and
prRouteCoordinatesEqual. Preserve the existing linked-pr lookup precedence and
null fallback, and remove the prRouteCoordinatesEqual import if it becomes
unused.
- Around line 499-511: Align the selectedUnmappedPr React.useMemo dependencies
with its explanatory comment: remove prs from the dependency array while
retaining syntheticUnmappedId as the identity key and preserving the eslint
suppression, so changes to prs do not trigger recomputation after build time.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c7823c37-f8a1-4e7b-905d-40235696c3d3

📥 Commits

Reviewing files that changed from the base of the PR and between 0e53ea9 and 9f2435f.

📒 Files selected for processing (32)
  • apps/desktop/src/renderer/browserMock.ts
  • apps/desktop/src/renderer/components/app/App.tsx
  • apps/desktop/src/renderer/components/app/AppShell.tsx
  • apps/desktop/src/renderer/components/chat/ChatGitToolbar.tsx
  • apps/desktop/src/renderer/components/lanes/LaneWorkPane.tsx
  • apps/desktop/src/renderer/components/lanes/LanesPage.test.ts
  • apps/desktop/src/renderer/components/lanes/LanesPage.tsx
  • apps/desktop/src/renderer/components/lanes/lanePageModel.ts
  • apps/desktop/src/renderer/components/prs/PRsPage.tsx
  • apps/desktop/src/renderer/components/prs/detail/PrDetailPane.tsx
  • apps/desktop/src/renderer/components/prs/detail/PrDetailTimelineRails.test.tsx
  • apps/desktop/src/renderer/components/prs/detail/PrDetailTimelineRails.tsx
  • apps/desktop/src/renderer/components/prs/prsRouteState.test.ts
  • apps/desktop/src/renderer/components/prs/prsRouteState.ts
  • apps/desktop/src/renderer/components/prs/state/PrsContext.test.tsx
  • apps/desktop/src/renderer/components/prs/state/PrsContext.tsx
  • apps/desktop/src/renderer/components/prs/tabs/GitHubTab.test.tsx
  • apps/desktop/src/renderer/components/prs/tabs/GitHubTab.testHarness.tsx
  • apps/desktop/src/renderer/components/prs/tabs/GitHubTab.tsx
  • apps/desktop/src/renderer/components/prs/tabs/GitHubTabCreateLaneDialog.tsx
  • apps/desktop/src/renderer/components/prs/tabs/GitHubTabDeepLinks.test.tsx
  • apps/desktop/src/renderer/components/prs/tabs/GitHubTabRowsAndMapping.test.tsx
  • apps/desktop/src/renderer/components/prs/tabs/GitHubTabView.tsx
  • apps/desktop/src/renderer/components/prs/tabs/githubTabModel.ts
  • apps/desktop/src/renderer/components/prs/tabs/useGitHubTabListModel.ts
  • apps/desktop/src/renderer/components/prs/tabs/useGitHubTabSelection.ts
  • apps/desktop/src/renderer/components/prs/tabs/useGitHubTargetHistory.ts
  • apps/desktop/src/renderer/components/terminals/LanePrBadge.test.tsx
  • apps/desktop/src/renderer/components/terminals/SessionCard.test.tsx
  • apps/desktop/src/renderer/components/terminals/useLanePrs.ts
  • apps/desktop/src/renderer/lib/lanePrBadge.test.ts
  • apps/desktop/src/renderer/lib/lanePrBadge.ts

Comment thread apps/desktop/src/renderer/components/prs/PRsPage.tsx
Comment thread apps/desktop/src/renderer/components/prs/tabs/githubTabModel.ts
Comment thread apps/desktop/src/renderer/components/prs/tabs/useGitHubTabSelection.ts Outdated
@arul28
arul28 merged commit c7fcfda into main Aug 7, 2026
36 checks passed
@arul28
arul28 deleted the ade/prs-faster-redirects-c39bb86f branch August 7, 2026 01:55
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