fix(frontend): populate session.pullRequest from /pr endpoint (#251)#279
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Contributor
There was a problem hiding this comment.
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>
Contributor
There was a problem hiding this comment.
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>
Contributor
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Collaborator
Author
This was referenced Jun 17, 2026
Closed
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.

Problem
Closes #251.
WorkspaceSession.pullRequestis declared on the type but never populated —fetchWorkspacesinuseWorkspaceQuery.tsis the only place that builds session objects, and it never set the field. So everyBoolean(session.pullRequest)check was dead:SessionInspector) gated its PR fetch on it → the fetch never ran → always showed "No pull request opened yet."SessionsBoard) and the/prspage (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}/pr→Svc.ListPRs→ store) returns real PR facts; the bug was purely the missing frontend hydration.Fix
Hydrate
pullRequestcentrally infetchWorkspaces— the single source that buildsWorkspaceSession/WorkspaceSummaryfor the workspace, board, PR page, and sidebar (they all read the oneworkspaceQueryKeycache):fetchSessionPR(sessionId)callingGET /api/v1/sessions/{sessionId}/pr(same endpoint the inspector already uses) →{number, state}orundefined.Promise.all) for every non-terminated session and attachpullRequestto each mapped session.undefined) rather than failing the whole workspace query; terminated sessions are skipped to avoid wasted calls.GET /sessions/{sessionId}/prstays 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 readsession.pullRequestand now get real data automatically).Tests
Extended
useWorkspaceQuery.test.tsx(mock now handles the/prendpoint):{number, state}and leaves PR-less sessionsundefined.undefinedwithout failing the query.npm run typecheckclean;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/prslists the session — while PR-less sessions still render the empty states.🤖 Generated with Claude Code