Skip to content

List what's up for review on a project's page in the cloud - #109

Merged
nedtwigg merged 3 commits into
mainfrom
review-list
Nov 30, 2026
Merged

nedtwigg merged 3 commits into
mainfrom
review-list

Conversation

@nedtwigg

Copy link
Copy Markdown
Member

On app.selfie.dev, a project's home page showed the local checklist ("At commit … / 150 of 150 rendered / Review the newest batch"). That's for someone rendering on their own machine. Now it lists what's up for review:

  • The default branch first, then each open pull request, most recently updated first, up to 30. Each shows its number (linked to GitHub), title and branch.
  • Each row links to its branch's newest finished batch and shows that commit and the same text as its selfie status.
  • It also says:
    • when a pull request's newest commit isn't rendered yet
    • when a branch has no batch
    • when a pull request is from a fork, which Selfie doesn't render yet
    • when GitHub won't list pull requests, in which case only the default branch is shown

How:

  • statusOfBatch in hosted.ts is the status rule moved out of the Worker's publish, so the page and GitHub's status can't disagree. It only runs the base comparison when the status would be yellow, since that's the only time the base changes the text. That also saves work in publish.
  • GET /api/reviews / ReviewSource.reviews() is fetched only by the home page. The left-hand list is re-read on every story page and after every decision, so the review list doesn't ride along with it. It returns null locally.
  • openPullRequests in github.ts has a 5-second timeout. The Worker keeps the list for a minute and a refusal for 15 seconds, and shares one request in flight.
  • The rows reuse the checklist's row (ChecklistRow).

Needs: the GitHub App gets Pull requests: Read-only, and the diffplug installation must accept it. Until then the page shows only main, with a note saying GitHub didn't list pull requests. access.md and OPERATIONS.md are updated to match.

Not done here: each row's status is still worked out on every look, about four D1 calls per row. Saving each status as it's posted would make it one query, but that changes the store's schema. cloud.rationale.md notes it as the next step if the list grows.

Checked:

  • A Worker test covers the list, the fork and default-branch filtering, the refusal window and the one-minute cache.
  • A local route test checks that /api/reviews is null on your own machine.
  • Five new stories (Pages/Every story/In the cloud…). I looked at light and dark.
  • The 16 existing "Every story" images are unchanged.
  • pnpm test passes.

🤖 Generated with Claude Code

@selfie-bot selfie-bot 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.

This PR commits two Playwright session dumps: .playwright-cli/console-2026-11-30T00-32-15-024Z.log and .playwright-cli/page-2026-11-30T00-32-15-672Z.yml. They're scratch output from looking at the live page, and nothing reads them. Please drop them, and consider adding .playwright-cli/ to .gitignore so the next session's dumps stay out too. I can push that commit if you'd like.

cloud.md now says the Worker must "give up on GitHub after 5 seconds", but AbortSignal.timeout(PULL_REQUESTS_TIMEOUT_MS) only covers the /pulls request. Before that request, await tokenFor(repository) runs, and on a cold or expired token (once an hour per repository) it makes two GitHub calls with no timeout: /repos/{owner}/{repo}/installation and /app/installations/{id}/access_tokens. If GitHub is slow during those calls, the home page waits as long as GitHub does, and so does everyone sharing the in-flight promise. To fix it, create the signal once at the top of openPullRequests and pass it through tokenFor into its two ask calls. That's outside this diff's lines, so I haven't made it an inline suggestion. Or change the spec sentence to say only the list request is bounded.

@nedtwigg

Copy link
Copy Markdown
Member Author

Thanks, both fixed in 7a1ecb9:

  • Playwright dumps: removed. .playwright-cli/ is now in .gitignore. They were from my browser session looking at the live page.
  • The timeout: openPullRequests makes one AbortSignal.timeout and passes it through tokenFor into both token requests. So a cold token, the list and everything waiting on the shared request stay within the 5 seconds cloud.md promises.

nedtwigg and others added 2 commits November 29, 2026 16:45
In place of the local checklist, a project's page on app.selfie.dev lists its default branch, then
each open pull request with its number, title, and branch, each with its branch's newest batch and
what that commit's status says. The statuses come from the rule publish uses, now statusOfBatch in
hosted.ts, which asks for a branch's base only when the status would be yellow. Pull requests come
from GitHub through a new GET /api/reviews that only that page asks for, kept a minute, a refusal
15 seconds, one request shared, and given up on after 5 seconds. The GitHub App needs pull
requests: read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…playwright-cli/

A cold token asks GitHub twice before the list itself, so the 5 seconds cloud.md promises now covers
all three. .playwright-cli/ is a browser session's scratch output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In the cloud, a batch's context has the open pull request from its branch, from the cached list, and
"Every image has a decision" links there, as does the batch page's "Nothing in its images", since
that's where it's merged or talked about. With no pull request, or on someone's own machine, it's
back to the list as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nedtwigg
nedtwigg merged commit 2ec0a08 into main Nov 30, 2026
5 checks passed
@nedtwigg
nedtwigg deleted the review-list branch November 30, 2026 01:06
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