Skip to content

Mitts 0.3.0

Choose a tag to compare

@alex09x alex09x released this 20 Oct 04:32
· 486 commits to main since this release

Mitts 0.3.0 gives every store one cache root and makes the test suite prove its own isolation. The public API changes shape (new cache_dir parameters, a new RustBuildOptions field), hence the minor bump.

One cache root for every store (d260ef2)

  • A single resolver (core::cache_root) picks the root for the artifact store, action cache, locks, jobserver, unpacked sources and the sparse-index cache: --cache-dir / RustBuildOptions::cache_dir, then $MITTS_CACHE_DIR, $XDG_CACHE_HOME/mitts, ~/.cache/mitts. An empty variable counts as unset. The source store and the index cache now honour XDG_CACHE_HOME like the other stores.
  • An explicit cache_dir reaches every consumer that used to fall back to the default location: NativeResolver::for_cache_dir, SparseIndexClient::for_cache_dir, CargoLock::resolve_or_sync(.., cache_dir), RustAdapter::resolve_lockfile(.., cache_dir), RustAdapter::fetch(.., cache_dir), the rustc invocation (RustcInvocation::cache_root replaces the MITTS_CACHE_DIR / out_dir heuristic), mitts explain --cache-dir, build-script purity prefixes and mitts gc, which prunes only the sources of its own root.
  • is_immutable_package_dir recognises a source-store entry by its <root>/sources/<name>-<version> layout and .mitts-ok marker, so dependencies fetched into a custom cache keep their immutable treatment (no package-tree hashing, --cap-lints allow).
  • RustBuildOptions::fast_lock: Option<bool> keeps the fast build lock active with an explicit cache_dir when set to Some(true); the default behaviour is unchanged.

Test isolation (63f8bac)

  • Every test that builds uses its own cache root; tests that fake HOME also clear and restore XDG_CACHE_HOME. Run on its own with a throwaway HOME, no test target reaches ~/.cache/mitts any more (169 targets probed, 0 writers).
  • tests/cache_root_isolation_test.rs runs the binary with a throwaway HOME and checks that --cache-dir, MITTS_CACHE_DIR and XDG_CACHE_HOME relocate all stores together.
  • scripts/run_tests_isolated.sh runs the suite in a clean room and fails if the real ~/.cache/mitts changed; scripts/probe_store_isolation.sh finds any target that still uses the default store.

Verified on Linux: 670 tests passed, 0 failed, clippy clean, line coverage 87.2 %.

Full history: v0.2.1...v0.3.0