Repository navigation
test(locallibrary): format and eject disk images in the weekly run - #322
Open
botandbang wants to merge 5 commits into
Open
botandbang wants to merge 5 commits into
botandbang wants to merge 5 commits into
Conversation
bnb
previously approved these changes
Oct 30, 2026
# Conflicts: # apps/locallibrary/TODO.md
botandbang
enabled auto-merge
October 31, 2026 13:37
bnb
previously approved these changes
Oct 31, 2026
Rust coverageFrom run 656. Both are held to the thresholds in .cargo/config.toml.
|
bnb
approved these changes
Oct 31, 2026
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.
What and why
The scheduled workflow gets a
disk-imagesjob on macOS, Linux and Windows. Each test creates a small disk image, attaches it, runsformat::applyor eject against it, and detaches it. The images are hdiutil images on macOS, loop devices on Linux (run as root through sudo as nextest's target runner) and VHDs on Windows. The tests return at once unlessLOCALLIBRARY_DISK_IMAGE_TESTS=1, so ordinarycargo testand PR CI never touch a device.Added:
format/disk_image.rs, a test-only guard that attaches an image and detaches it on drop (also when a test panics). It finds the device by the image's file, so it can't detach anything else, and it checks before every destructive call that the disk is the one it attached. The format test checks that an image is refused, then formats FAT32 on MBR and exFAT, checks a stale plan is refused, and checks that a drive keeps its name across a format where the system mounts the volume. The macOS eject test uses a two-partition image: eject is refused while the store is on the other partition, the plan names the other volume, and applying it detaches the image. There are also unit tests for the seam.Changed: the format code refuses every disk image, loop device and virtual disk. A test build lets through only the one image its test attached, matched by exact identifier on that thread. On Linux this is also the only loop device parsed as a disk.
Removed:
LOCALLIBRARY_FORMAT_VIRTUAL, which letformattake any disk image and which nothing used.The Linux and Windows legs, and the macOS format and eject tests, have not run yet. The first weekly or manual run of locallibrary scheduled is their first test.
Refs LOC-67 (the Linux and Windows legs and the macOS format and eject tests are unverified until the scheduled job runs)
Refs #168
How it was tested
cargo fmt --check -p locallibrary, andcargo clippy -p locallibrary --all-targets -- -D warningson macOS (so the Linux and Windows modules of disk_image.rs were not compiled).cargo nextest run -p locallibraryon the format and eject tests: 152 pass.LOCALLIBRARY_DISK_IMAGE_TESTS=1,an_image_is_detached_when_its_test_endspasses with a real hdiutil attach and detach. Skipping detach while panicking made it fail with "still attached".virtual_disk &&guard dropped, the Linux loop check forced true).actionlintandzizmor --offlineon the scheduled workflow, andtools/policy.sh.Checklist
apps/locallibrary/CHANGELOG.mdhas a line under Unreleased, if people using it will noticedocs/and--helpstill say what the code does