protected_records
Cache records whose rows the cache must never discard on its own.
Almost everything in the pod cache is derived: analysis output, file metadata,
fetched EHR data. When a table's physical schema cannot be used, the cache can
rebuild it, or (with BITFOUNT_DISCARD_UNSUPPORTED_CACHE) delete the whole
file, because the next run recomputes or re-fetches the rows.
The records here are different. They hold the site's own input — a site user's reviews and notes on a patient for a trial — which exists nowhere else, so no run can bring it back. The cache treats them as protected:
SqliteCache._ensure_typesrefuses to drop-and-recreate a protected table whose primary key changed while it still holds rows.SqliteCacherefuses to delete the cache file underBITFOUNT_DISCARD_UNSUPPORTED_CACHEwhile any protected table holds rows.- The "delete the cache file" recovery message warns that doing so loses them.
Each refusal raises ProtectedCacheDataError. An empty protected table is
not protected: losing it loses nothing.
Every entry is a record name in the cache type registry and also its table
name (the cache checks the physical table by that name), validated by
tests/bitfount/cache/test_protected_records.py.