Repository navigation
test: pack the rename-retry fixture with Bun.Archive, not the system tar - #45588
Conversation
…' tar can leave a file out
|
Updated 4:05 PM PT - Oct 16th, 2026
@dylan-conway, your commit 3f2ad82 is building: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe Windows rename-retry test now creates its package archive in memory with ChangesWindows rename-retry test
Suggested reviewers: Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
LGTM, a small test-only swap from the system tar to in-memory Bun.Archive, matching the pattern already used by a dozen sibling files in test/cli/install.
What was reviewed:
Bun.Archiveinput/output types:Record<string, BlobPart>accepts theBufferfromrandomBytes, and.bytes()returnsUint8Array<ArrayBuffer>, whichcreateHash().update,new Response,.lengthand.subarrayall consume view-correctly, so the served body and shasum stay consistent.- Removed
afterAll,pkgDirand thetarshell-out have no remaining references;tempDir,readFileSyncandjoinare still used elsewhere in the file. - Header and inline comments never described the tar step, so nothing is left stale.
Extended reasoning...
The PR changes one Windows-only test file, test/cli/install/bun-install-windows-rename-retry.test.ts, replacing a beforeAll that wrote fixture files to a tempDir and shelled out to tar -czf with a single in-memory new Bun.Archive(files, { compress: "gzip" }).bytes() call, dropping the now-unneeded pkgDir variable, afterAll cleanup and afterAll import. It touches no security-sensitive surface; it is test fixture construction served from a local Bun.serve registry. The change is 3 added / 11 removed lines, follows the exact pattern used in bun-prune, hoist, bun-add, catalogs and other sibling tests, the file is not covered by CODEOWNERS, and the bug hunt ran dry with no findings, which decided approve.
What does this PR do?
Fixes
test/cli/install/bun-install-windows-rename-retry.test.ts, which is red on the Windows 11 aarch64 lane on main and on most branches: the two "reinstalled project-local store entry" tests find 299 files in the package instead of 300, on every retry.The test is at fault, not
bun install. ItsbeforeAllpacked the fixture with the system'star -czf ... .quiet(). On the failing machinestar.exe(bsdtar 3.8.8) printspackage/files/N.txt: Can't add archive to itself, leaves that file out and still exits with 0, so the tarball has 299 files.That check in libarchive is wrong on Windows. It compares a 16-bit hash of the archive's file id (
getinoinarchive_windows.c) with each file's whole NTFS record number (bhfi_inoinarchive_read_disk_windows.c), so an unrelated file can be taken for the archive. The current Windows aarch64 image has two ranges of free records that are 2 * 65536 apart, which makes the two numbers meet. The measurements are in #45579.The fixture is now packed in memory with
Bun.Archive, as other tests intest/cli/installdo. The temp directory and theafterAllthat only servedtarare gone. Bun's own packing never sets that check.How did you verify your code works?
The tests only run on Windows, so CI's Windows lanes are the check. Locally (Linux) the file loads with its 8 tests skipped, and the same
Bun.Archivecall gives a gzip tarball in which both Bun and GNU tar find all 303 entries, 300 of them underpackage/files/.