You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cache): guard against saving cache-derived System_Settings snapshots
System_Settings.objects.get() returns a read-only snapshot rebuilt from the
in-process (L1) cache; saving it could overwrite concurrent changes with stale
field values. Tag such instances and make System_Settings.save() fail loudly
instead of silently persisting a stale snapshot.
- dojo/caching.py: add READ_ONLY_CACHE_MARKER, ReadOnlyCachedInstanceError, and
a read_only= param on cache_dict_to_model (default off, so tuner/features keep
saving their rebuilt instances for their read-modify-write flows).
- System_Settings.save() raises ReadOnlyCachedInstanceError when the instance is
tagged; get_cached_system_settings() tags the snapshot read_only=True.
- Migrate get()->modify->save() writer sites (incl. the system_settings() test
helper) to objects.get(no_cache=True) for a fresh, saveable row.
- Document the singleton manager .get() semantics (ignores filter kwargs, never
raises DoesNotExist; data migrations use apps.get_model, so get_or_create is
unaffected). Fix stale L1/L2 comments left by the drop-L2 change.
- test_caching: cover the save-guard and the read_only flag.
0 commit comments