Skip to content

Tolerate unknown fields in OpenFlagr evaluation responses - #9

Merged
NoahHsu merged 1 commit into
mainfrom
bugfix/tolerate-unknown-response-fields
Aug 20, 2026
Merged

NoahHsu merged 1 commit into
mainfrom
bugfix/tolerate-unknown-response-fields

Conversation

@fukuanru

Copy link
Copy Markdown
Collaborator

Problem

OpenFlagr 1.2.3 added new fields (flagTags, recordSource) to the POST /api/v1/evaluation response. DefaultOpenFlagrApiClient deserializes the response with a default-configured ObjectMapper, whose FAIL_ON_UNKNOWN_PROPERTIES is enabled, so Jackson throws on the new fields. The exception is wrapped into OpenFlagrException, which DefaultOpenFlagr catches and turns into false / Optional.empty() — meaning that after a server-side OpenFlagr upgrade, every feature flag silently falls back to its default value while the service keeps running with only an error log (failed to execute post evaluation).

We hit this in production-like environments: all flags evaluated as off/empty for a full day until the server was rolled back.

Fix

Disable FAIL_ON_UNKNOWN_PROPERTIES on the client's ObjectMapper, so additive response changes from newer OpenFlagr servers no longer break deserialization. This is the standard posture for an API client per the robustness principle.

Test

Added a MockWebServer regression test that replays an OpenFlagr 1.2.3-style evaluation response containing flagTags / recordSource and unknown nested fields:

  • Without the fix, both tests fail with the exact production symptom (failed to execute post evaluation, isFeatureFlagOn returns false).
  • With the fix, postEvaluation parses the response and isFeatureFlagOn returns true.
  • ./gradlew build passes for the whole project.

🤖 Generated with Claude Code

OpenFlagr 1.2.3 added new fields (flagTags, recordSource) to the
POST /api/v1/evaluation response. DefaultOpenFlagrApiClient used a
default ObjectMapper with FAIL_ON_UNKNOWN_PROPERTIES enabled, so
deserialization threw on the new fields and every flag evaluation
silently fell back to its default value (off / empty).

Disable FAIL_ON_UNKNOWN_PROPERTIES on the client's ObjectMapper so
server-side additive changes no longer break evaluation, and add a
MockWebServer regression test covering a 1.2.3-style response.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@fukuanru
fukuanru force-pushed the bugfix/tolerate-unknown-response-fields branch from 84d2d9a to 2705da4 Compare August 20, 2026 06:04

@NoahHsu NoahHsu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@NoahHsu
NoahHsu merged commit cf31779 into main Aug 20, 2026
2 checks passed
@NoahHsu
NoahHsu deleted the bugfix/tolerate-unknown-response-fields branch August 20, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants