Repository navigation
feat(sync): add sync.backfill to fetch closed items with no local file - #72
Open
vkislichenko wants to merge 1 commit into
Open
vkislichenko wants to merge 1 commit into
vkislichenko wants to merge 1 commit into
Conversation
With `closed: true`, a closed issue or PR is only kept if it was already mirrored while it was open. Anything that opened and closed between two syncs has no local file, so it gets dropped instead of fetched, and a `--full` sync doesn't bring it back. On my mirrors that was most of the closed PRs, mostly short-lived ones that merged before the next poll. This adds an opt-in `sync.backfill`. When it's on, those items are fetched like any other. It's off by default because backfilling a long history costs roughly 7 requests per closed PR. The drop check existed twice (prepareIssueCandidateSync and handleClosedIssueByPolicy), so it now lives in one helper, shouldDropUntrackedClosedItem, used by both. Co-Authored-By: Claude Opus 5.5 (1M context) <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.
I use ghfs to mirror a few repos and noticed a lot of closed PRs were just missing, even with
closed: true.Turns out
closed: trueonly keeps closed items that were already mirrored while they were open. If something opens and closes between two syncs (pretty common for small PRs that get merged in a few minutes), it never gets a local file, so it's dropped instead of fetched. Running--fulldoesn't bring it back either.Looks like this came from 81ebd50, where
closedwent from'existing' | 'all' | falseto a boolean. The JSDoc saystruesyncs all closed items, but the check was switched from=== 'existing'to=== true, so it kept the old "existing" behavior.I went with a separate opt-in
sync.backfillrather than changing whatclosed: truedoes, because turning it on fetches the whole closed history on the next full sync (around 7 requests per closed PR), which could be a surprise on bigger repos. Happy to change it soclosed: truejust does this if you'd prefer.The drop check was duplicated in
prepareIssueCandidateSyncandhandleClosedIssueByPolicy, so I moved it into one helper used by both.Tested on a repo with 5 closed PRs that were never mirrored: before, 0 of them came through; with
backfill: true, all 5 plus their patches. A follow-up incremental sync made 2 requests and changed nothing.