Repository navigation
Speed up Files pages: skip the private count on load, one storage call per tile - #1395
Conversation
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
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 2
🚫 Excluded labels (none allowed): 1
Please check the settings in the CodeRabbit UI or the
|
|
No uploads on this PR yet This PR changes UI files (
Tips for agentsLabel each shot so reviewers know what they're seeing. Labels apply to every file in a call, so run one 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 afterNo CLI? With the Uploads MCP, call 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 Workspace admins can turn this comment off in Settings → GitHub · docs |
|
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
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 theGET /scope/:owner/:repo/filescall (2.3–3.3 s). On a first page of a large repo it computesprivateCount, 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
existsprobe, then a HEAD) on PR and repo pages, live links and galleries.What changed
Commit 1: private count off the page load
/scope/:owner/:repo/files:privateCount=0skips the scan and the probes, and returnsprivateCount: null. If the param is left out, the endpoint behaves as before./pulls:thumbnails=0skips the thumbnail query for each PR (the same param/reposalready has).privateCount=0.loadShareInfostill 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.limit=11&thumbnails=0instead of 20 rows with thumbnails.Commit 2: one storage call per tile
hydrateFeedItems,countPrivateScopeItemsandhydrateGalleryItemsnow use the existingLaneResolver.resolveWithHead: one HEAD per lane tried, with NotFound counted as a miss. Previously each tile didexistsand thenhead.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
privateCount=0returns null and sends only the page's own HEADs to storage./pulls?thumbnails=0returns the same rows with empty thumbnails. Hydrating 5 objects now makes 5 storage calls instead of 10. That assertion fails on the old code.privateCount=0and share info doesn't. The recent PR list sendslimit=11&thumbnails=0.pnpm test(all passing),pnpm typecheck,pnpm check.🤖 Generated with Claude Code
https://claude.ai/code/session_01KeLbkis33mPMcBF5kRguaM