Repository navigation
Conversation
This branch has not been deployed
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.
Description
An interrupted download currently truncates an existing destination and then deletes it. This affects
doc download --clobberand both SDK download methods. Copy the response to a temporary file in the destination directory, close it successfully, and replace the destination only afterward. Failed transfers clean up the temporary file while preserving the previous download.Existing permissions and destination symlinks are preserved, including relative symlinks whose target does not exist yet. New files have mode 0600 instead of the previous 0666 subject to umask. Rename atomicity is platform dependent; Windows runtime testing remains pending CI.
Type of Change
Related Issue
No linked issue. Reproduced using the real SDK and local HTTP test servers.
Testing
Go 1.26.8 on macOS arm64. Baseline CLI regression fails once; SDK single and batch regressions fail twice (plus their parent test). Final CLI
go test -race -count=1 -coverprofile=../download-cli-coverage.out -json ./...: 1191 tests/subtests pass, 21.224s. Client equivalent: 43 pass, 3.871s. Both modules passgo vet ./...andgolangci-lint run --new-from-rev=origin/main ./...using official v2.12.2. CLIgo build ./..., skill-wire vocabulary and secret-token checks pass. All final commands exit 0.Tests cover interruption, successful single/batch replacement, permission preservation, symlink destinations, dangling symlinks, rename failures, and temporary cleanup. Symlink tests explicitly skip where symlink creation is unavailable. Windows/Linux runtime and unrelated backend/frontend checks were not run. An initial coverage run included an unrelated pending regression test from another branch; it was isolated before the final full rerun.
Checklist
git diff --check origin/main...HEADpassesImplemented with assistance from gpt-6.1-sol; the final diff was reviewed locally.