Repository navigation
Commit 17478dc
fix: Map the WRONG_TYPE error kind to TYPE_MISMATCH (#57)
The `WRONG_TYPE` evaluation error kind is now reported as
`ErrorCode.TYPE_MISMATCH` instead of falling through to `GENERAL`.
- Required by the OFP spec's error kind mapping
- Brings the Python provider in line with the Ruby and .NET providers,
which already map it
<details>
<summary>Implementation details</summary>
Found during the weekly OpenFeature provider audit against
`launchdarkly/sdk-specs` (`OFP`).
`ResolutionDetailsConverter` mapped `CLIENT_NOT_READY`,
`FLAG_NOT_FOUND`, `MALFORMED_FLAG` and `USER_NOT_SPECIFIED`, and every
other kind — including `WRONG_TYPE` — became `GENERAL`, hiding a type
mismatch from callers that branch on the error code. `EXCEPTION_ERROR`
intentionally remains mapped to `GENERAL`.
**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**
None.
**Describe alternatives you've considered**
None; the mapping is prescribed by the spec.
**Testing**
`poetry run pytest` (80 passed), `poetry run mypy ld_openfeature tests`
</details>
Link to Devin session:
https://app.devin.ai/sessions/38a6eaf69fcf41109e136a1d0fe5e899
Requested by: @kinyoklion
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Overview**
> LaunchDarkly evaluation errors with **`errorKind: WRONG_TYPE`** are
now converted to OpenFeature **`ErrorCode.TYPE_MISMATCH`** in
`ResolutionDetailsConverter`, instead of defaulting to **`GENERAL`**.
>
> A parametrized test covers the new mapping so callers that branch on
error codes can detect type mismatches per the OpenFeature provider spec
(aligned with other LaunchDarkly providers).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
20eada9. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent 946a515 commit 17478dc
2 files changed
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
0 commit comments