Summary
When using the cache-keys field with a flat source layout, uv always triggers a rebuild, even when none of the relevant files have changed.
By default, (e.g. with uv init --lib --build-backend=scikit .), uv creates a src/ dir, and includes in the cache-keys { file = "src/**/*.{h,c,hpp,cpp}" }. This works as you would expect.
If instead you have no nesting - source files flat in the top-level directory, and set cache-keys to { file = "*.{h,c,hpp,cpp}" }, uv will trigger a rebuild every time, even if no files have changed.
Minimal Reproducible Example
See https://github.com/jgauth/uv-scikit-flat
Clone, run uv run python repeatedly. Observe that uv rebuilds the packages every time.
Platform
Ubuntu 22.04.5 LTS Linux 5.15.0-156-generic x86_64 GNU/Linux
Version
uv 0.9.3
Python version
Python 3.11.8