fix: fall back to CACHEKIT_MASTER_KEY env var in cache.secure decorator#79
Merged
fix: fall back to CACHEKIT_MASTER_KEY env var in cache.secure decorator#79
Conversation
Closes #69 — cache.secure short-circuited with ValueError before reaching the pydantic-settings config layer that resolves CACHEKIT_MASTER_KEY from the environment. Now uses get_settings().master_key as fallback before raising, consistent with how the nested config layer already works.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Coverage for the fix in intent.py — CI measures coverage only on tests/critical/ for PRs, so these need to live here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@cache.secure(ttl=300)short-circuited withValueErrorbefore reaching the pydantic-settings config layer that resolvesCACHEKIT_MASTER_KEYfrom the environmentget_settings().master_keybefore raising, consistent with how the nested config layer already worksCloses #69
Test plan
test_secure_decorator_reads_master_key_from_env— verifies env var fallbacktest_secure_decorator_requires_master_key— explicitly clears env var so ValueError path is tested correctly (conftest was masking this)test_secure_preset_requires_master_keyin docs tests — same fix