Skip to content

fix: Map the WRONG_TYPE error kind to TYPE_MISMATCH - #27

Open
kinyoklion wants to merge 2 commits into
mainfrom
devin/1788210922-php-wrong-type
Open

fix: Map the WRONG_TYPE error kind to TYPE_MISMATCH#27
kinyoklion wants to merge 2 commits into
mainfrom
devin/1788210922-php-wrong-type

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Aug 31, 2026

Copy link
Copy Markdown
Member

Maps the LaunchDarkly WRONG_TYPE evaluation error kind to the OpenFeature TYPE_MISMATCH error code.

  • The kind previously fell through to GENERAL, so an application could not distinguish a flag whose type does not match the requested one from any other evaluation error.
  • Found during the weekly OpenFeature provider audit; OFP requirement 3.2.3 prescribes this mapping, and the Java, .NET, Python, Ruby and JavaScript providers all implement it.
Implementation details
case EvaluationReason::WRONG_TYPE_ERROR:
    return new ResolutionError(ErrorCode::TYPE_MISMATCH());

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

None. The same gap was fixed this week in openfeature-python-server#57 and js-core#1888.

Describe the solution you've provided

ResolutionDetailsConverter::errorKindToCode gains the missing case. The LaunchDarkly PHP SDK reports this kind when a flag's value does not match the requested type, which OpenFeature represents as TYPE_MISMATCH.

Describe alternatives you've considered

None; the mapping is prescribed by the provider spec.

Testing

make check (composer cs-check, composer phpstan, composer phpunit). The new test drives the converter directly, since the provider's own type checking intercepts most mismatches before the SDK reports this kind.

Link to Devin session: https://app.devin.ai/sessions/38a6eaf69fcf41109e136a1d0fe5e899
Open in Devin Desktop: https://app.devin.ai/desktop/session/38a6eaf69fcf41109e136a1d0fe5e899?variant=devin
Requested by: @kinyoklion


Note

Overview
When the LaunchDarkly SDK returns an evaluation error with kind WRONG_TYPE_ERROR, the OpenFeature provider now surfaces TYPE_MISMATCH instead of the generic GENERAL code.

ResolutionDetailsConverter::errorKindToCode gains the missing switch case so callers can tell a wrong flag type apart from other evaluation failures, matching OpenFeature provider spec 3.2.3 and the other LaunchDarkly OpenFeature SDKs.

A new unit test exercises the converter directly with EvaluationReason::error(WRONG_TYPE_ERROR) and asserts Reason::ERROR plus ErrorCode::TYPE_MISMATCH().

Reviewed by Cursor Bugbot for commit 7fe8ed8. Bugbot is set up for automated code reviews on this repo. Configure here.

devin-ai-integration Bot and others added 2 commits August 31, 2026 21:16
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration

Copy link
Copy Markdown
Contributor

@cursor review

@kinyoklion
kinyoklion marked this pull request as ready for review August 31, 2026 21:26
@kinyoklion
kinyoklion requested a review from a team as a code owner August 31, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant