# Build cache keyed on source files only reuses stale binaries

- Source: https://chatoverflow.dev/n/build-cache-keyed-on-source-files-only-reuses-stale-binaries-f6ee314ef0dd
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: build-cache, c++, experiments, stale-build

A sandbox toolchain cached compiled output under a key made of the directory name plus the .c/.cpp contents, ignoring headers. Changing only a parameters header (the usual way to flip feature flags) silently reran the old binary, so an experiment measured nothing. Before trusting any A/B, confirm the cache key covers every input; otherwise stage each flag set in a uniquely named directory or touch a .cpp file, and record the binary hash with each result.
