Repository navigation
fix: add typed variation accessors with WRONG_TYPE detail (#centinel coverage hunt) - #547
Draft
JackDanger wants to merge 1 commit into
Draft
JackDanger wants to merge 1 commit into
JackDanger wants to merge 1 commit into
Conversation
…overage hunt)
The public API had only the generic variation()/variation_detail(); the migration
surface carried the only wrong-type contract (client.py migration_variation). The
typed evaluation contract (typed defaults -> default + errorKind WRONG_TYPE, as the
official sdk-test-harness server-side-eval corpus prices) was unreachable.
bool/string/int/float/json variation(_detail) now ride one typed evaluator that
preserves the SDK's existing error reasons and, for a successful evaluation whose
value does not have the requested type, returns the caller default with
{"kind": "ERROR", "errorKind": "WRONG_TYPE"}.
Co-Authored-By: Kimi (LD Research via termag)
Generated-by: termag
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.
Coverage-hunt findings from the centinel verifier coverage census (campaign run book + official sdk-test-harness rides) against python-server-sdk 9.18.4 at main.
Repro one-liner: verifier census rows
N0-errors-wrong-type-501c2a6282f5/01..06(corpusserver-side-eval__errors-wrong-type.ymlfrom the harness v3 data files,requireCapability: strongly-typed): on a caller-requested type the flag's value of a different JSON type is served verbatim with akind OFF-style reason — e.g. expectedtrue, observed1; expectederrorKind WRONG_TYPE, observed absent — 12 named red rows across the legacy + ds banks.Root cause: the public API exposes only the generic
variation()/variation_detail(); there are no typed accessors (bool/int/float/string), so the typed evaluation contract (caller asks bool, flag stores number: default +errorKind WRONG_TYPE, as the Go/Java/Node server SDKs serve it) is unreachable.migration_variationalready carries the only wrong-type check today (ldclient/client.py:458).Fix (this PR): add
bool_variation(_detail),string_*,int_*,float_*(the numeric-family conversions the other server SDKs serve) andjson_variationatop one typed evaluator that preserves the SDK's existing error reasons and, for a successful evaluation whose value lacks the requested type, returns the caller default with{"kind": "ERROR", "errorKind": "WRONG_TYPE"}.Post-fix evidence: the census rows
N0-errors-wrong-type-501c2a6282f5/01..06ride pass 7/7, rc 0 against the patched tree (evidence runpy-fix-wrongtype1in the centinel verifier run-dirs; the valueType evaluate path uses the new accessors via the coverage-hunt seat).via LD Research 🤖