Skip to content

fix(serve): fetch unreachable revisions by SHA so PR-head commits res…#414

Merged
tinder-maxwellelliott merged 1 commit into
masterfrom
claude/bazel-diff-missing-revision-72b9e4
Jul 7, 2026
Merged

fix(serve): fetch unreachable revisions by SHA so PR-head commits res…#414
tinder-maxwellelliott merged 1 commit into
masterfrom
claude/bazel-diff-missing-revision-72b9e4

Conversation

@tinder-maxwellelliott

Copy link
Copy Markdown
Collaborator

…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.

…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>
@tinder-maxwellelliott tinder-maxwellelliott merged commit 602102f into master Jul 7, 2026
15 checks passed
@tinder-maxwellelliott tinder-maxwellelliott deleted the claude/bazel-diff-missing-revision-72b9e4 branch July 7, 2026 21:35
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.

1 participant