fix(git): freshen mirror and report up-to-date on bundle fallback#396
Merged
Conversation
worstell
force-pushed
the
worstell/git-bundle-fallback-freshen
branch
3 times, most recently
from
July 22, 2026 22:03
f8ec354 to
85c157f
Compare
worstell
marked this pull request as ready for review
July 22, 2026 22:56
Mirrors are per-pod but the cache is shared, so the pod serving a bundle request can lag the pod that advertised the bundle URL: the base commit may be missing locally, or local HEAD may still equal base. Both cases previously failed the request, forcing clients into a full freshen even when nothing changed upstream. On a bundle cache miss the handler now fetches the mirror (bounded by the ref-check interval) and re-evaluates: a base at upstream HEAD returns 204 so clients can skip freshening entirely (surfaced as client.ErrUpToDate), and a base that arrives with the fetch is served as a normal generated bundle. Bundle bases are also validated as full commit SHAs, and the serve metric distinguishes up_to_date and miss_bad_base outcomes. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019f8b6a-3778-7200-a3b4-c24b84edd973
worstell
force-pushed
the
worstell/git-bundle-fallback-freshen
branch
from
July 22, 2026 23:08
85c157f to
1a2959b
Compare
alecthomas
approved these changes
Jul 22, 2026
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.
Mirrors are per-pod but the cache is shared, so the pod serving a delta-bundle request can lag the pod that advertised the bundle URL. When that happens the base commit is missing from the local mirror (bundle creation fails with
bad object) or local HEAD still equals the base (empty bundle). Both cases returned an error, forcing clients into a full freshen even when nothing changed upstream.On a bundle cache miss the handler now fetches the mirror (rate-limited by the ref-check interval) and re-evaluates:
client.ErrUpToDate, so no freshen is needed at allmiss_bad_basemetric sourceBundle bases are also validated as full commit SHAs before hitting the repo.
Existing clients treat the 204/
ErrUpToDatepath the same as any other bundle failure (full freshen), so this is backward compatible; callers can opt intoerrors.Is(err, client.ErrUpToDate)to skip the fallback freshen entirely.