Repository navigation
Support Cargo 1.100 in the Rust workspace cache - #59
Conversation
ewdurbin
left a comment
There was a problem hiding this comment.
codex assisted review surfaced a few findings.
|
|
||
| # Cargo 1.100 stores each compilation unit, including its outputs, under | ||
| # build/<package>/<hash>. Do not follow symlinks supplied by a cache. | ||
| if not build_root.is_symlink() and build_root.is_dir(): |
There was a problem hiding this comment.
this appears to be pre-existing, but is_symlink() misses NTFS junctions, so this may traverse outside of the expected directory. similar handling needs to be done for the inputs as well.
reproduction test: c4cf367
| if unit.is_symlink() or not unit.is_dir(): | ||
| protected_fingerprints.add(unit.name) | ||
| continue | ||
| record(package_directory.name, unit.name, unit / "fingerprint") |
There was a problem hiding this comment.
on a case-insensitive filesystem, this may misattribute a dependency's unit to the workspace crate and prune it.
reproduction test: 18898b6
| # a dependency with that name, so retain both when the lockfile is ambiguous. | ||
| with (Path(metadata["workspace_root"]) / "Cargo.lock").open("rb") as lockfile: | ||
| locked = tomllib.load(lockfile) | ||
| counts = Counter(package["name"] for package in locked.get("package", ())) |
There was a problem hiding this comment.
should entries from legacy lockfiles with [root] be included here? if not some members may be dropped from being eligible for pruning.
reproduction test: abdcfcf
There was a problem hiding this comment.
I would personally remove this file entirely, IMO the benefit is small 🙂
## Summary Rust 1.100 is now stable. We update the default Rust toolchains to 1.100.0 and raise the MSRV to 1.98.0 under our N−2 support policy. We also upgrade Hawk to 0.1.18, which supports Rust 1.100. We update the trampoline to the first Rust 1.98 nightly and regenerate its six Windows executables. We also resolve new Cargo and Clippy warnings, update macOS test signing for Cargo 1.100’s build layout, and pin the workspace cache to the compatible action from astral-sh/github-actions#59. --------- Co-authored-by: Charlie Marsh <charliemarsh@openai.com>
Summary
Cargo 1.100 moves intermediate artifacts from
target/<profile>/.fingerprint/<package>-<hash>anddepsintotarget/<profile>/build/<package>/<hash>. The workspace cache currently fails during post-job pruning because.fingerprintno longer exists, and its input restoration cannot invalidate build-script outputs in the new layout.We now prune Cargo 1.100 build units and invalidate their complete outputs when tracked inputs change, while retaining support for the older layout. Pruning retains package names shared by workspace members and dependencies, since the artifact path cannot distinguish their versions or sources. Input invalidation conservatively rebuilds same-name units to avoid stale output. We also reject deletion paths outside the configured target or reached through symlinks. The smoke test runs against Rust 1.99 and 1.100 on Linux, macOS, and Windows.