fix(serve): fetch unreachable revisions by SHA so PR-head commits res…#414
Merged
tinder-maxwellelliott merged 1 commit intoJul 7, 2026
Merged
Conversation
…olve The #411 on-demand refetch runs `git fetch --all --prune`, which only downloads objects reachable from the refs the clone's refspec covers (branches/tags). A commit named by full SHA that is reachable from no fetched ref -- a GitHub PR-head under refs/pull/<n>/head, or a commit force-pushed off its branch -- never arrives, so resolveSha keeps failing and the request 400s with "revision '<sha>' is missing from the local clone". Escalate recovery in ImpactedTargetsService.resolveBoth: after the broad fetch, attempt a targeted by-SHA `git fetch <remote> <sha>` (new GitClient.fetchRevision) for each revision still missing. This works against servers that permit reachable-SHA fetches (uploadpack.allowReachableSHA1InWant, GitHub's default). JGitClient routes it through native git, since JGit 5.13 cannot reliably fetch by SHA. A revision still missing after both steps is genuinely unknown and still 400s. Coverage: real-git PR-head tests in GitClientTest/JGitClientTest, a DirectFetchGitClient unit case in ImpactedTargetsServiceTest, and a C5 (refs/pull/*) scenario in tools/serve_harness.py that fails without the fix (negative-control verified) across both git engines. Co-Authored-By: Claude Opus 4.8 <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.
…olve
The #411 on-demand refetch runs
git fetch --all --prune, which only downloads objects reachable from the refs the clone's refspec covers (branches/tags). A commit named by full SHA that is reachable from no fetched ref -- a GitHub PR-head under refs/pull//head, or a commit force-pushed off its branch -- never arrives, so resolveSha keeps failing and the request 400s with "revision '' is missing from the local clone".Escalate recovery in ImpactedTargetsService.resolveBoth: after the broad fetch, attempt a targeted by-SHA
git fetch <remote> <sha>(new GitClient.fetchRevision) for each revision still missing. This works against servers that permit reachable-SHA fetches(uploadpack.allowReachableSHA1InWant, GitHub's default). JGitClient routes it through native git, since JGit 5.13 cannot reliably fetch by SHA. A revision still missing after both steps is genuinely unknown and still 400s.
Coverage: real-git PR-head tests in GitClientTest/JGitClientTest, a DirectFetchGitClient unit case in ImpactedTargetsServiceTest, and a C5 (refs/pull/*) scenario in tools/serve_harness.py that fails without the fix (negative-control verified) across both git engines.