Skip to content

feat: the Sessions page keeps itself current and says who each of your pull requests is waiting on - #122

Merged
fiddur merged 5 commits into
developfrom
sessions-refresh
Nov 5, 2026
Merged

fiddur merged 5 commits into
developfrom
sessions-refresh

Conversation

@fiddur

@fiddur fiddur commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Own pull requests show a Status (Draft badge, open threads, "Waiting on: a, b, …", approved) instead of Author, from one GraphQL search. The page refreshes itself every minute while visible and shows the data's age, with a reload button that asks GitHub past the cache.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w

…r pull requests is waiting on

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w
@fiddur
fiddur requested a balanced review from Copilot November 5, 2026 07:14

@diffity diffity 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.

Self-review: one P2 (manual reload can exhaust the search rate limit and show empty lists), one P3. Tests pass locally (server 242).

— diffity review, requested by @fiddur

res.status(401).json({ error: 'Sign in first' });
return;
}
const body = await sessionsBody(user, { fresh: req.query.fresh === '1' });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: fresh=1 skips the cache on every click, and each click runs both the REST search and the GraphQL search. Search allows 30 requests a minute per user, and its 403 is turned into an empty list. A few impatient clicks therefore show "Nothing is waiting for your review" as if it were true. Let a fresh request reuse a cache entry younger than about 10 seconds.

Comment thread packages/server/src/html.ts Outdated
let inFlight = false;
let failed = false;

const formatAge = ms => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: this is a hand copy of the exported formatAge, so the server label and the ticking label can drift apart. Interpolate ${formatAge.toString()} into the script so there is one source.

…ld, and the age label has one formatter

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w

Copilot AI 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.

🟡 Changes recommended

Unresolved issues can hide outstanding review threads, disrupt keyboard focus during refresh, and replace valid data with error content while reporting refresh success.

3 open issues
What changed in this PR

This PR makes the server-rendered Sessions page refresh automatically and show review status for the user’s own pull requests.

Changes:

  • Fetches own pull requests and review metadata through one GraphQL search.
  • Replaces the Author column on own pull requests with draft, thread, reviewer, and approval status.
  • Adds visible-tab refreshes, data-age labels, and a reload button that bypasses the server cache.
File Description
packages/​server/​tests/​service.test.ts Tests GraphQL results, cache timestamps, and forced refreshes.
packages/​server/​tests/​http.test.ts Tests status rendering, fragment responses, and script delivery.
packages/​server/​tests/​helpers.ts Adds fake GraphQL search responses and review metadata.
packages/​server/​src/​web.ts Allows same-origin requests from page scripts.
packages/​server/​src/​service.ts Exposes fetch timestamps and cache-bypass options.
packages/​server/​src/​html.ts Adds refresh controls, age labels, and section-state restoration.
packages/​server/​src/​github.ts Retrieves own pull requests with threads and requested reviewers.
packages/​server/​src/​app.ts Renders pull-request status and serves refresh fragments.

Review effort: Balanced

Comment thread packages/server/src/app.ts Resolved
Comment thread packages/server/src/app.ts Resolved
Comment thread packages/server/src/html.ts Resolved
…ts while focus is in them, and unread threads are said to be unknown

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w

Copilot AI 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.

🔵 Needs a closer look

GraphQL errors can clear existing pull-request lists or produce misleading zero counts, while omitted bot reviewers can incorrectly indicate that no reviewer is requested.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Include bot logins when querying requested reviewers

packages/​server/​src/​github.ts:124

requestedReviewer can also be a Bot, such as Copilot, but the query selects fields only for users and teams, so bot reviewers are discarded by the mapping. A pull request waiting only on a bot can therefore display “No reviewer requested” despite a positive totalCount. Include the bot's login in the selection so the existing status rendering can show it.

Medium severity Reject GraphQL errors before replacing pull request data

packages/​server/​src/​github.ts:362

HTTP-200 GraphQL errors are treated as successful results, so a failed refresh can replace existing pull requests with an empty list and reset their age; partial errors can also turn unavailable status fields into zero counts. Reject responses with GraphQL errors or missing search data so the existing 502 handling preserves the displayed lists. Update the rate-limit test in packages/server/tests/service.test.ts:312 to expect rejection.

3 resolved since last review

Review effort: Balanced

… a bot asked to review is named

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w

Copilot AI 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.

🔵 Needs a closer look

GraphQL HTTP 403 errors are swallowed as empty results, allowing a successful response to replace previously displayed pull requests with a misleading empty state instead of retaining them and retrying.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Propagate GraphQL 403s instead of returning empty pull requests

packages/​server/​src/​github.ts:352

An HTTP 403 from GraphQL, including a secondary rate limit, is converted into a successful empty list here. Consequently, pullsSection never sets its failure flag, and /sessions/body can return 200 and replace previously displayed own pull requests with “You have no open pull requests,” rather than retaining them and retrying. Please propagate 403 errors and update the service test that currently expects an empty list for this response.

Review effort: Balanced

Copilot AI 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.

🟢 Approval recommended

The review reports no active issues in the Sessions refresh and pull-request review-status changes.

No open issues 🎉

Review effort: Balanced

@fiddur
fiddur marked this pull request as ready for review November 5, 2026 09:39
@fiddur
fiddur merged commit 2ac1971 into develop Nov 5, 2026
2 checks passed
@fiddur
fiddur deleted the sessions-refresh branch November 5, 2026 09:40
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.

2 participants