Clean up truncated and partial files on failed CAS downloads (#674) When streaming a blob to a file in readBlobToFileUnder or ReadBlobToFile, the target file is opened with os.O_WRONLY|os.O_CREATE|os.O_TRUNC before streaming begins. Similarly, in downloadNonUnified, batch output files were written before checking whether BatchDownloadBlobsWithStats returned an error, and single-file downloads used the parent ctx instead of the errgroup's eCtx. If a download fails (for example, after exhausting retries with codes.Unavailable during a CAS outage or receiving a partial stream that fails digest verification), an empty (0-length) or partially written file was left behind on disk, corrupting incremental builds (b/553667080). This change fixes truncated/partial file handling in CAS downloads: 1. Explicitly close the destination file (checking closeErr) and remove the target file on error in ReadBlobToFile and readBlobToFileUnder so 0-byte or partial files are never left on disk. 2. Check BatchDownloadBlobsWithStats errors immediately before writing files in downloadNonUnified, verify digest presence in bchMap before dereferencing batch results, and pass eCtx to readBlobToFileUnder so in-flight streams abort and clean up promptly on sibling errors. UnifiedDownloads=true error handling and DownloadFiles sibling cancellation are tracked separately in #676.
This repository contains SDKs for the Remote Execution API.
See each language subdirectory's README.md for more specific instructions on using the SDK for that language.