Skip to content

Write vendored compact_index files atomically#9581

Merged
hsbt merged 1 commit into
masterfrom
atomic-write-vendored-compact-index
Jun 1, 2026
Merged

Write vendored compact_index files atomically#9581
hsbt merged 1 commit into
masterfrom
atomic-write-vendored-compact-index

Conversation

@hsbt
Copy link
Copy Markdown
Member

@hsbt hsbt commented Jun 1, 2026

What was the end-user or developer problem that led to this PR?

The completeness check skips the download once every expected file exists, but File.write truncates before writing, so an install interrupted partway leaves a half-written file in place.

What is your fix for the problem, implemented in this PR?

Download each file to a sibling .tmp path and rename it into place. The rename stays within the vendor tree, so it is atomic and a target file is only ever observed fully written.

Make sure the following tasks are checked

The completeness check skips the download once every expected file exists,
but File.write truncates before writing, so an install interrupted partway
leaves a half-written file in place. A later run would see it, treat the
vendor tree as complete, and load a truncated source.

Download each file to a sibling .tmp path and rename it into place. The
rename stays within the vendor tree, so it is atomic and a target file is
only ever observed fully written.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 1, 2026 12:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the Bundler spec suite’s vendored compact_index bootstrap by ensuring each downloaded file is written atomically, preventing partially-written files from being mistaken as “complete” after an interrupted run.

Changes:

  • Write each vendored compact_index file to a sibling .tmp path first.
  • Rename the .tmp file into place to ensure the final file is only observed fully written.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hsbt hsbt merged commit 86b63d5 into master Jun 1, 2026
109 checks passed
@hsbt hsbt deleted the atomic-write-vendored-compact-index branch June 1, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants