[confmap/envprovider] Fix empty default resolving to nil instead of empty string#15131
Open
lazureykis wants to merge 1 commit intoopen-telemetry:mainfrom
Open
[confmap/envprovider] Fix empty default resolving to nil instead of empty string#15131lazureykis wants to merge 1 commit intoopen-telemetry:mainfrom
lazureykis wants to merge 1 commit intoopen-telemetry:mainfrom
Conversation
…mpty string
When ${env:VAR:-} is used with an unset variable, the empty default
was passed through YAML unmarshaling which converts empty input to nil.
Skip YAML unmarshaling for this case, returning "" directly.
Fixes open-telemetry#14587
Assisted-by: Claude Opus 4.6
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15131 +/- ##
==========================================
+ Coverage 91.24% 91.25% +0.01%
==========================================
Files 699 699
Lines 44913 44915 +2
==========================================
+ Hits 40979 40987 +8
+ Misses 2786 2782 -4
+ Partials 1148 1146 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Description
When using
${env:VAR:-}with an unset variable, the empty default waspassed through YAML unmarshaling (
NewRetrievedFromYAML), which convertsempty input to
nil. This caused downstream validation failures incomponents that distinguish between
nil(unset) and""(explicitly empty).Skip YAML unmarshaling when the resolved value is an empty string from an
explicit default, returning
""directly viaNewRetrieved.Link to tracking issue
Fixes #14587
Testing
Added
TestEmptyDefaultReturnsEmptyStringverifyingAsRaw()returns""for
${env:VAR:-}with an unset variable. All existing envprovider, confmap,and e2e tests pass.
Documentation
No documentation changes needed.