pub fn env_reads_here() -> u64Expand description
The same count, for the calling thread only.
env_reads is process-wide, which makes it the right number to report and
the wrong number to assert on: any other thread opening a store moves it,
so a guard written against it is a race dressed as a test. It was only ever
accidentally deterministic — until 2026-08-10 the sole reader was
StoreConfig::from_env, every caller of which took ENV_LOCK, so the
tests that counted were the only tests that counted. That stopped being true
when redb_cache_bytes joined it: every store open reads the
environment now, including GitStore::open,
and most of the suite opens stores without the lock.
So the law is asserted per thread, where a call path actually lives. It is also the stronger statement: “this thread served 2687 objects and touched the environment zero times” is what the law says, and it is now true regardless of what else the process is doing.