fix: treat empty-string credentials as missing and skip malformed media reference segments - #1806
Open
lorenzozanee wants to merge 1 commit into
Open
Conversation
…ia reference segments
|
|
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.
Fixes langfuse/langfuse#15280
What does this PR do?
Treats empty-string credentials as missing so
Langfusedisables itself at initialization with the existing warning instead of building a fully-wired client and failing later with an opaque auth error on the first request. An unsetLANGFUSE_PUBLIC_KEYorLANGFUSE_SECRET_KEYrendered as""by a templated Docker/Kubernetes env file previously bypassed theis Noneguard; the guard now checks falsiness, restoring the pre-v3.0.0 behavior.Also makes
LangfuseMedia.parse_reference_stringskip pipe-separated segments without=, so a malformed segment or a trailing|no longer raises a rawValueError: not enough values to unpack. Genuinely incomplete references still raise the documentedValueError: Missing required fields in reference string.Type of change
Verification
mainand pass with this change.Checklist
code_review.md..env.templateif needed.Note: #1772 also addresses this issue with a broader scope; this PR keeps the change minimal and focused on the two behaviors described in the issue.
Greptile Summary
The PR makes client initialization fail closed when either credential resolves to an empty string and makes media-reference parsing tolerate malformed pipe-separated segments while retaining required-field validation.
=are ignored, including trailing empty segments.Confidence Score: 5/5
The PR appears safe to merge, with no concrete blocking or non-blocking defects identified in the changed behavior.
Empty credentials now follow the established disabled-client path, and malformed media segments are skipped without bypassing required-field validation.
Reviews (1): Last reviewed commit: "fix: treat empty-string credentials as m..." | Re-trigger Greptile
Context used: