Bug Summary
After PR #1034 (KSM-1004: resolve KSMCache path lazily so KSM_CACHE_DIR is honored after import), KSMCache.kms_cache_file_name is no longer used by cache operations.
This appears to be a breaking change for consumers that override KSMCache.kms_cache_file_name programmatically instead of using KSM_CACHE_DIR.
Current Behavior
save_cache, get_cached_data, and remove_cache_file now call KSMCache.get_cache_file_path(), which always resolves the path from KSM_CACHE_DIR and the default filename:
os.path.join(os.environ.get("KSM_CACHE_DIR", ""), "ksm_cache.bin")
As a result, changing:
KSMCache.kms_cache_file_name = "/custom/path/my_cache.bin"
has no effect.
Expected Behavior
If kms_cache_file_name is kept for backward compatibility, cache operations should still honor it.
At minimum, one of these should be true:
kms_cache_file_name continues to override the cache file path when explicitly set, or
- the attribute is removed or deprecated clearly as a breaking change and documented accordingly.
Why this is a problem
The PR description says:
Keep the kms_cache_file_name class attribute for backward compatibility (no longer governs behavior)
But if existing integrations depended on setting that attribute, behavior has changed incompatibly.
Reproduction
Before PR #1034, code like this worked:
from keeper_secrets_manager_core.core import KSMCache
KSMCache.kms_cache_file_name = "/tmp/custom_cache.bin"
KSMCache.save_cache(b"test")
assert KSMCache.get_cached_data() == b"test"
KSMCache.remove_cache_file()
After PR #1034, the override is ignored and the cache is written to the path derived from KSM_CACHE_DIR or the default CWD-relative location instead.
Suggested Fix
Consider updating get_cache_file_path() to preserve the legacy override behavior, for example by honoring kms_cache_file_name when it has been explicitly changed from the default value.
Alternatively, document this as a breaking change and provide a supported migration path.
Related
Bug Summary
After PR #1034 (
KSM-1004: resolve KSMCache path lazily so KSM_CACHE_DIR is honored after import),KSMCache.kms_cache_file_nameis no longer used by cache operations.This appears to be a breaking change for consumers that override
KSMCache.kms_cache_file_nameprogrammatically instead of usingKSM_CACHE_DIR.Current Behavior
save_cache,get_cached_data, andremove_cache_filenow callKSMCache.get_cache_file_path(), which always resolves the path fromKSM_CACHE_DIRand the default filename:As a result, changing:
has no effect.
Expected Behavior
If
kms_cache_file_nameis kept for backward compatibility, cache operations should still honor it.At minimum, one of these should be true:
kms_cache_file_namecontinues to override the cache file path when explicitly set, orWhy this is a problem
The PR description says:
But if existing integrations depended on setting that attribute, behavior has changed incompatibly.
Reproduction
Before PR #1034, code like this worked:
After PR #1034, the override is ignored and the cache is written to the path derived from
KSM_CACHE_DIRor the default CWD-relative location instead.Suggested Fix
Consider updating
get_cache_file_path()to preserve the legacy override behavior, for example by honoringkms_cache_file_namewhen it has been explicitly changed from the default value.Alternatively, document this as a breaking change and provide a supported migration path.
Related