fix: default L1-Status header for standalone CachekitIO usage#64
Open
fix: default L1-Status header for standalone CachekitIO usage#64
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
When _inject_metrics_headers() receives None stats (standalone backend without @cache decorator), return X-CacheKit-L1-Status: disabled instead of empty dict. Also remove the `if stats is not None` guard at both call sites (_request_sync, _request_async) so headers are always injected. Without this fix, standalone usage with ck_sdk_* API keys triggers 400 from the SaaS which requires the L1-Status header.
10440d2 to
09dc062
Compare
…ownload-artifact v8)
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
Fix standalone CachekitIO backend to always send
X-CacheKit-L1-Statusheader.Problem
When
_inject_metrics_headers()receivesNonestats (standalone backend without@cachedecorator), it returned an empty dict{}. The SaaS requiresX-CacheKit-L1-Statusforck_sdk_*API keys and returns 400 without it.Additionally, both call sites (
_request_sync,_request_async) guarded withif stats is not None, meaning the function was never called for standalone usage — the fix inside the function was dead code.Fix
_inject_metrics_headers(None)now returns{"X-CacheKit-L1-Status": "disabled"}if stats is not Noneguard from both call sites — headers always injectedTest plan