fix(prompt-cache): align default key with production semantics#63
Open
fix(prompt-cache): align default key with production semantics#63
Conversation
Greptile SummaryUpdated prompt cache key generation to default unlabeled/unversioned fetches to Key changes:
Validation:
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 7a4cbb1 |
There was a problem hiding this comment.
Pull request overview
This PR updates the default prompt cache key generation behavior to align with JavaScript and Python SDK semantics. When fetching prompts without specifying a version or label, the cache key now defaults to name:production instead of just name, ensuring consistency across Langfuse SDKs.
Changes:
- Modified
PromptCache.build_keyto append:productionsuffix when both version and label are nil - Updated all test expectations across prompt cache, Rails cache adapter, and API client specs to reflect the new default behavior
- Added unreleased changelog entry documenting the change and cross-SDK alignment
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
lib/langfuse/prompt_cache.rb |
Core implementation: adds :production suffix to cache keys when version and label are unspecified |
spec/langfuse/prompt_cache_spec.rb |
Updated test expectations for name-only cache key generation |
spec/langfuse/rails_cache_adapter_spec.rb |
Updated test expectations for Rails cache adapter key building |
spec/langfuse/api_client_spec.rb |
Updated mock expectations to use :production suffix in cache key assertions |
CHANGELOG.md |
Documented the semantic change in the unreleased section |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Supersedes #57 after branch rename to conventional format.
TL;DRWhyChecklistCloses #
Summary
Langfuse::PromptCache.build_keyto default no-version/no-label keys toname:production.bundle exec rspec(1154 examples, 0 failures, 98.04% coverage),bundle exec rubocop(no offenses), and Langfuse CLI API contract check vianpx langfuse-cli api prompts get --helpconfirming default prompt retrieval semantics.Architecture (Core Change)
Mermaid not applicable (cache-key default behavior and test expectation updates only).