Repository navigation
Key the cache by the configured upstream spelling, not the request's [minor] - #97
Merged
Merged
Conversation
…[minor] Upstream keys resolve regardless of case, but the request's own spelling was then used as the identity for store paths, fetch coalescing, transfer tokens, lock snapshots and metrics. On a case-sensitive filesystem a client addressing /GitHub/ and another addressing /github/ each filled their own cold cache and fetched the same object from upstream twice. IUpstreamRegistry gains a TryResolve overload that reports the key as configured (a default implementation keeps existing implementers working), and the handler replaces the route's upstream with it right after resolution, so everything downstream shares one identity. Fixes #49 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hnw6WDDjwQ8HvxinnWS9CF
|
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.



Fixes #49
Before:
UpstreamRegistryandRepositoryAllowListmatched the upstream key regardless of case. After that, though,route.Upstreamwas used exactly as the request spelled it. It was the identity for store paths,FetchCoalescerkeys, transfer-token binding, lock snapshot and admission keys, and metric labels. A client using/GitHub/…and another using/github/…therefore each filled their own cold cache on Linux. The same object was fetched from upstream twice and stored twice, and the lock snapshots and metrics were split.After:
GitLfsCacheHandlerreplacesroute.Upstreamwith the key as it is configured, right after resolution. Every handler downstream receives the one spelling, so the two clients share one store directory, one coalescer entry, one lock snapshot and one set of metric labels. Rewritten batch hrefs also use the configured spelling. This is the same approach as GitBranchStateCache f22a1b0.How:
IUpstreamRegistrygainsTryResolve(string key, out string canonicalKey, out Uri? baseUrl). It has a default implementation that returns the key unchanged, so existing implementers still compile and behave as before.UpstreamRegistryoverrides it to report the configured key, and the existing two-argumentTryResolvenow delegates to it. The new public overload is why this is tagged[minor].Tests:
ProxyFlowTests.Download_UpstreamKeyCasingDiffers_SharesOneCacheUnderTheConfiguredKeyruns a batch and a download through/GitHub/…, then the same object through/github/…. It asserts one upstream fetch, an href under/github/, and the object stored undergithub. With the handler change reverted it fails: two upstream fetches.UpstreamRegistryTestsgains checks that the configured key is reported for a key in different casing, and that an unknown key comes back unchanged.Related: #50, lock-snapshot eviction, now sees one key per upstream rather than one per spelling.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Hnw6WDDjwQ8HvxinnWS9CF
Generated by Claude Code