Skip to content

Commit eb4e6de

Browse files
zackeesclaude
andauthored
feat(library-selection): #205 Phase 4 zccache K/V memoization (#212)
Adds the cache module that wraps `crate::resolve` in a blake3-keyed `zccache_artifact::KvStore` lookup, completing Phase 4 of #205. The resolver is a pure function of (project sources, search paths, library set, toolchain triple, framework version, scanner/LDF semantics); cold cost is tens of ms, restore from a hit is sub-ms. Cache key composition follows Q9 from the issue: - sorted (canonical_path, blake3(content)) pairs for seeds, - sorted (lib_name, blake3(canonical header)) pairs for libraries, - ordered search-path list (order is observable per PIO semantics), - toolchain triple, framework install path + version, - SCANNER_VERSION + LDF_MODE_VERSION constants for invalidation. Corrupt entries fall through to recompute and overwrite rather than propagating decode errors — a stale cache must never poison a build. Tests (16/16 passing): - 9 resolver tests for the 2-pass LDF + path-prefix attribution - 7 cache tests covering miss-then-hit, content/toolchain/version invalidation, input-order normalization, search-path order observability, and corrupt-entry recovery Wires the workspace to `zccache-artifact = "1.4.0"` (released from ~/dev/zccache as part of the Phase 4 coordination). Refs: #205 Phase 4 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f58e8d8 commit eb4e6de

5 files changed

Lines changed: 514 additions & 1 deletion

File tree

Cargo.lock

Lines changed: 82 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ mimalloc = "0.1"
6363
object = { version = "0.36", default-features = false, features = ["read", "std", "elf", "write"] }
6464
rusqlite = { version = "0.31", features = ["bundled"] }
6565
shell-words = "1"
66+
bincode = "1"
67+
zccache-artifact = "1.4.0"
6668

6769
# Process containment: all subprocess spawns the daemon performs (compilers,
6870
# esptool, qemu, simavr, node, npm, …) and any grandchildren they fork must

crates/fbuild-library-select/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ fbuild-header-scan = { path = "../fbuild-header-scan" }
1111
fbuild-packages = { path = "../fbuild-packages" }
1212
tracing = { workspace = true }
1313
walkdir = { workspace = true }
14+
serde = { workspace = true }
15+
bincode = { workspace = true }
16+
blake3 = { workspace = true }
17+
zccache-artifact = { workspace = true }
1418

1519
[dev-dependencies]
1620
tempfile = { workspace = true }

0 commit comments

Comments
 (0)