Repository navigation
Tags
Tags
Skip remote content upload when the remote cache is read-only (#178) * Skip remote content upload when the remote cache is read-only CasCacheClient holds two sessions: the raw _remoteCacheSession and the _twoLevelCacheSession built from TwoLevelCacheConfiguration. When adding a node, content was uploaded directly through _remoteCacheSession without consulting RemoteCacheIsReadOnly, while the content hash list that would reference that content is published through _twoLevelCacheSession, which does honor it. The result is that a read-only client uploads content that can never be retrieved: no content hash list ever points at it, so no subsequent build can hit on it. The upload only costs egress, storage and build time, and leaves unreferenced blobs behind for lifecycle policies to collect. Guard the upload block on the read-only flag, which also elides the remote pin calls that were only made to decide what to upload. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Add regression tests for read-only remote content upload Adds RecordingCacheSession / RecordingCache, minimal ICacheSession and ICache implementations that count the calls made against them, and two tests driving CasCacheClient.AddNodeInternalAsync: - AddNodeDoesNotUploadContentWhenRemoteCacheIsReadOnly asserts the remote session sees no PinAsync, PutStreamAsync or PutFileAsync calls, while the node metadata and content hash list are still written to the local cache. - AddNodeUploadsContentWhenRemoteCacheIsWritable asserts the remote session is still pinned and uploaded to when the remote cache is writable, so the guard is conditional rather than unconditional. The first test fails without the accompanying fix: Expected:<0>. Actual:<1>. 'actual' expression: 'remoteSession.PinCallCount'. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * use HashInfoLookup --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
PreviousNext