Repository navigation
feat(github-list): conditional requests for the repository list's refresh (#404) - #418
Merged
Merged
Conversation
…resh Keep each held page's ETag and ask for every page after the first with If-None-Match on a quiet refresh: a 304 keeps the page and costs nothing against the rate limit. Page 1 stays unconditional, since a 304 carries no Link header and the page count may have changed. Each page is validated on its own, so pages shifted by an added or removed repository answer 200 and the list stays exact. A token change drops the ETags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #404
What
A quiet refresh of the GitHub repository list (each time a Link picker opens) no longer re-downloads every page. The daemon keeps each held page's
ETagbeside it and asks for every page after the first withIf-None-Match; GitHub's304 Not Modifiedkeeps the page and doesn't count against the REST rate limit. An unchanged list of ~1,100 repositories now costs 1 counted request a refresh instead of 12.Page-shift rule
304carries noLinkheader (checked against the live API), and the page count can change, e.g. a repository added after a full last page, which leaves that page unchanged. Page 1'srel="last"stays the source of truth for how many pages there are.304means that page reads as held, so no "reload the remaining pages" rule is needed: a repository added or removed shifts every page after it, those pages' contents and ETags change, and they answer200on their own. A page the held list didn't have is read withoutIf-None-Match; pages past the new last one are dropped.changed github_repositoriesonly if the list reads differently, so an all-304refresh sends no event.Changes
prsync/github.rs:user_repos_pagetakes an optional ETag, sendsIf-None-Match, returnsReposRead::{Page, NotModified};ReposPagecarries itsETag.github_list.rs: the held list is kept by page (HeldPage { etag, repositories });read_pagessends each kept page's ETag and reuses it on304.docs/spec.md§8: the repository list's Memory, a new Conditional requests bullet and Sign-in; §12's integration list. No route, field or message changed, soAPI_VERSIONis unchanged.304whenIf-None-Matchmatches the page's current ETag,200with the ETag otherwise):If-None-Matchper page but page 1, an all-304 refresh keeping the list with no event, a changed page read whole while others 304, a repo added at the front (every page shifts, a new last page), one added after a full last page that 304s, one removed (shift, last page dropped), and a token change sending none of the old ETags.cargo xtask cipasses locally.🤖 Generated with Claude Code