SIGN IN SIGN UP

feat(cowshed): build slots give Rust compile caches a stable path

Compiler caches key on absolute paths, so a workspace that mounts
under its own name shares nothing with its successor. Cargo derives
-C metadata and -C extra-filename from a package id carrying the
absolute manifest directory, and sccache additionally hashes the
compiler's physical working directory.  Measured with sccache 0.16 over
a ten-crate workspace, second checkout of identical sources: 22/22 Rust
units hit through one stable absolute path, 9/22 across sibling paths
(the 9 are registry crates, whose ids carry no path). Neither lever
short of the path works: a symlink is inert because cargo resolves
cwd with getcwd, and SCCACHE_BASEDIRS cannot see a hash.

A slot is that stable path. `cowshed new <name> --slot n` records the
binding before anything derives a mount path, so the workspace mounts
at mnt/<owner>/<repo>/slot@n; retirement releases it, and the next
tenant gets byte-identical bytes for its build path. `@` is outside
the WorkspaceName grammar, so a slot mountpoint cannot collide with
a name-derived sibling.  StorageLayout::workspace_mount is the single
derivation every mount, unmount and reverse lookup already goes through,
so the record is read there rather than cached anywhere that could
go stale.

`cowshed path --slot n` answers from the mount paths the listing
already carries — the mountpoint leaf is the slot, so there
is no second index.  Slot tenants get RUSTC_WRAPPER=sccache and
CARGO_INCREMENTAL=0 from both `ensure --envrc` and `cowshed exec`;
name-mounted workspaces get the cache endpoints and nothing that
routes rustc through a cache they cannot share.
C
cowshed committed
fdbf58ccb7214191ad08e78908ca96f0701ef277
Parent: a1417ab
Committed by Danny Wilson <git@danny.prime.vc> on 8/20/2026, 4:34:37 PM