Skip to content

fix(desktop): reduce review tab GitHub polling#2873

Merged
Kitenite merged 6 commits into
superset-sh:mainfrom
Kitenite:review-tab-status-check
Mar 25, 2026
Merged

fix(desktop): reduce review tab GitHub polling#2873
Kitenite merged 6 commits into
superset-sh:mainfrom
Kitenite:review-tab-status-check

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Mar 25, 2026

Summary

  • gate review-related GitHub polling to the Review tab so the Diffs tab does not keep triggering interval GitHub status refreshes
  • stop PR comments polling unless the Review tab is active
  • reuse cached repo context and avoid redundant local DB writes when GitHub status content is unchanged

Testing

  • bunx biome check apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx apps/desktop/src/lib/trpc/routers/workspaces/utils/github/github.ts apps/desktop/src/lib/trpc/routers/workspaces/procedures/git-status.ts
  • bunx tsc -p apps/desktop/tsconfig.json --noEmit --ignoreDeprecations 6.0
    • currently fails due to pre-existing unrelated generated-route and route typing issues in the desktop app worktree (for example missing routeTree.gen)

Summary by cubic

Scope GitHub PR status and comment polling to the Review tab and prefetch from Changes for faster switches, while restoring passive status behavior elsewhere to cut background traffic. Centralize query policies and avoid redundant repo-context fetches and DB writes.

  • Bug Fixes

    • Gate status/comment polling to Review; Changes fetches once for prefetch. Off-Review: no interval and staleTime is 0; refetch on focus only when Review is active.
    • Restore passive status policies: workspace page/hover/list/rows do not poll, don’t refetch on focus, and use longer stale times.
    • Refresh cached repo context only when origin actually changes (SSH/HTTPS treated equal); tests cover missing/changed origin cases.
    • Skip DB writes when only GitHub status timestamps differ.
  • Refactors

    • Centralized query policies in renderer/lib/githubQueryPolicy for status and PR comments; applied across Changes sidebar, workspace page, hover card, list items, rows.
    • usePRStatus accepts a surface option to tailor behavior; added unit tests for per-surface policies.

Written for commit 3c798c5. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes

    • Ignore non-functional timestamp differences in GitHub status to avoid unnecessary updates.
    • Smarter cache refresh when repository origin representation changes; removed some forced fresh-fetches.
  • New Features

    • Centralized GitHub query policies; status/comments fetching now adapts to UI surface context (page, sidebar, hover card, etc.).
    • PR-status hook accepts a surface option to better tailor polling behavior.
  • Performance

    • Reduced background activity: GitHub status and PR comment polling/refetching now run only when relevant UI surfaces are active.
  • Tests

    • Added tests covering cached repo-context refresh logic and GitHub query policy behaviors.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 25, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Compare fetched vs cached GitHub status ignoring lastRefreshed before persisting; stop forcing fresh repo-context in two flows and compute freshness from origin mismatches; centralize GitHub query timing/polling via new policy helpers and gate status/PR-comments polling on the Review tab/surface.

Changes

Cohort / File(s) Summary
Git status persistence & repo-context calls
apps/desktop/src/lib/trpc/routers/workspaces/procedures/git-status.ts, apps/desktop/src/lib/trpc/routers/workspaces/utils/github/github.ts
Strip lastRefreshed when comparing cached vs fetched GitHubStatus; only persist when differing. Remove forced { forceFresh: true } from two getRepoContext callsites.
Repo-context caching logic
apps/desktop/src/lib/trpc/routers/workspaces/utils/github/repo-context.ts
Precompute originUrl, load cached repo-context state, add exported shouldRefreshCachedRepoContext(...), and derive forceFresh from options or origin mismatch.
Repo-context tests
apps/desktop/src/lib/trpc/routers/workspaces/utils/github/github.test.ts
Added/updated tests for shouldRefreshCachedRepoContext, covering null cache, matching origins (SSH vs HTTPS normalized), missing origin, and differing origins.
GitHub query policy module & tests
apps/desktop/src/renderer/lib/githubQueryPolicy/githubQueryPolicy.ts, .../index.ts, .../githubQueryPolicy.test.ts
Introduce GitHubStatusQuerySurface and GitHubQueryPolicy types and two policy builders: getGitHubStatusQueryPolicy(...) and getGitHubPRCommentsQueryPolicy(...); add tests validating enabled/refetch/staleTime behavior across UI surfaces.
Renderer: UI components & hooks using policy
apps/desktop/src/renderer/screens/main/components/WorkspaceView/.../ChangesView.tsx, apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/.../WorkspaceListItem.tsx, .../WorkspaceHoverCard/WorkspaceHoverCard.tsx, apps/desktop/src/renderer/screens/main/components/WorkspacesListView/WorkspaceRow/WorkspaceRow.tsx, apps/desktop/src/renderer/screens/main/hooks/usePRStatus/usePRStatus.ts, apps/desktop/src/renderer/routes/_authenticated/_dashboard/workspace/$workspaceId/page.tsx
Replace inline query timing/enable logic with getGitHubStatusQueryPolicy / getGitHubPRCommentsQueryPolicy; ChangesView selects activeTab via selector and gates queries by isReviewTabActive; usePRStatus accepts surface and uses policy; several components pass surface/context accordingly.

Sequence Diagram(s)

sequenceDiagram
  participant UI as Review Tab (UI)
  participant Renderer as ChangesView / Hook
  participant TRPC as tRPC getGitHubStatus
  participant RepoUtil as getRepoContext
  participant Store as Worktree Store

  UI->>Renderer: tab activate/deactivate or surface visible
  Renderer->>TRPC: request GitHub status (policy: enabled/refetch/staleTime)
  TRPC->>RepoUtil: getRepoContext(worktreePath) (forceFresh computed from cached state + origin)
  RepoUtil-->>TRPC: repoContext / freshStatus
  TRPC->>Store: read cached githubStatus
  TRPC->>TRPC: remove `lastRefreshed` from both statuses
  alt statuses differ
    TRPC->>Store: persist fresh githubStatus
  else statuses equal
    TRPC-->>Store: no write
  end
  TRPC-->>Renderer: return freshStatus
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

"I nibbled timestamps, hopped through code so spry,
Stripped stale seconds, let fresh checks fly,
No forced fetch fuss, just tab-aware cheer,
Polling waits for review — tidy and clear,
A rabbit's small patch, swift as a sigh." 🐇✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.76% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main objective: reducing GitHub polling in the review tab.
Description check ✅ Passed PR description provides clear summary of changes, addresses testing, and includes auto-generated cubic summary with detailed objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx`:
- Around line 293-299: The comments query is being disabled when the Review tab
is inactive which makes reviewCommentCount render stale/zero; keep the query
enabled whenever we have a workspace and an activePullRequest but only gate
polling/focus behavior by isReviewTabActive. Concretely, change the query
options used in the component (symbols: enabled, refetchInterval,
refetchOnWindowFocus, GITHUB_PR_COMMENTS_REFETCH_INTERVAL_MS,
GITHUB_PR_COMMENTS_STALE_TIME_MS, workspaceId, activePullRequest,
isReviewTabActive) so that enabled is !!workspaceId && !!activePullRequest
(remove isReviewTabActive), refetchInterval remains isReviewTabActive &&
activePullRequest ? GITHUB_PR_COMMENTS_REFETCH_INTERVAL_MS : false, and
refetchOnWindowFocus is isReviewTabActive; leave staleTime as
GITHUB_PR_COMMENTS_STALE_TIME_MS.
- Around line 123-130: The getGitHubStatus query is left enabled on the Diffs
tab but configured with no interval or window-focus refetch, causing it to go
stale while ChangesHeader and CommitInput still read from it; update the query
options in ChangesView (the hook that sets
enabled/refetchInterval/refetchOnWindowFocus/staleTime) to either (A) enable a
low-touch off-tab refresh (e.g., set refetchOnWindowFocus: true and a small
refetchInterval when isReviewTabActive is false or reduce staleTime) or (B)
explicitly call the query's refetch when the active tab changes to Review; also
ensure the PR comments query (the query that was disabled off-tab) remains
enabled while the review badge is rendered (or make the badge read from a
separate always-enabled lightweight count query) so the badge count stays fresh
when not on the Review tab.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: aeb834f9-2c8d-4d69-b293-1834f91ee739

📥 Commits

Reviewing files that changed from the base of the PR and between 2c38833 and a70dd6e.

📒 Files selected for processing (3)
  • apps/desktop/src/lib/trpc/routers/workspaces/procedures/git-status.ts
  • apps/desktop/src/lib/trpc/routers/workspaces/utils/github/github.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx (1)

123-130: ⚠️ Potential issue | 🟠 Major

Keep the Diffs-visible PR metadata on a low-touch refresh path.

ChangesHeader, CommitInput, and the Review tab trigger still render githubStatus / githubComments outside the Review tab, but these query options remove the steady-state refresh path there. After the initial fetch, the PR action state, checks icon, and comment badge can drift until the user manually refreshes or re-enters Review. Either keep a cheap off-tab refresh for the data surfaced outside Review, or stop reading these queries from off-tab UI.

For TanStack Query v5, if a query stays mounted and enabled but both `refetchInterval` and `refetchOnWindowFocus` are `false`, what automatic refetch triggers remain while the component stays mounted?

Also applies to: 293-299

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx`
around lines 123 - 130, The githubStatus/githubComments queries are being
disabled for steady refresh off the Review tab by setting
refetchInterval/refetchOnWindowFocus to false (see
refetchInterval/refetchOnWindowFocus/staleTime usage and constants
GITHUB_STATUS_REFETCH_INTERVAL_MS, GITHUB_STATUS_STALE_TIME_MS,
GITHUB_STATUS_IDLE_STALE_TIME_MS), which lets PR metadata shown in ChangesHeader
and CommitInput drift; either re-enable a lightweight off-tab refresh (e.g., set
refetchInterval to a low idle interval constant when isReviewTabActive is false)
or stop reading those queries in off-tab UI (only mount/use them when
isReviewTabActive); update the query options for githubStatus/githubComments
accordingly and ensure any staleTime change matches the chosen idle behavior.
Note: verify TanStack Query v5 behavior for mounted/enabled queries—without
refetchInterval/refetchOnWindowFocus the remaining automatic refetch triggers
are manual refetches, query invalidation, or mount/refetchOnMount semantics.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx`:
- Around line 123-130: The githubStatus/githubComments queries are being
disabled for steady refresh off the Review tab by setting
refetchInterval/refetchOnWindowFocus to false (see
refetchInterval/refetchOnWindowFocus/staleTime usage and constants
GITHUB_STATUS_REFETCH_INTERVAL_MS, GITHUB_STATUS_STALE_TIME_MS,
GITHUB_STATUS_IDLE_STALE_TIME_MS), which lets PR metadata shown in ChangesHeader
and CommitInput drift; either re-enable a lightweight off-tab refresh (e.g., set
refetchInterval to a low idle interval constant when isReviewTabActive is false)
or stop reading those queries in off-tab UI (only mount/use them when
isReviewTabActive); update the query options for githubStatus/githubComments
accordingly and ensure any staleTime change matches the chosen idle behavior.
Note: verify TanStack Query v5 behavior for mounted/enabled queries—without
refetchInterval/refetchOnWindowFocus the remaining automatic refetch triggers
are manual refetches, query invalidation, or mount/refetchOnMount semantics.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 967f64f5-91c6-4cd6-9f26-66c01ad7b145

📥 Commits

Reviewing files that changed from the base of the PR and between a70dd6e and ecba06b.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx">

<violation number="1" location="apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx:126">
P2: Non-Review tabs still refetch GitHub status on window focus because focus refetch is keyed to `isActive` and idle staleTime is `0`.</violation>
</file>

<file name="apps/desktop/src/lib/trpc/routers/workspaces/utils/github/repo-context.ts">

<violation number="1" location="apps/desktop/src/lib/trpc/routers/workspaces/utils/github/repo-context.ts:94">
P1: Prevent an infinite cache invalidation loop when `originUrl` is missing or has a different casing than the canonical GitHub URL.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread apps/desktop/src/lib/trpc/routers/workspaces/utils/github/repo-context.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/desktop/src/lib/trpc/routers/workspaces/utils/github/github.test.ts (1)

76-111: Add one mixed-format remote case.

These assertions only cover already-normalized HTTPS URLs, so a regression in the SSH/.git normalization path would still pass. One case mixing git@github.com:owner/repo.git and https://github.com/owner/repo would lock down the behavior this helper depends on.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/desktop/src/lib/trpc/routers/workspaces/utils/github/github.test.ts`
around lines 76 - 111, Add a new test case to shouldRefreshCachedRepoContext
that covers mixed-format remotes (SSH vs HTTPS/.git) to ensure normalization
works: add a test where originUrl is an SSH form like
"git@github.com:owner/repo.git" and cachedRepoContext.repoUrl/upstreamUrl are
the HTTPS form "https://github.com/owner/repo" (or vice versa) and assert the
function returns false when they are the same repo after normalization and true
when they differ; update the test suite in github.test.ts near the other
shouldRefreshCachedRepoContext cases to include this mixed-format scenario
referencing the shouldRefreshCachedRepoContext helper.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx`:
- Around line 123-127: The GitHub status query in ChangesView.tsx currently uses
refetchOnWindowFocus: isActive and staleTime: 0 which causes refetches when
switching to Diffs; update the query options in ChangesView (the block setting
refetchInterval / refetchOnWindowFocus / staleTime) to use refetchOnWindowFocus:
isReviewTabActive and make staleTime conditional (e.g. isReviewTabActive ?
GITHUB_STATUS_STALE_TIME_MS : Infinity) so the query does not become immediately
stale when not on the Review tab.

---

Nitpick comments:
In `@apps/desktop/src/lib/trpc/routers/workspaces/utils/github/github.test.ts`:
- Around line 76-111: Add a new test case to shouldRefreshCachedRepoContext that
covers mixed-format remotes (SSH vs HTTPS/.git) to ensure normalization works:
add a test where originUrl is an SSH form like "git@github.com:owner/repo.git"
and cachedRepoContext.repoUrl/upstreamUrl are the HTTPS form
"https://github.com/owner/repo" (or vice versa) and assert the function returns
false when they are the same repo after normalization and true when they differ;
update the test suite in github.test.ts near the other
shouldRefreshCachedRepoContext cases to include this mixed-format scenario
referencing the shouldRefreshCachedRepoContext helper.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 72bc144a-48c5-450a-a476-e704c3447fb9

📥 Commits

Reviewing files that changed from the base of the PR and between ecba06b and 2d3ba50.

📒 Files selected for processing (3)
  • apps/desktop/src/lib/trpc/routers/workspaces/utils/github/github.test.ts
  • apps/desktop/src/lib/trpc/routers/workspaces/utils/github/repo-context.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
apps/desktop/src/renderer/lib/githubQueryPolicy/githubQueryPolicy.test.ts (2)

96-143: PR comments policy tests cover the key scenarios well.

The tests validate the important cases (review tab active/inactive, no active PR). For completeness, consider adding tests for:

  1. hasWorkspaceId: false — verifies the query is disabled without a workspace
  2. isActive: false — verifies behavior when the sidebar is not active
💡 Suggested additional test cases
+	test("disables comments when the sidebar is inactive", () => {
+		expect(
+			getGitHubPRCommentsQueryPolicy({
+				hasWorkspaceId: true,
+				hasActivePullRequest: true,
+				isActive: false,
+				isReviewTabActive: true,
+			}),
+		).toEqual({
+			enabled: false,
+			refetchInterval: false,
+			refetchOnWindowFocus: false,
+			staleTime: 30_000,
+		});
+	});
+
+	test("disables comments when no workspace ID is present", () => {
+		expect(
+			getGitHubPRCommentsQueryPolicy({
+				hasWorkspaceId: false,
+				hasActivePullRequest: true,
+				isActive: true,
+				isReviewTabActive: true,
+			}),
+		).toEqual({
+			enabled: false,
+			refetchInterval: false,
+			refetchOnWindowFocus: false,
+			staleTime: 30_000,
+		});
+	});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/desktop/src/renderer/lib/githubQueryPolicy/githubQueryPolicy.test.ts`
around lines 96 - 143, Add two unit tests for getGitHubPRCommentsQueryPolicy:
one that passes hasWorkspaceId: false (with hasActivePullRequest: true,
isActive: true, isReviewTabActive: true) and asserts the returned policy is {
enabled: false, refetchInterval: false, refetchOnWindowFocus: false, staleTime:
30_000 }, and another that passes isActive: false (with hasWorkspaceId: true,
hasActivePullRequest: true, isReviewTabActive: true) and asserts the same
disabled policy; name the tests descriptively (e.g., "disables comments when
there is no workspace" and "disables comments when sidebar is inactive") and
place them alongside the existing tests for getGitHubPRCommentsQueryPolicy.

7-94: Good coverage of status policy surfaces and states.

The tests comprehensively cover the different UI surfaces and their expected polling behaviors. Consider adding a test case for when hasWorkspaceId is false to verify the query is disabled in that scenario—this would improve edge case coverage.

💡 Suggested additional test case
+	test("disables status query when no workspace ID is present", () => {
+		expect(
+			getGitHubStatusQueryPolicy("changes-sidebar", {
+				hasWorkspaceId: false,
+				isActive: true,
+				isReviewTabActive: true,
+			}),
+		).toEqual({
+			enabled: false,
+			refetchInterval: false,
+			refetchOnWindowFocus: false,
+			staleTime: 10_000,
+		});
+	});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/desktop/src/renderer/lib/githubQueryPolicy/githubQueryPolicy.test.ts`
around lines 7 - 94, Add a test to assert getGitHubStatusQueryPolicy returns a
disabled policy when hasWorkspaceId is false: call getGitHubStatusQueryPolicy
(same signature used in existing tests) for any relevant surface (e.g.,
"workspace-page" or "changes-sidebar") with hasWorkspaceId: false and
appropriate isActive/isReviewTabActive values, and expect enabled: false,
refetchInterval: false, refetchOnWindowFocus: false, and the correct staleTime
for that surface; place the test alongside the other cases in
githubQueryPolicy.test.ts.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/desktop/src/renderer/lib/githubQueryPolicy/githubQueryPolicy.ts`:
- Around line 48-58: In the "changes-sidebar" case of the switch over surface,
update the refetchOnWindowFocus setting so it uses the same guard as comments:
change refetchOnWindowFocus from isEnabled to isEnabled && isReviewTabActive;
this ensures that when isReviewTabActive is false (Diffs tab) the query won't
refetch on window focus while staleTime may be 0. Locate the case
"changes-sidebar" block and modify the refetchOnWindowFocus expression
accordingly (the other symbols to reference: isEnabled, isReviewTabActive,
refetchOnWindowFocus, staleTime, and compare to getGitHubPRCommentsQueryPolicy
behavior).

---

Nitpick comments:
In `@apps/desktop/src/renderer/lib/githubQueryPolicy/githubQueryPolicy.test.ts`:
- Around line 96-143: Add two unit tests for getGitHubPRCommentsQueryPolicy: one
that passes hasWorkspaceId: false (with hasActivePullRequest: true, isActive:
true, isReviewTabActive: true) and asserts the returned policy is { enabled:
false, refetchInterval: false, refetchOnWindowFocus: false, staleTime: 30_000 },
and another that passes isActive: false (with hasWorkspaceId: true,
hasActivePullRequest: true, isReviewTabActive: true) and asserts the same
disabled policy; name the tests descriptively (e.g., "disables comments when
there is no workspace" and "disables comments when sidebar is inactive") and
place them alongside the existing tests for getGitHubPRCommentsQueryPolicy.
- Around line 7-94: Add a test to assert getGitHubStatusQueryPolicy returns a
disabled policy when hasWorkspaceId is false: call getGitHubStatusQueryPolicy
(same signature used in existing tests) for any relevant surface (e.g.,
"workspace-page" or "changes-sidebar") with hasWorkspaceId: false and
appropriate isActive/isReviewTabActive values, and expect enabled: false,
refetchInterval: false, refetchOnWindowFocus: false, and the correct staleTime
for that surface; place the test alongside the other cases in
githubQueryPolicy.test.ts.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d15bd9f6-7828-4855-be2c-8f1ce98416f9

📥 Commits

Reviewing files that changed from the base of the PR and between 9f80924 and d754002.

📒 Files selected for processing (9)
  • apps/desktop/src/renderer/lib/githubQueryPolicy/githubQueryPolicy.test.ts
  • apps/desktop/src/renderer/lib/githubQueryPolicy/githubQueryPolicy.ts
  • apps/desktop/src/renderer/lib/githubQueryPolicy/index.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/workspace/$workspaceId/page.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/components/WorkspaceHoverCard/WorkspaceHoverCard.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspacesListView/WorkspaceRow/WorkspaceRow.tsx
  • apps/desktop/src/renderer/screens/main/hooks/usePRStatus/usePRStatus.ts

@Kitenite Kitenite merged commit 3055f96 into superset-sh:main Mar 25, 2026
7 checks passed
@Kitenite Kitenite deleted the review-tab-status-check branch March 25, 2026 21:23
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