Skip to content

fix(frontend): populate session.pullRequest from /pr endpoint (#251)#279

Merged
harshitsinghbhandari merged 4 commits into
mainfrom
fix/251-pr-details-not-populated
Jun 17, 2026
Merged

fix(frontend): populate session.pullRequest from /pr endpoint (#251)#279
harshitsinghbhandari merged 4 commits into
mainfrom
fix/251-pr-details-not-populated

Conversation

@neversettle17-101

Copy link
Copy Markdown
Collaborator

Problem

Closes #251. WorkspaceSession.pullRequest is declared on the type but never populatedfetchWorkspaces in useWorkspaceQuery.ts is the only place that builds session objects, and it never set the field. So every Boolean(session.pullRequest) check was dead:

  • Summary tab (SessionInspector) gated its PR fetch on it → the fetch never ran → always showed "No pull request opened yet."
  • Board card (SessionsBoard) and the /prs page (PullRequestsPage) read the field directly → kanban showed "no PR yet" and the PR page was always empty.

The backend chain (GET /api/v1/sessions/{sessionId}/prSvc.ListPRs → store) returns real PR facts; the bug was purely the missing frontend hydration.

Fix

Hydrate pullRequest centrally in fetchWorkspaces — the single source that builds WorkspaceSession/WorkspaceSummary for the workspace, board, PR page, and sidebar (they all read the one workspaceQueryKey cache):

  • Added fetchSessionPR(sessionId) calling GET /api/v1/sessions/{sessionId}/pr (same endpoint the inspector already uses) → {number, state} or undefined.
  • Fetch PR facts in parallel (Promise.all) for every non-terminated session and attach pullRequest to each mapped session.
  • A per-session fetch error degrades to "no PR" (undefined) rather than failing the whole workspace query; terminated sessions are skipped to avoid wasted calls.

GET /sessions/{sessionId}/pr stays the single source of truth — no new backend endpoint, no PR data embedded in the session-list response, and no changes to the consuming components (they read session.pullRequest and now get real data automatically).

Tests

Extended useWorkspaceQuery.test.tsx (mock now handles the /pr endpoint):

  • PR hydration populates {number, state} and leaves PR-less sessions undefined.
  • A per-session PR error degrades to undefined without failing the query.
  • Terminated sessions skip the fetch.

npm run typecheck clean; npm test → 130 passed (3 new).

Manual verification

With the daemon running and a session that has a real open PR: Summary tab shows PR number/state/CI/mergeability/review, the Board card shows PR #n · state, and /prs lists the session — while PR-less sessions still render the empty states.

🤖 Generated with Claude Code

neversettle17-101 and others added 2 commits June 17, 2026 14:31
WorkspaceSession.pullRequest was declared but never populated, so every
Boolean(session.pullRequest) check was dead: the Summary tab gated its PR
fetch on it (never ran), and the Board card and /prs page read it directly
(always empty).

Hydrate the field centrally in fetchWorkspaces — the single place that
builds session objects for the workspace, board, PR page, and sidebar — by
fetching GET /sessions/{sessionId}/pr per non-terminated session in parallel
and attaching {number, state}. A per-session fetch error degrades to "no PR"
rather than failing the whole workspace query; terminated sessions are
skipped. GET /sessions/{sessionId}/pr stays the single source of truth, so
no new backend endpoint and no changes to the consuming components.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

…251)

Drives the real useWorkspaceQuery + real SessionsBoard / PullRequestsPage
for an ordinary project (from /api/v1/projects) whose session has an open PR,
mocking only the HTTP client and router. Confirms PR facts fetched from
/sessions/{id}/pr flow through the shared workspace cache into both the Board
card ("PR #278 · open") and the PR page row.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

…egration

Cross-component integration test belongs in a dedicated folder, separate
from the co-located unit tests. No behavior change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@neversettle17-101

Copy link
Copy Markdown
Collaborator Author
Screenshot 2026-06-17 at 3 29 52 PM Tested the branch locally can see the PR status in the summary

@harshitsinghbhandari harshitsinghbhandari left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

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.

bug: session inspector in summary section doesn't show PR details even though its been raised

2 participants