Repository navigation
Conversation
shoemoney
marked this pull request as ready for review
November 28, 2026 04:38
maybePutObject added to put_s3_found when it had just written the object, so put_s3_object and put_s3_found were swapped. Count a hit only when the object was already present and matching. Fixes tailscale#25 Signed-off-by: Jeremy Schoemaker <jeremy@shoemoney.com>
shoemoney
force-pushed
the
fix/s3-put-metrics
branch
from
November 28, 2026 18:41
db4d6e2 to
8ff6d52
Compare
Member
|
Thank you @shoemoney, the fix looks good to me. However, we do not need such an elaborate test for this, the metrics are not part of the primary API for this package, so let's just drop that part. Thanks also for the reminder about updating the dependencies, I will take care of that separately. |
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.
PutCondreturns true after an upload, butmaybePutObjectcounts it as a cache hit. Reverse the check so uploads incrementput_s3_objectand objects already in S3 incrementput_s3_found.Fixes #25. Related: #26, which was closed without merging. This patch is based on current
main.The regression test calls
S3Cache.Putwith a local cache and an in-memory S3 transport. It checks an upload, a remote hit after local eviction, both action writes, and the reported metrics. Both metric cases fail before the fix and pass afterward.Passed with Go 1.26.6:
GOTOOLCHAIN=go1.26.6 go test -vet=all -race -cpu=1,2 ./...GOTOOLCHAIN=go1.26.6 go run honnef.co/go/tools/cmd/staticcheck@latest ./...gofmt -l -sandgit diff --checkare clean. The focused test also passes with the race detector on Go 1.27.4; the full suite passes withGOEXPERIMENT=nojsonv2.With default Go 1.27.4 settings, the full suite and staticcheck fail to build the pinned
github.com/go-json-experiment/json, which still refers tojson.SkipFuncandjson.DiscardUnknownMembers. The same build failure occurs on unmodified upstreammainand affects the current stable Go CI setup. No dependency changes are included here.