Avoid re-uploading existing Go cache entries#513
Open
jacobwgillespie wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Named return
wroteshadowed by different-typed local variable- Renamed the local byte count from
writeAtomictobytesWrittenso it no longer shadows the named boolean return value.
- Renamed the local byte count from
Or push these changes by commenting:
@cursor push 6b4e26b361
Preview (6b4e26b361)
diff --git a/pkg/cmd/gocache/gocache.go b/pkg/cmd/gocache/gocache.go
--- a/pkg/cmd/gocache/gocache.go
+++ b/pkg/cmd/gocache/gocache.go
@@ -613,12 +613,12 @@
}
zf.Close()
} else {
- wrote, err := writeAtomic(file, body)
+ bytesWritten, err := writeAtomic(file, body)
if err != nil {
return "", false, fmt.Errorf("unable to write to disk: %w", err)
}
- if wrote != size {
- return "", false, fmt.Errorf("wrote %d bytes, expected %d", wrote, size)
+ if bytesWritten != size {
+ return "", false, fmt.Errorf("wrote %d bytes, expected %d", bytesWritten, size)
}
}You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit dd3a563. Configure here.
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.


Note
Medium Risk
Changes when cache entries are uploaded remotely; incorrect
wrotedetection could skip needed uploads, though behavior is covered by new tests.Overview
Disk cache puts now return whether bytes were actually written. When the object and action index already exist at the expected size, the local put is a no-op and reports no write.
Remote uploads are skipped on those no-op puts (and when
outputIDis empty), so repeatPutcalls for the same entry no longer spawn background HTTP PUTs to Depot. Parent directories are created withMkdirAllbefore writing cache files.Handler metrics for get/put were adjusted so deferred error/hit/miss accounting still runs via an explicit
retErrinstead of named return parameters. Tests cover “second put does not hit remote” and the diskwroteflag.Reviewed by Cursor Bugbot for commit f51083f. Bugbot is set up for automated code reviews on this repo. Configure here.