Files
stack/tests/pfs/test_families.py
kert aa108797a2 fix(pfs): refresh_from never clears FAMILIES mid-swap; fix its stale docstring (refs #691 #692)
Minor from the final fix wave: refresh_from used to FAMILIES.clear()
then .update(merged) — a concurrent detect_codes/family_of read
(the chat runs each turn in a threadpool worker) could observe an
empty registry in the window between those two calls. Now
FAMILIES.update(merged) first, then delete whatever key isn't in the
new merge — every in-between state is old UNION new, never empty.

Also fixes the FAMILIES module docstring, which still said "the chat
sees hand families only" — stale since Task 1 (P49) wired
llm.evidence.warm/_connect to call refresh_from on every replica
(re)open, at API startup and again before every detect_codes call.

New tests: a stale key not in the new merge is dropped by the end of
refresh_from; refresh_from never calls FAMILIES.clear() (verified by
swapping in a dict subclass whose clear() raises).
2026-09-10 13:32:05 -04:00

59 KiB