fix: cancel context on error to prevent incomplete cache uploads#283
Merged
joshfriend merged 8 commits intomainfrom Apr 30, 2026
Merged
fix: cancel context on error to prevent incomplete cache uploads#283joshfriend merged 8 commits intomainfrom
joshfriend merged 8 commits intomainfrom
Conversation
9d08b8e to
fdcfc26
Compare
Cancel the create context on archive failure so Close() aborts the upload instead of persisting partial or corrupt data.
636e952 to
e73b78c
Compare
Cancel the create context before closing the writer so partial data is not persisted when io.Copy fails.
Cancel the create context before closing the writer so partial bundle data is not persisted when Write fails.
ca3efdd to
0f6c820
Compare
alecthomas
approved these changes
Apr 30, 2026
Cancel the create context before closing the writer so partial data is not persisted when io.Copy or Seek fails. Remove defer wc.Close() which would complete the upload even on error.
Cancel the create context before closing the writer so partial data is not persisted when Archive fails.
Cancel the create context when the upstream response body errors mid-stream, preventing partial data from being persisted.
Cancel the create context when the upstream response body errors mid-stream, preventing partial data from being persisted.
Cancel the create context and close the writer when io.Copy fails, preventing partial data from being persisted and fixing a writer leak.
0f6c820 to
f2d99ca
Compare
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.
Cancel the create context before closing cache writers on error paths, preventing partial or corrupt data from being persisted. Fixes all 8 call sites across snapshot, client, CLI, git bundle, gomod, HTTP fetch, API v1, and strategy handler.