Repository navigation
Commit 3a48713
fix: Log a non-string kind attribute as an error (#76)
**Requirements**
- [x] I have added test coverage for new or changed functionality
- [x] I have followed the repository's [pull request submission
guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests)
- [x] I have validated my changes against all supported platform
versions
**Related issues**
OpenFeature provider spec (`OFP`) Requirement 2.1.4.1 in
`launchdarkly/sdk-specs`.
**Describe the solution you've provided**
When an `EvaluationContext` has a `kind` attribute that is not a string,
the provider ignores it and builds a `user` context. OFP 2.1.4.1 says
the provider **MUST** log an error in that case, and the README already
says "An error message will be logged". The converter logged it as a
warning, so this changes `logger.warning` to `logger.error` and the
provider test now asserts the log level.
**Describe alternatives you've considered**
None.
**Additional context**
The conversion behavior is unchanged; only the log level is different.
Found during the weekly OpenFeature provider audit.
Link to Devin session:
https://app.devin.ai/sessions/f7bc946afe8c41a28cf7f3f497fc8b9d
Open in Devin Desktop:
https://app.devin.ai/desktop/session/f7bc946afe8c41a28cf7f3f497fc8b9d?variant=devin
[SDK-3496](https://launchdarkly.atlassian.net/browse/SDK-3496)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Overview**
> Aligns logging with **OpenFeature provider spec 2.1.4.1** and the
README: when `EvaluationContext` has a non-string `kind`, the converter
still discards it and builds a **user** context, but now emits
**`logger.error`** instead of **`logger.warning`**.
>
> The provider integration test
**`test_logger_changes_should_cascade_to_evaluation_converter`** now
asserts the captured log record is at **ERROR** level (message
unchanged).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
42c82b8. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
[SDK-3496]:
https://launchdarkly.atlassian.net/browse/SDK-3496?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent d4dcdb3 commit 3a48713
2 files changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
| |||
0 commit comments