Files
codebase-memory-mcp/tests
Martin Vogel 45bac491ed fix(daemon): cache only the process's own image fingerprint
The fingerprint cache sat in every fingerprinting acquire, including
peer verification. Limit it to the process's own image: every acquire
site now passes the process id to the shared resolve step, which marks
a peer's key invalid, so a peer is never looked up, never committed,
and is hashed on every fingerprint. Re-hashing of verified peer copies
is handled by the runtime service's retained peer references (#2335).
The daemon's saving is unchanged: it hashes its own image once at start
instead of twice.

A process has one own image, so the cache drops from 8 entries to 1,
which removes the slot search and the round-robin eviction.

The cache comment no longer claims that SetFileTime cannot reset the
Windows change time; SetFileInformationByHandle can set it. Limited to
the own image, the key does not rely on it: Windows keeps a running
image locked against modification for as long as the process, and so
the cache, exists.

Test: daemon_runtime_process_fingerprint_caches_only_own_image spawns
this runner as a peer, whose image has the same file identity as the
own image, and asserts that two peer fingerprints cost two hashes, two
own fingerprints one more, and a later peer fingerprint one more again.
Before this change the second peer fingerprint was served from the
cache.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-10 23:06:35 +01:00
..