refactor(entities): drop process-lifetime read caches; read entity domain fresh
Remove all six module-level read-cache globals and their five clear_*
functions from the entity domain so every accessor reads fresh from disk.
These caches were harmless in one-shot CLI but were silent stale-read bugs
under the long-lived convey server: an out-of-process write left the cache
serving data that no longer matched disk.
Removed caches:
- _JOURNAL_ENTITY_CACHE (entities/journal.py)
- _RELATIONSHIP_CACHE + _RELATIONSHIP_IDS_CACHE (entities/relationships.py)
- _ENTITY_LOADING_CACHE (entities/loading.py)
- _OBSERVATION_CACHE + _OBSERVATION_COUNT_CACHE (entities/observations.py)
Replaced the cache-warm patterns in the two provably-hot all-facets loops
with operation-scoped memos passed by argument (no module globals):
- load_all_attached_entities threads a single journal_entities dict into
_load_entities_from_relationships, computed once instead of per-facet.
- get_journal_entities_data builds an all_relationships memo once and passes
it into _build_facet_relationships, replacing the discarded pre-warm loop.
Single-entity routes (get_journal_entity, voice tools) read fresh.
merge: dropped _clear_merge_caches; caches_cleared now reports only
["discovery_clusters"] when that on-disk artifact is unlinked, else [].
indexer no longer clears domain caches (also removes a latent L6 smell).
Tests: removed the autouse cache-clearing fixtures and all clear_* call
sites (test isolation is now automatic per tmp/fixture journal); converted
the two cache-mechanism tests to freshness assertions; added same-process
write->fresh-read coverage for journal entities, relationships, and
observations. link/auth.py mtime-reload left untouched.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>