---
name: sccache-target-path-in-key
description: "sccache reuse survives a source-tree change but not a target-path change, so per-worktree targets are a structural 0%; the paying shape is one pool path reused sequentially."
metadata: 
  node_type: memory
  type: project
  originSessionId: bfe75fb9-b545-4df4-90d8-cde9a051e778
  modified: 2026-08-02T12:44:17.328Z
---

Measured on HFENDULEAM 2026-08-02 (sccache 0.17.0, releases#103 leg 3, spt-core @0611301):

- Same target path, same tree, warm cache → **60/62 hits**.
- **Other target path** (same tree) → **0/62** — registry deps included. Neither
  `SCCACHE_BASEDIRS` (the real env var; `SCCACHE_BASE_DIR` does not exist and registers as
  `Base directories (none)`) nor `RUSTFLAGS=--remap-path-prefix` moves it.
- Same target path, **different source tree** → **55/62 hits**; the 7 misses are exactly the 5
  workspace crates (their own source paths are in the key) plus a 2-unit residual
  (`curve25519_dalek`, `serde`) that misses even when *nothing* changed.

**Consequence:** per-worktree targets are distinct paths by construction ⇒ 0% cross-worktree
reuse. The one profitable configuration is ONE target path reused by many trees in sequence —
i.e. the leased pool releases#103 already built. The lease is not what sccache lets us retire;
it is what makes sccache's only paying shape safe.

Ceilings that bound any future sccache decision: at workspace scope only **379 of 691** rustc
invocations are cacheable — 290 refused for crate-type (upstream doc: bin/dylib/cdylib/proc-macro
"invoke the system linker"), so ~55% of invocations, zero link time, minus the residual.

Related: [[shared-target-two-live-trees]], [[instrument-soundness-guards]].
