Skip to content

Speed up Files pages: skip the private count on load, one storage call per tile - #1395

Merged
Zach Dunn (zachdunn) merged 2 commits into
mainfrom
claude/project-thread-qa9hjs
Nov 6, 2026
Merged

Zach Dunn (zachdunn) merged 2 commits into
mainfrom
claude/project-thread-qa9hjs

Conversation

@zachdunn

@zachdunn Zach Dunn (zachdunn) commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Requested by Zach · project thread

Why

Repo pages (e.g. /account/workspaces/default/files/databallr/databallr) took 2.3–3.4 s in Workers Observability today, while PR pages took 0.3–0.5 s. Nearly all of that time came from the GET /scope/:owner/:repo/files call (2.3–3.3 s). On a first page of a large repo it computes privateCount, which needs a key scan plus up to 300 storage probes (about 2 R2 ops each, 8 at a time). Only the Copy live link confirm uses that count.

A follow-up audit also found that every file tile cost two R2 calls (an exists probe, then a HEAD) on PR and repo pages, live links and galleries.

What changed

Commit 1: private count off the page load

  • API /scope/:owner/:repo/files: privateCount=0 skips the scan and the probes, and returns privateCount: null. If the param is left out, the endpoint behaves as before.
  • API /pulls: thumbnails=0 skips the thumbnail query for each PR (the same param /repos already has).
  • Web: page loads (repo page, PR page, filter changes) send privateCount=0. loadShareInfo still asks for the count, so Copy live link on the scope page now reads it when clicked. The PR and repo row menus already work this way, clipboard handling included. "Open live link" still comes from the page load.
  • Web repo page PR list: it shows only titles for 10 PRs, so it now requests limit=11&thumbnails=0 instead of 20 rows with thumbnails.

Commit 2: one storage call per tile

  • hydrateFeedItems, countPrivateScopeItems and hydrateGalleryItems now use the existing LaneResolver.resolveWithHead: one HEAD per lane tried, with NotFound counted as a miss. Previously each tile did exists and then head.
  • The held-key and visibility D1 reads that run before hydration now go in parallel.

This adds no D1 queries, writes or indexes. It only removes reads.

Deploy order: either order is safe. The old API ignores the new params, and the old web never sends them.

Testing

  • New API tests: privateCount=0 returns null and sends only the page's own HEADs to storage. /pulls?thumbnails=0 returns the same rows with empty thumbnails. Hydrating 5 objects now makes 5 storage calls instead of 10. That assertion fails on the old code.
  • New web tests: page loads send privateCount=0 and share info doesn't. The recent PR list sends limit=11&thumbnails=0.
  • pnpm test (all passing), pnpm typecheck, pnpm check.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KeLbkis33mPMcBF5kRguaM

The repo page's scope call counted private items on every load: a key
scan plus up to 300 storage probes, about 2-3 s on a large repo. Only
the Copy live link confirm reads that count, so page loads now pass
privateCount=0 and Copy asks for it on click (the path the PR and repo
row menus already use).

The repo page's PR list showed titles only but fetched 20 rows with
thumbnails. It now asks for 11 rows (10 shown, one to know whether to
link to the rest) with thumbnails=0.

No new D1 queries, writes or indexes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeLbkis33mPMcBF5kRguaM
@zachdunn Zach Dunn (zachdunn) self-assigned this Nov 6, 2026
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 2

  • coderabbit:review
  • review
🚫 Excluded labels (none allowed): 1

  • wip

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fdc6e41f-2256-4f73-a880-4495ae343e99

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@uploads-sh

uploads-sh Bot commented Nov 6, 2026

Copy link
Copy Markdown

No uploads on this PR yet

This PR changes UI files (apps/web/src/components/files/ScopePage.tsx and apps/web/src/pages/account/workspaces/[name]/files/[owner]/[repo]/index.astro). Screenshots help reviewers see what changed.

  • From the CLI: uploads put before.png after.png --pr 1395
  • From an agent: ask it to attach screenshots with uploads.sh
  • By hand: drag images into the PR description and they're imported automatically
Tips for agents

Label each shot so reviewers know what they're seeing. Labels apply to every file in a call, so run one put per shot:

uploads put after.png --pr 1395 --meta path=/settings --state after --caption "Saved settings toast"
uploads put chat.png --pr 1395 --app ios --screen "Chat" --state after

No CLI? With the Uploads MCP, call sign_upload_url for files on disk (or put) with repo, pr: 1395 and the same screen, state and caption fields.

This comment updates with each upload, so you don't need to post the images yourself. A shot or two in the PR description is still welcome. Check what's attached with uploads list --pr 1395. More in the github-screenshots skill or the agent docs.

Workspace admins can turn this comment off in Settings → GitHub · docs

@changeset-bot

changeset-bot Bot commented Nov 6, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: fed5e45

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

hydrateFeedItems (PR and repo pages, live links), countPrivateScopeItems
and hydrateGalleryItems resolved each item's lane with an exists probe
and then HEADed it: two R2 calls per tile. LaneResolver.resolveWithHead
already does both with one HEAD per lane tried, treating NotFound as a
miss. The held-key and visibility D1 reads before hydration now run in
parallel instead of one after the other.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeLbkis33mPMcBF5kRguaM
@zachdunn Zach Dunn (zachdunn) changed the title Files repo page: skip the private count and PR thumbnails on page load Speed up Files pages: skip the private count on load, one storage call per tile Nov 6, 2026
@zachdunn
Zach Dunn (zachdunn) merged commit 766d7de into main Nov 6, 2026
4 checks passed
@zachdunn
Zach Dunn (zachdunn) deleted the claude/project-thread-qa9hjs branch November 6, 2026 17:24
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